From: Jean-Baptiste Vilain Date: Sun, 14 Jul 2013 14:57:08 +0000 (+0200) Subject: Updated reference to Java Permission class in Ruby code X-Git-Tag: 3.7~130 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=06a66c7f9905c355689a0ba63a891249a1511bef;p=sonarqube.git Updated reference to Java Permission class in Ruby code --- 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 d5bbe8aa0ae..f378a0a56ec 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 @@ -26,7 +26,7 @@ class BatchBootstrapController < Api::ApiController # GET /batch_bootstrap/db?project= def db - has_dryrun_role = has_role?(Java::OrgSonarCoreUser::Permission::DRY_RUN_EXECUTION) + has_dryrun_role = has_role?(Java::OrgSonarCorePermission::Permission::DRY_RUN_EXECUTION) return render_unauthorized("You're not authorized to execute a dry run analysis. Please contact your SonarQube administrator.") if !has_dryrun_role project = load_project() return render_unauthorized("You're not authorized to access to project '" + project.name + "', please contact your SonarQube administrator") if project && !has_role?(:user, project) @@ -38,8 +38,8 @@ class BatchBootstrapController < Api::ApiController # GET /batch_bootstrap/properties?[project=][&dryRun=true|false] def properties dryRun = params[:dryRun].present? && params[:dryRun] == "true" - has_dryrun_role = has_role?(Java::OrgSonarCoreUser::Permission::DRY_RUN_EXECUTION) - has_scan_role = has_role?(Java::OrgSonarCoreUser::Permission::SCAN_EXECUTION) + has_dryrun_role = has_role?(Java::OrgSonarCorePermission::Permission::DRY_RUN_EXECUTION) + has_scan_role = has_role?(Java::OrgSonarCorePermission::Permission::SCAN_EXECUTION) return render_unauthorized("You're not authorized to execute any SonarQube analysis. Please contact your SonarQube administrator.") if (!has_dryrun_role && !has_scan_role) return render_unauthorized("You're only authorized to execute a local (dry run) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator.") if (!dryRun && !has_scan_role) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb index b21cb27ef4d..ff6e336ee74 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb @@ -9,7 +9,7 @@ - <% Java::OrgSonarCoreUser::Permission::allGlobal.keySet.each do |global_permission_key| %> + <% Java::OrgSonarCorePermission::Permission::allGlobal.keySet.each do |global_permission_key| %> <%= message('global_permissions.' + global_permission_key) -%>
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/414_add_scan_and_dry_run_permissions.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/414_add_scan_and_dry_run_permissions.rb index a11a15f72a3..5ad9b2fb3d4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/414_add_scan_and_dry_run_permissions.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/414_add_scan_and_dry_run_permissions.rb @@ -34,11 +34,11 @@ class AddScanAndDryRunPermissions < ActiveRecord::Migration def self.up # -- Role scan -- # Anyone - GroupRole.create(:group_id => nil, :role => Java::OrgSonarCoreUser::Permission::SCAN_EXECUTION.key, :resource_id => nil) + GroupRole.create(:group_id => nil, :role => Java::OrgSonarCorePermission::Permission::SCAN_EXECUTION.key, :resource_id => nil) # -- Role dryRunScan -- # Anyone - GroupRole.create(:group_id => nil, :role => Java::OrgSonarCoreUser::Permission::DRY_RUN_EXECUTION.key, :resource_id => nil) + GroupRole.create(:group_id => nil, :role => Java::OrgSonarCorePermission::Permission::DRY_RUN_EXECUTION.key, :resource_id => nil) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/lib/need_authorization.rb b/sonar-server/src/main/webapp/WEB-INF/lib/need_authorization.rb index 78ce1114ffd..95161fbf12e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/lib/need_authorization.rb +++ b/sonar-server/src/main/webapp/WEB-INF/lib/need_authorization.rb @@ -57,10 +57,10 @@ module NeedAuthorization # has_role?(:admin, [30,45,7]) checks if the user is administrator of the projects 30, 40 and 7. It returns an array of 3 booleans. # def has_role?(role, objects=nil) - role = role.key if role.java_kind_of?(Java::OrgSonarCoreUser::Permission) + role = role.key if role.java_kind_of?(Java::OrgSonarCorePermission::Permission) role = role.to_s if objects.nil? - if Java::OrgSonarCoreUser::Permission::allGlobal.keySet.include?(role) + if Java::OrgSonarCorePermission::Permission::allGlobal.keySet.include?(role) AuthorizerFactory.authorizer.has_role?(self, role.to_sym) else # There's no concept of global users or global codeviewers.