summaryrefslogtreecommitdiffstats
path: root/app/controllers/roles_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-10-25 16:31:57 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-10-25 16:31:57 +0000
commitb4138257f0f541850f0f1dc77d02ab93d2e4d619 (patch)
tree0cc67e750544871a97f3b1e8756cd311198c5498 /app/controllers/roles_controller.rb
parent0dc7269c8878502744bf825b052ba6e1f37f6e7f (diff)
downloadredmine-b4138257f0f541850f0f1dc77d02ab93d2e4d619.tar.gz
redmine-b4138257f0f541850f0f1dc77d02ab93d2e4d619.zip
Specific action for updating role permissions.
git-svn-id: http://svn.redmine.org/redmine/trunk@18862 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/roles_controller.rb')
-rw-r--r--app/controllers/roles_controller.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index 985953377..0e29e8cfd 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -109,14 +109,16 @@ class RolesController < ApplicationController
end
@roles = scope.to_a
@permissions = Redmine::AccessControl.permissions.select { |p| !p.public? }
- if request.post?
- @roles.each do |role|
- role.permissions = params[:permissions][role.id.to_s]
- role.save
- end
- flash[:notice] = l(:notice_successful_update)
- redirect_to roles_path
+ end
+
+ def update_permissions
+ @roles = Role.where(:id => params[:permissions].keys)
+ @roles.each do |role|
+ role.permissions = params[:permissions][role.id.to_s]
+ role.save
end
+ flash[:notice] = l(:notice_successful_update)
+ redirect_to roles_path
end
private