]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4398 Added support for measure filter ownership changes by admin
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Tue, 18 Jun 2013 08:01:41 +0000 (10:01 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Tue, 18 Jun 2013 08:01:41 +0000 (10:01 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb

index 4b3d1c050052b04d0fbfb7ab0b2546d42f148015..0d4887ec00989f74120f7cde9aa3fc8bf697b1a5 100644 (file)
@@ -135,10 +135,11 @@ class MeasuresController < ApplicationController
     require_parameters :id
 
     @filter = MeasureFilter.find(params[:id])
-    access_denied unless @filter.owner?(current_user)
+    access_denied unless has_role?(:admin)
     @filter.name=params[:name]
     @filter.description=params[:description]
     @filter.shared=(params[:shared]=='true')
+    @filter.user = User.find_by_login(params[:owner])
     if @filter.save
       render :text => @filter.id.to_s, :status => 200
     else
index ddce1fa28bc6e5bdc0cbf5706154afcf6bc82ccf..0f146e17353ac254188c2d89c8df66c9b8f02d3e 100644 (file)
         <label for="description"><%= h message('description') -%></label>
         <input id="description" name="description" type="text" size="50" maxlength="4000" value="<%= h @filter.description -%>"/>
       </div>
+      <div class="modal-field">
+        <label for="owner"><%= h message('owner') -%></label>
+        <%= user_select_tag('owner', :html_id => 'select-filter-owner', :selected_user => @filter.user) -%>
+      </div>
       <div class="modal-field">
         <label for="shared"><%= h message('measure_filter.shared_with_all_users') -%></label>
         <input id="shared" name="shared" type="checkbox" value="true" <%= 'checked' if @filter.shared -%>/>
index 1de3960a5f7414eb2a84bb7e8238984485c3e3b6..3a3aa646d174c414a7bae367f127ab2e3d2e95ad 100644 (file)
               </td>
               <td class="thin nowrap right">
                 <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a>
-                <% if filter.system? && has_role?(:admin) %>
+                <% if has_role?(:admin) %>
                   &nbsp;
                   <a id="edit_system_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a>
                   &nbsp;