Skip to content

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

Try to fix root_api

Klaus Zanders5ceaca71e706
diff --git a/lib/api/root_api.rb b/lib/api/root_api.rb
index 08ca2adf660..c67867d2828 100644
--- a/lib/api/root_api.rb
+++ b/lib/api/root_api.rb
@@ -141,7 +141,13 @@ module API
#
# @raise [API::Errors::Unauthorized] when permission is not met
def authorize(permission, context: nil, global: false, user: current_user, &block)
- auth_service = -> { user.allowed_to?(permission, context, global:) }
+ auth_service = -> do
+ if global
+ user.allowed_in_any_project?(permission)
+ else
+ user.allowed_in_project?(permission, context)
+ end
+ end
authorize_by_with_raise auth_service, &block
end