Add policies for branch rule objects
What does this MR do and why?
Part of Branch rules MVC: Add GraphQL endpoint to delet... (#362219 - closed)
Add policies for branch rule objects
We have been delegating to the ProtectedBranchPolicy
when checking
Project::BranchRulePolicy
. This has a few issues that are resolved
with this change.
- The abilities are suffixed with
_protected_branch
e.g.:create_protected_branch
- The
EE::ProtectedBranchPolicy
includes a condition that calls methods on the subject. By delegating we've changed the subject and these methods are undefined on the branch rule. These conditions have been modified to call on the correct object. -
Projects::AllBranchesRule
andProjects::AllProtectedBranchesRule
do not have aprotected_branch
so cannot use these conditions at all. They now have their own policies with the conditions muted.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Edited by Joe Woodward