Fixed UserAccess#can_create_tag? after create_access_levels rename

This commit is contained in:
James Edwards-Jones 2017-04-04 03:50:15 +01:00
parent 07d7d8e659
commit d85471ac1a
2 changed files with 3 additions and 3 deletions

View file

@ -8,7 +8,7 @@ module ProtectedRef
delegate :matching, :matches?, :wildcard?, to: :ref_matcher delegate :matching, :matches?, :wildcard?, to: :ref_matcher
def self.protected_ref_accessible_to?(ref, user, action: :push) def self.protected_ref_accessible_to?(ref, user, action:)
access_levels_for_ref(ref, action: action).any? do |access_level| access_levels_for_ref(ref, action: action).any? do |access_level|
access_level.check_access(user) access_level.check_access(user)
end end
@ -20,7 +20,7 @@ module ProtectedRef
end end
end end
def self.access_levels_for_ref(ref, action: :push) def self.access_levels_for_ref(ref, action:)
self.matching(ref).map(&:"#{action}_access_levels").flatten self.matching(ref).map(&:"#{action}_access_levels").flatten
end end

View file

@ -32,7 +32,7 @@ module Gitlab
return false unless can_access_git? return false unless can_access_git?
if ProtectedTag.protected?(project, ref) if ProtectedTag.protected?(project, ref)
project.protected_tags.protected_ref_accessible_to?(ref, user) project.protected_tags.protected_ref_accessible_to?(ref, user, action: :create)
else else
user.can?(:push_code, project) user.can?(:push_code, project)
end end