Guard Branch Rule Editing with permissions

So far, all editing options added to Branch Rule details page are hidden behind the edit_branch_rules feature flag, but they are not guarded by permissions.

Since we are combining a couple of settings on one page, it's essential that we guard each editing option with permissions present in the currently available settings.

UI element to guard code implementation already existing permission

Screenshot_2024-05-28_at_15.39.24Delete rule

/branch_rules/components/view/index.vue#L279

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/projects/settings/repository/\_protected_branches.html.haml?ref_type=heads#L1

Screenshot_2024-05-28_at_15.39.31Rule target

/branch_rules/components/view/index.vue#L300

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/projects/settings/repository/\_protected_branches.html.haml?ref_type=heads#L1

Screenshot_2024-05-28_at_15.39.41Allowed to merge

/branch_rules/components/view/index.vue#L349

/branch_rules/components/view/protection.vue#L51

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/projects/settings/repository/\\\_protected_branches.html.haml?ref_type=heads#L1

guard added in !165192 (merged)

Screenshot_2024-05-28_at_15.39.48Allowed to push and merge

/branch_rules/components/view/index.vue#L349

/branch_rules/components/view/protection.vue#L51

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/projects/settings/repository/\_protected_branches.html.haml?ref_type=heads#L1

guard added in !165192 (merged)

Screenshot_2024-05-28_at_15.39.57Allow force push and Requires code owner approval

!153281 (68bc7cc7)

_protected_branch.html.haml#L2

Code owner approval required:

https://gitlab.com/gitlab-org/gitlab/-/blob/71d42c048c56ec6a4962b8e94543ac6faa5e1472/ee/app/views/protected_branches/ee/\\\\\\\_code_owner_approval_table_head.html.haml#L1

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/projects/settings/repository/\\\_protected_branches.html.haml?ref_type=heads#L1

guard added in !165192 (merged)

Screenshot_2024-05-28_at_15.44.29Merge request approvals

/branch_rules/components/view/index.vue#L406

approval_rules_app.vue#L103

projects_helper.rb#L62

Screenshot_2024-05-28_at_15.44.38Status checks

/branch_rules/components/view/index.vue#L349

/branch_rules/components/view/protection.vue#L51

no permissions in place, we only make sure this licensed feature is available
Edited by Paulina Sedlak-Jakubowska