Add GraphQL mutation to create a member role
What does this MR do and why?
It adds a mutation for creating a new custom role. We already have a REST API endpoint, but we agreed that we should aim for GraphQL endpoints in general. That's why I added this mutation after creating update
mutation (!131358 (merged))
How to set up and validate locally
Run the following mutation in graphQL explorer (https://gdk.test:3443/-/graphql-explorer)
mutation {
memberRoleCreate(input: {
groupPath: "flightjs"
name: "Role name",
description: "This is a new test role",
readCode: true,
readVulnerability: true,
baseAccessLevel: GUEST
}) {
errors
memberRole {
id
name
description
readVulnerability
readCode
enabledPermissions
baseAccessLevel {
integerValue
stringValue
}
}
}
}
Response
{
"data": {
"memberRoleCreate": {
"errors": [],
"memberRole": {
"id": "gid://gitlab/MemberRole/17",
"name": "Role name",
"description": "This is a new test role",
"readVulnerability": true,
"readCode": true,
"enabledPermissions": [
"READ_CODE",
"READ_VULNERABILITY"
],
"baseAccessLevel": {
"integerValue": 10,
"stringValue": "GUEST"
}
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jarka Košanová