Prevent custom role from being deleted if it is used in security policies

Why are we doing this work

  • a custom role can be modified or deleted and a security policy could be affected by that

Relevant links

Non-functional requirements

  • Documentation:
  • Feature flag:
  • Performance:
  • Testing:

Implementation plan

  • frontend / backend disable the Delete role button if they are used in a policy
  • frontend / backend show a tooltip with the existing policies and links to them

Similar to the override policy warning icon recently created

Verification steps

  1. Upload a GitLab Ultimate license
  2. Enable the feature security_policy_custom_roles feature flag
  3. Navigate to the admin level or top-level group => Settings => Roles and permissions
  4. Create a custom role
  5. Navigate to a group/project under that => Secure => Policies => New project => Merge request approval policy => Create a policy with the custom role as an approver
  6. Add a member as having that role
  7. Create a merge request and verify the approver appears
Edited by Alexander Turinske