diff options
author | Jean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com> | 2013-07-17 16:07:06 +0200 |
---|---|---|
committer | Jean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com> | 2013-07-17 16:07:06 +0200 |
commit | a9e0eac06dbc4893bc4e2aea9f0ec93afade52a9 (patch) | |
tree | c2b1e0e3b37a19dc8438e78ee548859c85f48b00 | |
parent | ad2c4a165dd517099aabca3c90b0f59fced09280 (diff) | |
download | sonarqube-a9e0eac06dbc4893bc4e2aea9f0ec93afade52a9.tar.gz sonarqube-a9e0eac06dbc4893bc4e2aea9f0ec93afade52a9.zip |
SONAR-4454 Make it possible to apply a permission template to a single project
4 files changed, 17 insertions, 4 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index 29a875ae924..3660170fa62 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -2259,7 +2259,8 @@ projects_role.user.desc=Ability to browse the measures and to create/edit issues projects_role.codeviewer=Code Viewers projects_role.codeviewer.desc=Ability to view the source code of the project. projects_role.bulk_change=Bulk Change -projects_role.apply_template.form.title=Apply permission template +projects_role.apply_template=Apply permission template +projects_role.apply_template_to_xxx=Apply permission template to {0} projects_role.no_projects=There are currently no results to apply the permission template to. @@ -2281,6 +2282,7 @@ permission_template.update_template=Update permission_template.edit_permissions=Edit permissions permission_template.update_permissions=Save permission_template.no_results=No template to display +permission_template.set_default_templates=Set default templates #------------------------------------------------------------------------------ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb index 5fb870f2d37..dd144499d78 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb @@ -78,7 +78,7 @@ class RolesController < ApplicationController # GET /roles/apply_template_form?projects=<projects>&qualifier=<qualifier> def apply_template_form @permission_templates = Internal.permission_templates.selectAllPermissionTemplates().collect {|pt| [pt.name, pt.key]} - render :partial => 'apply_template_form', :locals => {:components => params[:projects], :qualifier => params[:qualifier] || 'TRK'} + render :partial => 'apply_template_form', :locals => {:components => params[:projects], :project_name => params[:project_name], :qualifier => params[:qualifier] || 'TRK'} end # POST /roles/apply_template?criteria diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb index 659ff4d47ef..b7c04c22d06 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb @@ -4,7 +4,11 @@ <% end %> <fieldset> <div class="modal-head"> - <h2><%= message('projects_role.apply_template.form.title', {:params => ''}) -%></h2> + <% if params[:project_name] %> + <h2><%= message('projects_role.apply_template_to_xxx', :params => params[:project_name]) -%></h2> + <% else %> + <h2><%= message('projects_role.apply_template') -%></h2> + <% end %> </div> <div class="modal-body"> <div class="apply-template errors error" style="display:none;"/> @@ -17,7 +21,9 @@ <div class="modal-field"> <%= label_tag 'template_key', 'Permission template:' %> <%= select_tag('template_key', options_for_select(@permission_templates, -1), :style => 'width: 250px;') %> - <span style="float:right" class="note">(<%= "#{components.size} #{message('qualifier.' + qualifier)}(s)" %>)</span><br/> + <% unless params[:project_name] %> + <span style="float:right" class="note">(<%= "#{components.size} #{message('qualifier.' + qualifier)}(s)" %>)</span><br/> + <% end %> </div> <% end %> </div> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb index 5eab3af0fb9..7d744cd3120 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb @@ -44,6 +44,7 @@ <th><%= message('projects_role.admin') -%></th> <th><%= message('projects_role.user') -%></th> <th><%= message('projects_role.codeviewer') -%></th> + <th></th> </tr> </thead> @@ -101,6 +102,10 @@ (<%= link_to message('select groups'), {:action => :edit_groups, :role => 'codeviewer', :resource => project.id}, :id => "selectg-codeviewer-#{u project.kee}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/> </td> + <td align="right"> + <%= link_to message('projects_role.apply_template'), {:action => :apply_template_form, :projects => [project.id], :project_name => project.name, :qualifier => @qualifier}, + :id => "apply-template-modal-#{project.id}", :class => 'open-modal link-action' %> + </td> </tr> <% end %> |