Skip to content

Add GraphQL support for removing namespace bans

Alex Buijs requested to merge unban-from-namespace-api into master

What does this MR do and why?

This MR adds a new mutation for removing namespace bans.

Issue: https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/43

Expected responses:

  • User doesn't have permissions: 200 OK, but errors includes 'The resource that you are attempting to access does not exist or you don't have permission to perform this action'
  • Failure to remove the namespace ban: 200 OK, but errors includes message related to what might have gone wrong
Sample mutation info for namespaceBanDestroy

Sample Mutation:

mutation destroy($input: NamespaceBanDestroyInput!) {
  namespaceBanDestroy(input: $input) {
    namespaceBan {
      id
      user {
        id
      }
      namespace {
        id
      }
    }
    errors
  }
}

Sample Input:

{
  "input": {
    "id": "gid://gitlab/Namespaces::NamespaceBan/1"
  }
}

Sample Response:

{
  "data": {
    "namespaceBanDestroy": {
      "namespaceBan": {
        "id": "gid://gitlab/Namespaces::NamespaceBan/1",
        "user": {
          "id": "gid://gitlab/User/22"
        },
        "namespace": {
          "id": "gid://gitlab/Group/73"
        }
      },
      "errors": []
    }
  }
}

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alex Buijs

Merge request reports

Loading