summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-04-07 15:43:28 +0000
committerDouwe Maan <douwe@gitlab.com>2017-04-07 15:43:28 +0000
commit46aadc5c16150446840a26ea7199380830369326 (patch)
treefd41b11d20b3c6589b01d4500ad234d3582b5379 /lib/api
parent2d246df57dd8e7da8c2743fba38d31992bc7a3fc (diff)
parent6f15e89a6b83dcfef897dda414325b85090e2c40 (diff)
downloadgitlab-ce-46aadc5c16150446840a26ea7199380830369326.tar.gz
Merge branch '18471-restrict-tag-pushes-protected-tags' into 'master'
Protected Tags Closes #18471 See merge request !10356
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 00d44821e3f..45625e00f7d 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -184,19 +184,15 @@ module API
end
expose :protected do |repo_branch, options|
- options[:project].protected_branch?(repo_branch.name)
+ ProtectedBranch.protected?(options[:project], repo_branch.name)
end
expose :developers_can_push do |repo_branch, options|
- project = options[:project]
- access_levels = project.protected_branches.matching(repo_branch.name).map(&:push_access_levels).flatten
- access_levels.any? { |access_level| access_level.access_level == Gitlab::Access::DEVELOPER }
+ options[:project].protected_branches.developers_can?(:push, repo_branch.name)
end
expose :developers_can_merge do |repo_branch, options|
- project = options[:project]
- access_levels = project.protected_branches.matching(repo_branch.name).map(&:merge_access_levels).flatten
- access_levels.any? { |access_level| access_level.access_level == Gitlab::Access::DEVELOPER }
+ options[:project].protected_branches.developers_can?(:merge, repo_branch.name)
end
end