diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-03-25 03:54:56 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-03-26 12:29:52 +0300 |
commit | 973bd4622dec2c326d05a047b93a7b67c9196fb4 (patch) | |
tree | 4e87541b35859580eb32869f358b6b52b4201f8f /app/policies/protected_branch_policy.rb | |
parent | e7061396666074c799780a9fc4090267c3b87e12 (diff) |
ProtectedBranchPolicy used from Controller for destroy/update
Diffstat (limited to 'app/policies/protected_branch_policy.rb')
-rw-r--r-- | app/policies/protected_branch_policy.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/policies/protected_branch_policy.rb b/app/policies/protected_branch_policy.rb index 8d44cff1b42..29dd897194d 100644 --- a/app/policies/protected_branch_policy.rb +++ b/app/policies/protected_branch_policy.rb @@ -6,10 +6,14 @@ class ProtectedBranchPolicy < BasePolicy end rule { can?(:admin_project) }.policy do + enable :create_protected_branch enable :update_protected_branch + enable :destroy_protected_branch end rule { requires_admin_to_unprotect? & ~admin }.policy do + prevent :create_protected_branch prevent :update_protected_branch + prevent :destroy_protected_branch end end |