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

Ignore UnknownPermissionError in the menu helper

Klaus Zandersb9dc1b1fd9f9
diff --git a/lib/redmine/menu_manager/menu_helper.rb b/lib/redmine/menu_manager/menu_helper.rb
index aa45d20cf34..0b07181684e 100644
--- a/lib/redmine/menu_manager/menu_helper.rb
+++ b/lib/redmine/menu_manager/menu_helper.rb
@@ -414,11 +414,18 @@ module Redmine::MenuManager::MenuHelper
def node_action_allowed?(node, project, user)
return true if node.skip_permissions_check?
+ return false if user.nil?
url = node.url(project)
return true unless url
- user&.allowed_in_project?(url, project)
+ begin
+ user.allowed_in_project?(url, project)
+ rescue Authorization::UnknownPermissionError
+ # As we might throw every possible URL in here, we might also have URLs
+ # that are not backed by any permissions. Let's just ignore those.
+ false
+ end
end
def visible_node?(menu, node)