Skip to content

Update admin_protected_branch custom role to allow protected branch deletion in the UI

What does this MR do and why?

Addresses #577761

To-do:

  • Likely need spec testing to validate this.
    • Test UI walkthrough of deleting via the UI?
  • Update documentation of the custom role to indicate the change that was brought through in this milestone

Please refer to my findings in the original issue for full context on this proposed change. To summarise, the current implementation of admin_protected_branch provides access for a custom role user to manage a protected branch (including unprotecting it), but the UI limits being able to delete a protected branch directly based on a different value titled: push_to_delete_protected_branch. Through some initial brief tests, this was all that was required to now permit the custom role to delete a protected branch, and brings this in line with the original issue's vision:

The permission actions for admin_protected_branches includes creating, reading, updating, and deleting protected branches along with properties associated

Limitations

Currently, it seems that you still need to have Developer access as the base permission. I have confirmed through personal tests and via spec testing that a Guest user base role with the custom role doesn't work. It seems that we limit some UI access even if custom roles are available.

References

Screenshots or screen recordings

Before After
image.png image.png

How to set up and validate locally

  1. Create a custom role with admin_protected_branch either at the instance or group level, using Developer access as the baseline.
  2. Assign a user to a project, then assign them the custom role you created.
  3. Create a protected branch in the project
  4. As the logged-in user with the custom role:
    1. Navigate to Code → Branches
      • Confirm there is now an option in the ⋮ more options menu to delete the protected branch directly

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 Ben King

Merge request reports

Loading