OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Correctly check anonymous_permissions only for anonymous users
Klaus Zanders7c329f511865
diff --git a/app/services/authorization/user_permissible_service.rb b/app/services/authorization/user_permissible_service.rbindex 5cf7ef9b25d..06c0431bb03 100644--- a/app/services/authorization/user_permissible_service.rb+++ b/app/services/authorization/user_permissible_service.rb@@ -52,7 +52,7 @@ module Authorizationendend- def allowed_in_any_entity?(permission, entity_class, in_project: nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize+ def allowed_in_any_entity?(permission, entity_class, in_project: nil) # rubocop:disable Metrics/AbcSizeperms = contextual_permissions(permission, context_name(entity_class))return true if admin_and_all_granted_to_admin?(perms)@@ -67,7 +67,7 @@ module Authorization# or entities in the database. So if this returns false, we check non-member and anonymous permissions as well.allowed_scope.exists? ||non_member_permissions.intersect?(perms.map { |perm| perm.name.to_sym }) ||- (user.anonymous? && anonymous_permissions.intersect?(perms.map { |perm| perm.name.to_sym }))+ anonymous_permissions.intersect?(perms.map { |perm| perm.name.to_sym })endend@@ -137,7 +137,11 @@ module Authorizationenddef anonymous_permissions- @anonymous_permissions ||= ProjectRole.anonymous.permissions+ @anonymous_permissions ||= if user.anonymous?+ ProjectRole.anonymous.permissions+ else+ []+ endendendend