Skip protected branches permission check for fork sync actions
Part of epic &16678
Problem
Introduce `allow_fork_sync` field to database (#517139) adds a new field allow_fork_sync
to protected_branches
table.
We want to skip the permission check when fork sync toggle is enabled for the branch.
Proposal
Use Gitaly context support introduced in !178463 (merged).
Pass gitaly_context: { fork_sync: true }
to user_merge_branch
and user_ff_branch
when a merge action triggered by Projects::Forks::SyncService.
Skip permission check when the allow_fork_sync: true
for the branch
See spike: !176718 (f184977c)
Edited by Vasilii Iakliushin