From 2b79a7c204edc49f4635aff7471f384307a1f6d9 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 12 Aug 2011 12:08:33 +0200 Subject: [PATCH] Do not show crappy error page if url /plugins/* has bad parameters --- .../WEB-INF/app/controllers/plugins/configuration_controller.rb | 2 ++ .../webapp/WEB-INF/app/controllers/plugins/home_controller.rb | 1 + .../WEB-INF/app/controllers/plugins/resource_controller.rb | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/configuration_controller.rb index f5ea76a519d..5160ea28c8f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/configuration_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/configuration_controller.rb @@ -25,6 +25,8 @@ class Plugins::ConfigurationController < ApplicationController page_id=params[:page] @page_proxy=java_facade.getPage(page_id) + return redirect_to(home_path) unless @page_proxy + authorized=@page_proxy.getUserRoles().size==0 unless authorized @page_proxy.getUserRoles().each do |role| diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/home_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/home_controller.rb index 59ce20ce328..8f53a48b208 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/home_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/home_controller.rb @@ -25,6 +25,7 @@ class Plugins::HomeController < ApplicationController page_id=params[:page] @page_proxy=java_facade.getPage(page_id) + return redirect_to(home_path) unless @page_proxy authorized=@page_proxy.getUserRoles().size==0 unless authorized @page_proxy.getUserRoles().each do |role| diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb index 5db6657cebd..b8967a29821 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb @@ -31,7 +31,7 @@ class Plugins::ResourceController < ApplicationController page_id=params[:page] @page_proxy=java_facade.getPage(page_id) - return redirect_to home_url if @page_proxy.nil? + return redirect_to(home_path) unless @page_proxy authorized=@page_proxy.getUserRoles().size==0 unless authorized -- 2.39.5