diff options
author | Jean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com> | 2013-07-14 16:57:08 +0200 |
---|---|---|
committer | Jean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com> | 2013-07-14 16:57:08 +0200 |
commit | 06a66c7f9905c355689a0ba63a891249a1511bef (patch) | |
tree | a0c1e793db9ed6052b292db718c01fab6225447a | |
parent | 5d1186ff6488d5b01c07f07613cfd39cb93b9746 (diff) | |
download | sonarqube-06a66c7f9905c355689a0ba63a891249a1511bef.tar.gz sonarqube-06a66c7f9905c355689a0ba63a891249a1511bef.zip |
Updated reference to Java Permission class in Ruby code
4 files changed, 8 insertions, 8 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 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=<key or id> 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=<key or id>][&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 @@ </tr> </thead> <tbody> - <% Java::OrgSonarCoreUser::Permission::allGlobal.keySet.each do |global_permission_key| %> + <% Java::OrgSonarCorePermission::Permission::allGlobal.keySet.each do |global_permission_key| %> <tr class="<%= cycle('even', 'odd', :name => 'global_permission') -%>" > <td valign="top"> <b><%= message('global_permissions.' + global_permission_key) -%></b><br/> 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. |