Skip to content

Add a GraphQL mutation to update multiple groups members

What does this MR do and why?

This MR is dependent on !103769 (merged) and the merge request dependency has been added to this MR.

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

Summary of changes

MR You are here
Refactor Members::UpdateService to enable updating multiple members in a single call !96745 (merged)
Add a GraphQL mutation for updating multiple group members 👈

Sample mutation

Input

mutation {
  groupMemberBulkUpdate(input: {
    groupId: "gid://gitlab/Group/281"
    accessLevel: MAINTAINER
    expiresAt: "2022-09-09 08:00:00"
    userIds: [
      "gid://gitlab/User/103",
      "gid://gitlab/User/98",
    ]
  }) {
    groupMembers {
      id
      accessLevel {
        integerValue
        stringValue
      }
      expiresAt
    }
    errors
  }
}

Output

{
  "data": {
    "groupMemberBulkUpdate": {
      "groupMembers": [
        {
          "id": "gid://gitlab/GroupMember/218",
          "accessLevel": {
            "integerValue": 40,
            "stringValue": "MAINTAINER"
          },
          "expiresAt": "2022-09-09"
        },
        {
          "id": "gid://gitlab/GroupMember/216",
          "accessLevel": {
            "integerValue": 40,
            "stringValue": "MAINTAINER"
          },
          "expiresAt": "2022-09-09"
        }
      ],
      "errors": []
    }
  }
}

How to set up and validate locally

  1. http://localhost:3000/-/graphql-explorer
  2. Run the above mutation and check the roles of group members.

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)

Edited by Abdul Wadood

Merge request reports

Loading