Skip to content

Use GraphQL to create custom role on Roles and Permissions page

What does this MR do and why?

On the Roles and Permissions page in a group's settings or the admin area, there's a table that shows created custom roles:

Group Roles and Permissions page Admin Area Roles and Permissions page
ksnip_20231207-023221 ksnip_20231207-023824

This MR switches the creation of a custom role to use GraphQL instead of the REST API.

How to set up and validate locally

  1. Set your local gdk instance to SAAS mode by running this in a terminal and (re)starting GDK:
export GITLAB_SIMULATE_SAAS=1
  1. To go Admin Area -> Overview -> Groups.
  2. Click on the Edit button next to a top-level group, change the group's plan to Ultimate, and click on Save changes at the bottom of the page:
ksnip_20231222-111655
  1. Go to the group's page, then go to Settings -> Roles and Permissions.
  2. Click on the Add new role button on the upper right.
  3. Fill out the form, then click on Create new role.
  4. Verify that the role is created using GraphQL.
  5. Verify that the roles table shows the new role.
  6. Try to create a new role again, but this time check only Admin vulnerability.
  7. Verify that an error message is shown saying that Read vulnerability needs to be checked as well.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #435483 (closed)

Edited by Daniel Tian

Merge request reports