From 10c04b05d30152eab21a2f4a8c89a5edc499c7e4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Vilain Date: Tue, 18 Jun 2013 11:58:22 +0200 Subject: [PATCH] SONAR-4398 Fixed filter update issue when logged in as standard user --- .../WEB-INF/app/controllers/measures_controller.rb | 9 +++++++-- .../WEB-INF/app/views/measures/_edit_form.html.erb | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb index 0d4887ec009..2aea260bac5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb @@ -135,11 +135,16 @@ class MeasuresController < ApplicationController require_parameters :id @filter = MeasureFilter.find(params[:id]) - access_denied unless has_role?(:admin) + access_denied unless @filter.owner?(current_user) || 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 has_role?(:admin) + @filter.user = User.find_by_login(params[:owner]) + end + if @filter.save render :text => @filter.id.to_s, :status => 200 else diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb index 0f146e17353..7465c6f8ec0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb @@ -16,10 +16,12 @@ - + <% if is_admin? %> + + <% end %>