diff options
author | Sam Rose <samrose3@gmail.com> | 2017-05-08 10:41:58 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-08 10:41:58 +0300 |
commit | 1ebd9dad8e4a3ade4fa829d1d5ac6cbc9825bf48 (patch) | |
tree | ea175b4ef388f79d8550a424ac5b46a535555664 /lib/gitlab/user_access.rb | |
parent | 1a5e84febeb3f2d63c019981e80c777195c37dd2 (diff) |
Add confirm delete protected branch modal
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r-- | lib/gitlab/user_access.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index e46ff313654..3b922da7ced 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -38,6 +38,16 @@ module Gitlab end end + def can_delete_branch?(ref) + return false unless can_access_git? + + if ProtectedBranch.protected?(project, ref) + user.can?(:delete_protected_branch, project) + else + user.can?(:push_code, project) + end + end + def can_push_to_branch?(ref) return false unless can_access_git? |