Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Rose <samrose3@gmail.com>2017-05-08 10:41:58 +0300
committerPhil Hughes <me@iamphill.com>2017-05-08 10:41:58 +0300
commit1ebd9dad8e4a3ade4fa829d1d5ac6cbc9825bf48 (patch)
treeea175b4ef388f79d8550a424ac5b46a535555664 /lib/gitlab/user_access.rb
parent1a5e84febeb3f2d63c019981e80c777195c37dd2 (diff)
Add confirm delete protected branch modal
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r--lib/gitlab/user_access.rb10
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?