Project

General

Profile

Patch #12721 ยป menu-manager-optimize.patch

Daniel Ritz, 2013-01-03 14:45

View differences:

lib/redmine/menu_manager.rb
190 190

  
191 191
      # Checks if a user is allowed to access the menu item by:
192 192
      #
193
      # * Checking the conditions of the item
194 193
      # * Checking the url target (project only)
194
      # * Checking the conditions of the item
195 195
      def allowed_node?(node, user, project)
196
        if project && user && !user.allowed_to?(node.url, project)
197
          return false
198
        end
196 199
        if node.condition && !node.condition.call(project)
197 200
          # Condition that doesn't pass
198 201
          return false
199 202
        end
200

  
201
        if project
202
          return user && user.allowed_to?(node.url, project)
203
        else
204
          # outside a project, all menu items allowed
205
          return true
206
        end
203
        return true
207 204
      end
208 205
    end
209 206

  
    (1-1/1)