Using permission templates

As the organization admin in SonarQube Cloud, using permission templates allows you to define permissions granted by default on new projects and various sets of permissions.

This feature is only available in the Team and Enterprise plans. See Subscription plans for more information.

As the organization admin, using permission templates allows you to:

  • Define the permissions granted by default to users, groups, project creators, and individual users on new projects.

  • Apply different sets of permissions to one or several projects at a time.

If you have a Free plan organization, the permissions set to the built-in groups (Members and Owners) on new projects are defined through the default built-in template and cannot be changed. See Built-in group permissions on Free planfor more information.

Introduction to the permission template concept

A permission template defines the project-related permissions granted to groups and members of the organization.

You can define several permission templates in your organization:

  • You define the default template.

  • You can define a template that applies to specific projects according to their key pattern by using a regular expression.

When a new project is created, SonarQube Cloud uses a permission template to grant the default permissions on the project. It retrieves the template according to the following rules:

  • If the project key complies with the project key pattern of a template, then this template is used. If several templates comply, an error is raised.

  • Otherwise, the default template is used.

Creating a new template

  1. Retrieve your organization. See Retrieving your organizations for more details.

  2. Go to Administration > Permission Templates. The Permission Templates page opens with the list of templates.

  3. Select the Create button. The Create Permission Template dialog opens.

  4. Enter the template name and description.

  5. If you want to apply the template to specific new projects according to their key, enter the corresponding regular expression in Project key pattern. The regular expression must specify the complete key (not only a part of the key). For example, to match the project keys abc-def1-<anyString> and abc-def2-<anyString>, use the pattern ^abc-(def1|def2)-.*.

  6. Select the Create button. The dialog closes and the new template is displayed.

  7. Set the permissions by selecting the respective check boxes. See Permissions related to a project for more information about the project permissions.

Setting the default template

  1. Retrieve your organization. See Retrieving your organizations for more details.

  2. Go to Administration > Permission Templates. The Permission Templates page opens with the list of templates.

  3. Select the three-dot menu to the far right of the template you want to change.

  4. In the menu, select Set Default.

Deleting a template

  1. Retrieve your organization. See Retrieving your organizations for more details.

  2. Go to Administration > Permission Templates. The Permission Templates page opens with the list of templates.

  3. Select the three-dot menu to the far right of the template you want to delete.

  4. In the menu, select Delete and confirm.

Changing a template

  1. Retrieve your organization. See Retrieving your organizations for more details.

  2. Go to Administration > Permission Templates. The Permission Templates page opens with the list of templates.

  3. Select the three-dot menu to the far right of the template you want to change.

  4. In the menu:

    • To change the template name, description or patter: select Update Details.

    • To change the template permissions, description or patter: select Edit Permissions.

Applying a permission template to projects

You can apply a permission template to a project, or, with the Enterprise plan, to several projects at a time.

To a single project

  1. Retrieve the project. See Retrieving projects for more details.

  2. In the left sidebar, select Administration > Permissions. The Permissions page opens.

  3. Select the Apply Permission Template button in the top right corner of the page. The Apply Permission Template dialog opens.

  4. Select the template you want to apply and select the Apply button.

To several projects at a time

  1. Retrieve your organization. See Retrieving your organizations for more details.

  2. Go to Administration > Projects management.

  3. Retrieve and select the projects you want to update.

  4. In the tool bar, select Bulk Apply Permission Template. The Bulk Apply Permission Template dialog opens.

  5. Select the template and select Apply.

Last updated

Was this helpful?