Group-level protected branch - policy and services
requested to merge gitlab-jh/jh-team/gitlab:feature/group-level-protected-branch-backend-1 into master
What does this MR do and why?
Related to #372816 (closed), solved these points:
- Update
ProtectedBranchPolicy
to handle both projects as well as groups.- When the user can
maintainer_access
the group, then he can manageprotected_branch
(This is following the policy of the group-level push rules) - Remove the
group { nil }
in the protected branch factory, now we can create the group-level protected branch:# In the specs create(:protected_branch, group: group)
- When the user can
- Update services of protected branches to handle both projects as well as groups.
- Add a feature flag
group_protected_branches
. - Add a premium license
group_protected_branches
. - Update the services about protected branches to support group-level.
- Add a feature flag
I split other points to other MRs to reduce the size of the MR, other MRs will be coming soon.
How to set up and validate locally
- Enable the invite modal
Feature.enable(:group_protected_branches)
- Running the these tests to validate the features:
rspec spec/models/group_spec.rb rspec ee/spec/policies/protected_branch_policy_spec.rb rspec spec/services/protected_branches/ rspec ee/spec/services/ee/protected_branches/
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
/cc EM @daveliu
Edited by Song Huang