Skip to content

Add a GraphQL mutation for updating `OrganizationUser`

Abdul Wadood requested to merge 478031-update-org-user-mutation into master

What does this MR do and why?

This change introduces a new GraphQL mutation for updating OrganizationUser. The mutation is restricted for use by organization owners only. The access level can be set to either OWNER or DEFAULT. To prevent organizations from being left without an owner, the role of the last owner cannot be changed.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Go to https://gdk.test:3000/-/graphql-explorer.
  2. Grab an organization user ID from the rails console: Organizations::OrganizationUser.last.
  3. Run the following mutation. You can change the access level to DEFAULT or OWNER:
mutation {
  organizationUserUpdate(
    input: {id: "gid://gitlab/Organizations::OrganizationUser/5", accessLevel: OWNER}
  ) {
    clientMutationId
    organizationUser {
      id
      accessLevel {
        integerValue
        stringValue
      }
    }
  }
}

Related to #478031 (closed)

Merge request reports

Loading