doc/user/custom_roles/_index.md
{{< details >}}
{{< /details >}}
{{< history >}}
custom_ability_read_admin_dashboard.custom_admin_roles. Disabled by default.custom_admin_roles enabled by default.{{< /history >}}
Custom roles allow you to create roles with only the specific custom permissions required by your organization. Each custom role is based on an existing default role. For example, you might create a custom role based on the Guest role, but also include permission to view code in a project repository.
GitLab provides two types of custom roles:
read_code permission does not use a seat.<i class="fa-youtube-play" aria-hidden="true"></i> For a demo of the custom roles feature, see [Demo] Ultimate Guest can view code on private repositories via custom role.
<!-- Video published on 2023-02-13 -->To create a custom member role, you select a default GitLab role and add additional permissions. The base role defines the minimum permissions available to the custom role. You cannot use auditor as a base role.
Custom permissions can allow actions typically restricted to the Maintainer or Owner role. For example, a custom role with permission to manage CI/CD variables also allows management of CI/CD variables added by other Maintainers or Owners.
Custom member roles are available to groups and projects:
Prerequisites:
To create a custom member role:
You can also use the API to create a custom role.
{{< details >}}
{{< /details >}}
To create a custom admin role, you add permissions that allow actions typically limited to administrators. Each custom admin role can have one or more permissions.
Prerequisites:
To create a custom admin role:
You can also use the API to create a custom role.
{{< history >}}
{{< /history >}}
You can edit the name, description, and permissions of a custom role, but you cannot edit the base role. If you need to change the base role, you must create a new custom role.
Prerequisites:
To edit a custom role:
You can also use the API to edit a custom member role or a custom admin role.
The Roles and permissions page lists basic information about all available default and custom roles. This
includes information like the name, description, and number of users assigned each custom role. Each custom role
includes either a Custom member role or Custom admin role badge.
You can also view more detailed information about a custom role including the role ID, base role, and specific permissions.
Prerequisites:
To view details of a custom role:
You cannot delete custom roles that are still assigned to a user. See assign a custom role to a user.
Prerequisites:
To delete a custom role:
You can also use the API to delete a custom member role or a custom admin role.
You can assign or modify roles for members of your groups and projects. You can do this for existing users or when you add a user to a group, project, or instance.
Prerequisites:
To assign a custom member role to an existing user:
You can also use the API to assign or modify custom role assignments.
{{< details >}}
{{< /details >}}
You can assign or modify admin roles to users in your instance. You can do this for existing users or when you add a user to the instance.
Prerequisites:
To assign a custom admin role to an existing user:
You can also use the API to assign or modify custom role assignments.
{{< history >}}
assign_custom_roles_to_group_links_sm. Disabled by default.{{< /history >}}
[!flag] The availability of this feature is controlled by a feature flag. For more information, see the history.
When you invite a group to a group you can assign a custom role to every user in the group.
The assigned role is compared to user roles and permissions in their original group. Generally, users are assigned the role with the smallest access level. However, if users have a custom role in their original group:
The following table provides examples of the maximum role available to users invited to a group:
| Scenario | User with Guest role | User with Guest role + read_code | User with Guest role + read_vulnerability | User with Developer role | User with Developer role + admin_vulnerability |
|---|---|---|---|---|---|
| Invited with Guest role | Guest | Guest | Guest | Guest | Guest |
Invited with Guest role + read_code | Guest | Guest + read_code | Guest + read_vulnerability | Guest + read_code | Guest + read_code |
Invited with Guest role + read_vulnerability | Guest | Guest + read_code | Guest + read_vulnerability | Guest + read_vulnerability | Guest + read_vulnerability |
| Invited with Developer role | Guest | Guest + read_code | Guest + read_vulnerability | Developer | Developer |
Invited with Developer role + admin_vulnerability | Guest | Guest + read_code | Guest + read_vulnerability | Developer | Developer + admin_vulnerability |
You can only assign custom roles when you invite a group to another group. Issue 468329 proposes to assign a custom role when inviting a group to a project.
You can assign custom roles and permissions to the following:
| Object | Version | Issue |
|---|---|---|
| Users | 15.9 | Released |
| Groups | 17.7 | Partially supported. Further support for group assignment in projects is proposed in Issue 468329 |
| Tokens | Not supported | Issue 434354 |
{{< details >}}
{{< /details >}}
You can assign a custom member role to all users in an external LDAP or SAML group, or a custom admin role to users synced from an LDAP group only.
To assign custom roles to LDAP or SAML groups:
If a permission does not exist, you can: