summaryrefslogtreecommitdiffstats
path: root/app/controllers/roles_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-09-03 17:04:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-09-03 17:04:28 +0000
commitca7498c2d6cc31176690b597dba10f7c853a8b57 (patch)
treebe7b1c5e21e0b72b064373cda73557ef4f8ab8ba /app/controllers/roles_controller.rb
parent1b64e4be5ea81389da7f10c5e76dfb3a504688a7 (diff)
downloadredmine-ca7498c2d6cc31176690b597dba10f7c853a8b57.tar.gz
redmine-ca7498c2d6cc31176690b597dba10f7c853a8b57.zip
Create role by copy (#9258).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10285 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/roles_controller.rb')
-rw-r--r--app/controllers/roles_controller.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index 790eb28d4..5f3885267 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -36,8 +36,11 @@ class RolesController < ApplicationController
end
def new
- # Prefills the form with 'Non member' role permissions
+ # Prefills the form with 'Non member' role permissions by default
@role = Role.new(params[:role] || {:permissions => Role.non_member.permissions})
+ if params[:copy].present? && @copy_from = Role.find_by_id(params[:copy])
+ @role.copy_from(@copy_from)
+ end
@roles = Role.sorted.all
end