Add a mutation to destroy LDAP admin role link records

What does this MR do and why?

Adds a mutation to destroy Authz::LdapAdminRoleLink records

References

Implements [BE] Add graphQL mutation to delete LDAP group ... (#524884 - closed).

Screenshots or screen recordings

Click to expand

Screenshot_2025-04-10_at_3.53.49_PM

How to set up and validate locally

  1. Enable relevant feature flags and seed some data:

    > Feature.enable(:custom_admin_roles)
    
    # Create an Authz::LdapAdminRoleLink. Take note of its global id
    > user_member_role = FactoryBot.create(:admin_member_role)
    > link = FactoryBot.create(:ldap_admin_role_link, member_role: user_member_role.member_role)
    > GitlabSchema.id_from_object(_)
    => #<GlobalID:0x0000000325e57310 @uri=#<URI::GID gid://gitlab/Authz::LdapAdminRoleLink/2>>
  2. Log-in as admin and navigate to /-/graphql-explorer and run a query similar to the following (change the id):

    mutation {
      ldapAdminRoleLinkDestroy(input: {
        id: "gid://gitlab/Authz::LdapAdminRoleLink/2"
      }) {
        errors
        ldapAdminRoleLink {
          id
        }
      }
    }
  3. Verify that the record has been deleted

    > Authz::LdapAdminRoleLink.find(2)
    ActiveRecord::RecordNotFound: Couldn't find Authz::LdapAdminRoleLink with 'id'=2

MR acceptance checklist

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

Edited by Eugie Limpin

Merge request reports

Loading