]> source.dussan.org Git - redmine.git/commitdiff
Check permissions before the extra condition for displaying a menu item (#12721).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 4 Jan 2013 08:21:33 +0000 (08:21 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 4 Jan 2013 08:21:33 +0000 (08:21 +0000)
Patch by Daniel Ritz.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11112 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/menu_manager.rb

index 1bb991178b5702f4314e336fe99372a81cfe1572..94b92c6b73172854a26fbd3c813baa170c879bff 100644 (file)
@@ -190,20 +190,17 @@ module Redmine
 
       # Checks if a user is allowed to access the menu item by:
       #
-      # * Checking the conditions of the item
       # * Checking the url target (project only)
+      # * Checking the conditions of the item
       def allowed_node?(node, user, project)
+        if project && user && !user.allowed_to?(node.url, project)
+          return false
+        end
         if node.condition && !node.condition.call(project)
           # Condition that doesn't pass
           return false
         end
-
-        if project
-          return user && user.allowed_to?(node.url, project)
-        else
-          # outside a project, all menu items allowed
-          return true
-        end
+        return true
       end
     end