From 547d2b90da8be114a7c0c88dd5a1fde78af85cf5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Vilain Date: Tue, 18 Jun 2013 10:01:41 +0200 Subject: [PATCH] SONAR-4398 Added support for measure filter ownership changes by admin --- .../webapp/WEB-INF/app/controllers/measures_controller.rb | 3 ++- .../webapp/WEB-INF/app/views/measures/_edit_form.html.erb | 4 ++++ .../main/webapp/WEB-INF/app/views/measures/manage.html.erb | 2 +- 3 files changed, 7 insertions(+), 2 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 4b3d1c05005..0d4887ec009 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,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 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 ddce1fa28bc..0f146e17353 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,6 +16,10 @@ +