Project

General

Profile

Feature #5095 » add_to_permissions_from_plugins.patch

patch - Lluís Gili, 2010-03-16 13:46

View differences:

lib/redmine/access_control.rb
end
@actions.flatten!
end
def add_actions(hash)
hash.each do |controller, actions|
if actions.is_a? Array
@actions << actions.collect {|action| "#{controller}/#{action}"}
else
@actions << "#{controller}/#{actions}"
end
end
@actions.flatten!
end
def public?
@public
end
lib/redmine/plugin.rb
Redmine::AccessControl.map {|map| map.permission(name, actions, options)}
end
end
def add_permission(name, actions)
AccessControl.permission(name).add_actions(actions) unless AccessControl.permission(name).nil?
end
# Defines a project module, that can be enabled/disabled for each project.
# Permissions defined inside +block+ will be bind to the module.
(1-1/2)