]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4453 Fixed issue with single view permissions update
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Wed, 24 Jul 2013 16:49:54 +0000 (18:49 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Wed, 24 Jul 2013 16:49:54 +0000 (18:49 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb

index 0ccae0673126bfe1c1b5877dfbc586a87ac3dcfb..b0466bce768f4a8e9f2ce8ae94c078d9a3ab0e36 100644 (file)
@@ -85,6 +85,7 @@ class RolesController < ApplicationController
     @keys = params[:keys]
     @qualifiers = params[:qualifiers] || 'TRK'
     @results_count = params[:results_count].to_i || 0
+    @components = params[:components]
 
     render :partial => 'apply_template_form'
   end
@@ -94,10 +95,12 @@ class RolesController < ApplicationController
     verify_post_request
     require_parameters :template_key
 
-    params['pageSize'] = -1
-    components = Internal.component_api.find(params).components().to_a
+    if params['components'].blank?
+      params['pageSize'] = -1
+      components = Internal.component_api.find(params).components().to_a
+      params['components'] = components.collect{|component| component.getId()}.join(',')
+    end
 
-    params['components'] = components.collect{|component| component.getId()}.join(',')
     Internal.permissions.applyPermissionTemplate(params)
 
     redirect_to :action => 'projects'
index 5062a63e056ba3f25283fc03ca49a582d7826ac0..f699b4698085b12f04ac92635d88a9b574f5b44c 100644 (file)
@@ -3,6 +3,7 @@
     <input type="hidden" name="names" id="apply-template-names" value="<%= @names %>"/>
     <input type="hidden" name="keys" id="apply-template-keys" value="<%= @keys %>"/>
     <input type="hidden" name="qualifiers" id="apply-template-qualifiers" value="<%= @qualifiers %>"/>
+    <input type="hidden" name="components" id="apply-template-components" value="<%= @components %>"/>
   <% end %>
   <fieldset>
     <div class="modal-head">
index 66d1183a69b8e935247f2e383d8375bc0fcbfe2d..70b37e1e645674b3bfdf7372399e3c5f6343c496 100644 (file)
@@ -83,7 +83,8 @@
         </td>
       <% end %>
       <td align="right">
-        <%= link_to message('projects_role.apply_template'), {:action => :apply_template_form, :names => project.name, :results_count => 1},
+        <%= link_to message('projects_role.apply_template'), {:action => :apply_template_form, :components => [project.id], :names => project.name,
+                                                              :results_count => 1, :qualifiers => @components_qualifiers},
                     :id => "apply-template-#{u project.kee}", :class => 'open-modal link-action' %>
       </td>
     </tr>