Skip to content

Draft: Add a GraphQL mutation to update group members role in bulk

Abdul Wadood requested to merge 354749-change-max-role-for-user-management into master

What does this MR do and why?

Add a mutation to change max role of direct members in a group in bulk

Sample mutation and output

Mutation

mutation {
  groupMembersUpdate(input: {
    groupId: "gid://gitlab/Group/264"
    accessLevel: 20
    expiresAt: "2022-06-08 08:00:00"
    groupMemberIds: [
      "gid://gitlab/GroupMember/194",
    ]
  }) {
    groupMembers {
      id
      accessLevel {
        integerValue
        stringValue
      }
    }
  }
}

Output

{
  "data": {
    "groupMembersUpdate": {
      "groupMembers": [
        {
          "id": "gid://gitlab/GroupMember/194",
          "accessLevel": {
            "integerValue": 20,
            "stringValue": "REPORTER"
          }
        }
      ]
    }
  }
}

How to set up and validate locally

  1. Open http://localhost:3000/-/graphql-explorer.
  2. Run the above mutation for multiple users and check that the role of the group members change.

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

Merge request reports