Skip to content

Add GraphQL mutation to update existing member role

Jarka Košanová requested to merge 417758-edit-member-role-name into master

What does this MR do and why?

It adds a GraphQL mutation that adds the possibility to update name and description of a custom role.

Part of this MR is the creation of shared classes that will be used also for creating a new member role:

  • BaseService will be used by Update and Create services
  • Base mutation for MemberRole update and create mutations

Draft MR for create mutation: !131362 (merged)

How to set up and validate locally

  1. Create a custom role using the API: https://docs.gitlab.com/ee/api/member_roles.html#add-a-member-role-to-a-group
  • curl --request POST --header "Content-Type: application/json" --header "Authorization: Bearer $YOUR_ACCESS_TOKEN" --data '{"base_access_level" : 10, "read_vulnerability" : true}' "https://gdk.test:3443/api/v4/groups/$YOUR_GROUP_ID/member_roles"
  1. Run the mutation
mutation {
  memberRoleUpdate(input: {
    id: "gid://gitlab/MemberRole/2", 
    name: "New name", 
    description: "This is a test role"
  }) {
    errors
    memberRole {
      id
      name
      description
    }
  }
}

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 #417758 (closed)

Edited by Jarka Košanová

Merge request reports