# 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)
# 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)
</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/>
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
# 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.