add_to_permissions_from_plugins.patch

updated for Redmine 1.3-stable branch - LluĂ­s Gili, 2012-03-23 11:59

Download (1.07 KB)

View differences:

lib/redmine/access_control.rb
94 94
        @public = options[:public] || false
95 95
        @require = options[:require]
96 96
        @project_module = options[:project_module]
97
        add_actions(hash)
98
      end
99

  
100
      def add_actions(hash)
97 101
        hash.each do |controller, actions|
98 102
          if actions.is_a? Array
99 103
            @actions << actions.collect {|action| "#{controller}/#{action}"}
lib/redmine/plugin.rb
221 221
      end
222 222
    end
223 223

  
224
    def add_permission(name, actions)
225
      AccessControl.permission(name).add_actions(actions) unless AccessControl.permission(name).nil?
226
    end
227

  
224 228
    # Defines a project module, that can be enabled/disabled for each project.
225 229
    # Permissions defined inside +block+ will be bind to the module.
226 230
    #