Not able to set profile and gates via WebAPI as a "project admin" user

Use Case:
We would like to associate a specific quality profile and a specific quality gate to a AQ project. This is possible via GUI for any user with “project admin permissions”.
Unfortunately, the same user , with “project admin permissions” is not able to do this via WebAPIs. WebAPIs require the users to have “Administer Quality profiles” and “administer Quality gates” permissions.

As SQ maintainer in my organization, I would not like to provide such permissions to all users.
Is there a workaround for this?

  • SonarQube community 6.7.3 and SQ enterprise 7.9.1* what are you trying to achieve

Hi @amitkumar2283,

Could you please specify which web service are you using to associate a quality gate to a project ?
Because I confirm that when using api/qualityprofiles/add_project, a user having only Administer permission on the project is allow to use the ws.

Regards

Hi @julienlancelot
We are using curl -u <token>: -X POST -d language=py -d qualityProfile=eden -d projectKey=<key> https://sonartest.com/api/qualityprofiles/add_project
You are correct. “Project admin permission” is sufficient for setting quality profile.

Unfortunately same is not true for Quality Gates, the API documentation specifies that Administer quality gates permission is required.

The description of the WS api/qualitygates/select is wrong, I’ll fix it because as a Project Administrator you can update the quality gate of the project.