Skip to content

Accept `PermissionsEnum` in `Mutation.memberRoleCreate`

mo khan requested to merge mokhax/432566/upcase-permissions into master

What does this MR do and why?

This change updates the Mutation.memberRoleCreate to accept an array of Types::MemberRoles::PermissionsEnum instead of an array of String. This ensures that only valid permissions can be provided as arguments to the mutation instead of arbitrary string values.

Related to:

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
        }
      }
    }
  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"
            ]
          }
        }
      }
    }

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