Allow synchronization of fork's protected branch

Problem to solve

When a fork's branch is protected and, for example, No one can push into it, a user may still want to Sync the branch via UI.

Related issue: Fetch new upstream contents when fork is behind (#330243 - closed)

Proposal

We could introduce an additional option like allow-force-push, but let's discuss the options.

Proposal (from @vyaklushin)

  1. Extend protected_branches table with allow_fork_sync boolean field (default state: off) (backend-weight1)

  2. Introduce a fully functional Allow fork sync toggle on Branch rules page (backend-weight2)

  3. Skip protected branches permission check for fork sync actions when Allow fork sync toggle is on (backend-weight3)

See the spike merge request that has a similar implementation: !176718 (closed)

Edited by Vasilii Iakliushin