diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /app/helpers/protected_branches_helper.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'app/helpers/protected_branches_helper.rb')
-rw-r--r-- | app/helpers/protected_branches_helper.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/helpers/protected_branches_helper.rb b/app/helpers/protected_branches_helper.rb new file mode 100644 index 00000000000..07b07bfd33c --- /dev/null +++ b/app/helpers/protected_branches_helper.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module ProtectedBranchesHelper + def protected_branch_can_admin_entity?(protected_branch_entity) + if protected_branch_entity.is_a?(Group) + can?(current_user, :admin_group, protected_branch_entity) + else + can?(current_user, :admin_project, protected_branch_entity) + end + end + + def protected_branch_path_by_entity(protected_branch, protected_branch_entity) + if protected_branch_entity.is_a?(Group) + group_protected_branch_path(protected_branch_entity, protected_branch) + else + project_protected_branch_path(protected_branch_entity, protected_branch) + end + end +end |