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

Use `allowed_based_on_permission_context` for menu items

Klaus Zanderscd524b8815a6
diff --git a/lib/redmine/menu_manager/menu_helper.rb b/lib/redmine/menu_manager/menu_helper.rb
index 8796224a0cd..22b737476f1 100644
--- a/lib/redmine/menu_manager/menu_helper.rb
+++ b/lib/redmine/menu_manager/menu_helper.rb
@@ -420,20 +420,8 @@ module Redmine::MenuManager::MenuHelper
return true unless url
begin
- user.allowed_in_project?(url, project)
+ user.allowed_based_on_permission_context?(url, project:)
rescue Authorization::UnknownPermissionError, Authorization::IllegalPermissionContextError
- # As we throw every possible URL in here, there might be URLs that are not backed by a permission or that are
- # global permissions. Let's ignore those errors and just treat them as the user does not have access, as this
- # mirrors what the system did before as well.
- # We might catch the IllegalPermissionContextError here and check if the permission is a global one and then
- # check if the user is globaly allowed.
- #
- # rescue Authorization::IllegalPermissionContextError => e
- # if e.allowed_contexts.include?(:global)
- # user.allowed_globally?(url)
- # else
- # false
- # end
false
end
end