Mercurial > hg > soundsoftware-site
comparison app/controllers/roles_controller.rb @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:02:21 +0100 |
parents | 433d4f72a19b |
children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
1294:3e4c3460b6ca | 1295:622f24f53b42 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
24 accept_api_auth :index, :show | 24 accept_api_auth :index, :show |
25 | 25 |
26 def index | 26 def index |
27 respond_to do |format| | 27 respond_to do |format| |
28 format.html { | 28 format.html { |
29 @role_pages, @roles = paginate :roles, :per_page => 25, :order => 'builtin, position' | 29 @role_pages, @roles = paginate Role.sorted, :per_page => 25 |
30 render :action => "index", :layout => false if request.xhr? | 30 render :action => "index", :layout => false if request.xhr? |
31 } | 31 } |
32 format.api { | 32 format.api { |
33 @roles = Role.givable.all | 33 @roles = Role.givable.all |
34 } | 34 } |
56 # workflow copy | 56 # workflow copy |
57 if !params[:copy_workflow_from].blank? && (copy_from = Role.find_by_id(params[:copy_workflow_from])) | 57 if !params[:copy_workflow_from].blank? && (copy_from = Role.find_by_id(params[:copy_workflow_from])) |
58 @role.workflow_rules.copy(copy_from) | 58 @role.workflow_rules.copy(copy_from) |
59 end | 59 end |
60 flash[:notice] = l(:notice_successful_create) | 60 flash[:notice] = l(:notice_successful_create) |
61 redirect_to :action => 'index' | 61 redirect_to roles_path |
62 else | 62 else |
63 @roles = Role.sorted.all | 63 @roles = Role.sorted.all |
64 render :action => 'new' | 64 render :action => 'new' |
65 end | 65 end |
66 end | 66 end |
69 end | 69 end |
70 | 70 |
71 def update | 71 def update |
72 if request.put? and @role.update_attributes(params[:role]) | 72 if request.put? and @role.update_attributes(params[:role]) |
73 flash[:notice] = l(:notice_successful_update) | 73 flash[:notice] = l(:notice_successful_update) |
74 redirect_to :action => 'index' | 74 redirect_to roles_path |
75 else | 75 else |
76 render :action => 'edit' | 76 render :action => 'edit' |
77 end | 77 end |
78 end | 78 end |
79 | 79 |
80 def destroy | 80 def destroy |
81 @role.destroy | 81 @role.destroy |
82 redirect_to :action => 'index' | 82 redirect_to roles_path |
83 rescue | 83 rescue |
84 flash[:error] = l(:error_can_not_remove_role) | 84 flash[:error] = l(:error_can_not_remove_role) |
85 redirect_to :action => 'index' | 85 redirect_to roles_path |
86 end | 86 end |
87 | 87 |
88 def permissions | 88 def permissions |
89 @roles = Role.sorted.all | 89 @roles = Role.sorted.all |
90 @permissions = Redmine::AccessControl.permissions.select { |p| !p.public? } | 90 @permissions = Redmine::AccessControl.permissions.select { |p| !p.public? } |
92 @roles.each do |role| | 92 @roles.each do |role| |
93 role.permissions = params[:permissions][role.id.to_s] | 93 role.permissions = params[:permissions][role.id.to_s] |
94 role.save | 94 role.save |
95 end | 95 end |
96 flash[:notice] = l(:notice_successful_update) | 96 flash[:notice] = l(:notice_successful_update) |
97 redirect_to :action => 'index' | 97 redirect_to roles_path |
98 end | 98 end |
99 end | 99 end |
100 | 100 |
101 private | 101 private |
102 | 102 |