Table of Contents |
The way authorization is implemented in SonarQube is pretty standard. It is possible to create as many users and groups of users as required in the system. The users can then be attached (or not) to (multiple) groups. Groups and / or users are then given (multiple) permissions. The permissions grant access to projects, services and functionalities.
To administer groups and users, choose Administration > Security, and use the sub-menu items.
Multiple integrations that allow the delegation of authentication are available (see Plugin Library and Other Plugins), but you can manually create and edit users at Settings > Security > Users. For manually-created users, login and password can be set at creation. Manually-created users can edit their passwords.
During both user creation and edit, you can set an account's screen name, email address. User login and email address will be implicitly recognized by the Issue Assignment feature as SCM accounts if applicable, but you can set additional SCM accounts explicitly.
A group is a set of users.
To create a new group, go to Administration > Security > Groups > Add new group.
To edit the membership of a group, click the icon next to the membership total.
Two groups have a special meaning:
To set global permissions, log in as a System administrator and go to Administration > Security > Global Permissions.
Project permissions are available from the project-level Administration menu: Administration > Permissions. You can also access the project permission editing interface from Administration > Projects > Management > Actions (selected on a specific project) > Edit Permissions.
Five different permissions can be set on project-level resources (projects, views, developers):
Note that permissions are not cumulative. For instance, if you want to be able to administer the project, you also have to be granted the Browse permission to be able to access the project.
You can either manually grant permissions for each project to some users and groups or apply permission templates to projects.
SonarQube ships with a default permissions template, which automatically grants specific project permissions to certain groups when a project (or developer, or view) is created. It is possible to edit this template, to create additional templates, and to have a template apply only to a subset of new projects.
This is done through permission templates. Go to Administration > Security > Permission Templates.
To create a new template, use the "Create" button on Administration > Security > Permission Templates. It is possible to provide a Project key pattern. By default, every new project matching this key pattern will have the permissions described by the template.
Templates are empty immediately after creation. Clicking on the template name will take you to its permission editing interface.
Project Creators is a special group that appears only in the project template permission editing interface. Any permissions assigned to this group will at the time of project creation be granted to the single user account used to create the project. This is only useful for users who are granted the Global-level Project Creation permission. This allows SonarQube administrators to let a group of users create and administer projects autonomously.
While project templates can be applied after project creation, applying a template that includes "Project Creators" permissions to an existing project will not grant the relevant permissions to the project's original creator.
To apply permission templates to projects to to Projects > Management. You can either apply a template to a specific project using the project-specific Actions > Apply Permission Template option or use the Bulk Apply Permission Template to apply a template to all selected projects.
Note that there is no relation between a project and a permission template, meaning that:
To recreate a System administrator:
INSERT INTO user_roles(user_id, role) VALUES ((select id from users where login='mylogin'), 'admin'); |