Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
iconfalse
titleTable of Contents

Table of Contents
maxLevel1

Add a Global or a Project Permission

DescriptionAdd a global or a project permission

URL

/api/permissions/add

HTTP MethodPOST

Security

Requires System administration persmission Administer System permission for global permissions
Requires Administer permission on project for project permissions 

Available sinceVersion 3.7

...

Use CaseExample Request
Grant user "myuser" the ability to share dashboards

curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/add?permission=dashboard_sharing&user=myuser'

Grant group "mygroup" the ability to share dashboards

curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/add?permission=dashboard_sharing&group=mygroup'

Grant user "myuser" See Source Code permission on project "myProject"

curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/add?permission=codeviewer&user=myuser&component=myProject'

Parameters

Parameter

Description

Required

Default Value

Example Value

permission

Key of the permission to add.

See available permissions below.

Yes

None

shareDashboard

userUser login.Yes if group is not set.Nonemyuser
groupGroup name or "anyone".Yes if user is not set.Nonesonar-administrators
component

Key of the project.

Available since version 4.0.

Yes if a project permission is set.Noneorg.codehaus.sonar

Remove a Global or a Project Permission

DescriptionRemove a global or a project permission

URL

/api/permissions/remove

HTTP MethodPOST

Security

Requires System administration persmissionAdminister System permission for global permissions
Requires Administer permission on project for project permissions

Available sinceVersion 3.7

...

Use CaseExample Request
Remove from user "myuser" the ability to share dashboards

curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/remove?permission=shareDashboard&user=myuser'

Remove from group "mygroup" the ability to share dashboards

curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/remove?permission=shareDashboard&group=mygroup'

Remove from user "myuser" the See Source Code permission on project "myProject"

curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/remove?permission=codeviewer&user=myuser&component=myProject'

Parameters

Parameter

Description

Required

Default Value

Example Value

permission

Key of the permission to add.

See available permissions below.

Yes

None

shareDashboard

userUser login.Yes if group is not set.Nonemyuser
groupGroup name or "anyone".Yes if user is not set.Nonesonar-administrators
component

Key of the project.

Available since version 4.0.

Yes if a project permission is set.Noneorg.codehaus.sonar

Global Permissions

execution

Key

Description

admin

Administer System administration
dryRunScanExecute Preview Analysis
profileadminAdminister Quality profile administrationProfiles
shareDashboardprovisioningDashboard sharingProvision Projects
scanExecute Analysis
dryRunScanLocal (dry run) analysis execution
shareDashboardShare Dashboards and Filters

See Authorization for more details about global permissions.

Project Permissions

Key

Description

user

Browse
adminAdminister
codeviewerSee Source Code
issueadminAdminister Issues

See Authorization for more details about project permissions.