Add `permissions` argument to memberRoleCreate mutation

What does this MR do and why?

This change introduces a permissions argument to the memberRoleCreate mutation to simplify the frontend usage.

#432566 (closed)

Screenshots or screen recordings

image

How to set up and validate locally

  1. Visit the GraphQL explorer. (e.g. http://gdk.test:3000/-/graphql-explorer)
  2. Create a new role with the permissions argument.
    mutation createRole {
      memberRoleCreate(
        input: {groupPath: "flightjs", name: "example", description: "test role", permissions: ["read_vulnerability"], baseAccessLevel: GUEST}
      ) {
        errors
        memberRole {
          id
          name
          description
          readVulnerability
          enabledPermissions
          baseAccessLevel {
            integerValue
            stringValue
          }
        }
      }
    }
  3. Verify that the response includes the permission in the enabledPermissions field.
    {
      "data": {
        "memberRoleCreate": {
          "errors": [],
          "memberRole": {
            "id": "gid://gitlab/MemberRole/7",
            "name": "example",
            "description": "test role",
            "readVulnerability": true,
            "enabledPermissions": [
              "READ_VULNERABILITY"
            ],
            "baseAccessLevel": {
              "integerValue": 10,
              "stringValue": "GUEST"
            }
          }
        }
      }
    }

MR acceptance checklist

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

Edited by mo khan

Merge request reports

Loading