Give a new group permission to existing projects


I have a number of projects with existing permissions that I do not wish to remove. If a create a new group and want to give that group certain permissions to existing projects, how do I do not without wiping existing permissions (which is what happens if I (re)apply a permission template)

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Enterprise Edition, Version 8.9.2 (build 46101)
  • what are you trying to achieve
    Let administrators of portfolios add projects without giving them browsing rights to those projects
  • what have you tried so far to achieve this
    Editing project permissions and portfolio permissions

Hey there.

I’m a little confused by your post.

For this, you would browse the individual project’s Project Settings > Permissions and add the group. You could also do this programmatically using the Web API (documentation linked in the footer of your instance).

Hi Colin!

Absolutely, I’m aware of how to do that on individual projects. But I have close to 1000 projects and I want to add a new group that should have certain permissions (Browse in this instance) to ALL existing projects. I’m not going to go through all thousand of those projects to do that. :slight_smile:

I saw the POST api/permissions/add_group, is that the best call to use to add the same permissions for the same group in multiple projects?

You would need to iterate through the projects (probably calling GET api/projects/search) and call POST api/permissions/add_group for each project.

To follow up we ended up running a ps-script to do what @Colin suggested.