aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-11-06 18:43:55 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-11-06 18:44:07 +0100
commit8162e11b955940fbc620b78ff1551eccfc7005b2 (patch)
treef9d0cfa4beb4a194d65453c21a45665dd7a905af /sonar-server
parentbadee2ec9a773c5444baa15ca386a85461a4b5b1 (diff)
downloadsonarqube-8162e11b955940fbc620b78ff1551eccfc7005b2.tar.gz
sonarqube-8162e11b955940fbc620b78ff1551eccfc7005b2.zip
SONAR-3895 allow to exclude plugins during dry run mode
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/batch_bootstrap_controller.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/batch_bootstrap_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/batch_bootstrap_controller.rb
index 9ba5f005c2c..cf89bddff6b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/batch_bootstrap_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/batch_bootstrap_controller.rb
@@ -34,17 +34,18 @@ class BatchBootstrapController < ApplicationController
def properties
require_parameters :project
- json_properties=Property.find(:all, :conditions => ['user_id is null and resource_id is null']).map{|property| to_json_property(property)}
+ json_properties=Property.find(:all, :conditions => ['user_id is null and resource_id is null']).map { |property| to_json_property(property) }
root_project = load_project()
if root_project
Project.find(:all, :select => 'id,kee', :conditions => ['enabled=? and (root_id=? or id=?)', true, root_project.id, root_project.id]).each do |project|
- json_properties.concat(Property.find(:all, :conditions => ['user_id is null and resource_id=?', project.id]).map{|property| to_json_property(property, project.kee)})
+ json_properties.concat(Property.find(:all, :conditions => ['user_id is null and resource_id=?', project.id]).map { |property| to_json_property(property, project.kee) })
end
end
+ has_user_role=has_role?(:user, root_project)
has_admin_role=has_role?(:admin, root_project)
- json_properties=json_properties.select{|prop| allowed?(prop[:k], has_admin_role)}
+ json_properties=json_properties.select { |prop| allowed?(prop[:k], has_user_role, has_admin_role) }
render :json => JSON(json_properties)
end
@@ -63,7 +64,11 @@ class BatchBootstrapController < ApplicationController
hash
end
- def allowed?(property_key, has_admin_role)
- !property_key.end_with?('.secured') || has_admin_role
+ def allowed?(property_key, has_user_role, has_admin_role)
+ if property_key.end_with?('.secured')
+ property_key.include?('.license') ? has_user_role : has_admin_role
+ else
+ true
+ end
end
end \ No newline at end of file