Add new endpoint to list permissions based on access level
The UI hardcodes the custom permissions available for a given base access level (see https://gitlab.com/gitlab-org/gitlab/-/blob/3f8bbe588b3d2dd53f685abff17de44d38adda5b/ee/app/assets/javascripts/roles_and_permissions/constants.js#L10-26). Currently, there are 3 custom permissions, read_code
, read_vulnerability
and admin_vulnerability
, for the Guest
base access level. However, more custom permissions are planned to be added in the future.
To construct the UI programmatically, we need a new endpoint that returns a list of permissions, value, name (internationalised) and help/description, classified by base access level:
{
10: [
{value: 'read_code', name: 'Read only', help: 'Allows read-only access to the source code.'},
{value: 'admin_vulnerability', name: 'Admin vulnerability', help: 'Allows admin access to the vulnerability reports. 'Read vulnerability' must be selected in order to take effect.'},
...
],
20: [
...
],
...
}
Edited by Eduardo Sanz García