What kind of rights are needed to set tag item

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

We are runninf SonarQube version 10.2.1

  • how is SonarQube deployed: zip, Docker, Helm

Helm. Deployed in Openshift

  • what are you trying to achieve

Trying to set a tag label on projects with /api/project_tags/set

  • what have you tried so far to achieve this

I have set the rights for the admin user on the permission template for the corresponding project.
The project gets his rights through the permission template.
The rights I gave the admin user is: Browse and Administrator.
But stil I get an Insufficient privileges error when submitting the api call to the project.
What am I missing?

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

checked the api docs for 9.9.4 LTS and also latest
https://next.sonarqube.com/sonarqube/web_api/api/project_tags/set

Description has

Set tags on a project.
Requires the following permission: 'Administer' rights on the specified project

So Administer and Browse are sufficient. Did you check that you’re using the right token ?

Gilbert

Hi Gilbert,

I found the info mentioned.
I placed the user and admin rights on the permission template where the project referse to.

Does the adjustment in the permission template have no effect on existing projects?
And if not, how do I set the correct rights as admin for a project afterwards with an API call! I can’t find an API call that refers to this.

And is there a way to see what permission template a project is refered to?

Regards
Bert

Hi,

when changing an existing permission template you need to reapply it, that doesn’t happen automatically.

Gilbert

Thanks.
I wil try it.

Bert

Stil it doesn’t seem to work.
I placed the admin group permissions on the permission template and gave it an update_template, but stil the admin account gets an Insufficient privileges when I want to set a tag for a project which is related to this template.

Do I have to set the permissions on the projects it self?

Bert

How did you reapply the permission template ?
When i changed a permission template, i.e. configured with regex for project key com\.foo\.bar.+,
i open uber admin / project management, search for com.foo.bar and choose bulk apply for this permission template.

After that you may check for a single project via project settings if the permissions are set correctly.

Hello Gilbert,

I reapply the rights on the permission templates with an api call.
-X POST https://servername/api/permissions/update_template?id=${Template_ID}

But that has no effect on the present projects

Bert

Hi Bert,

yes, POST api/permissions/update_template only updates the permission template settings,
but doesn’t reapply it.

Either do manually via webui and bulk operation or use

POST api/permissions/bulk_apply_template
POST api/permissions/apply_template

but this api calls need Administer System permission.

Gilbert

Hi Gilbert,

I saw the diffrence
Thanks for your repy.
I wil change the api call.
I saw in the api description that you have to provide allso the projectID or projectName
So it must be a combination.

Bert

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.