Fix tests and fine tweak permission error message
This commit is contained in:
parent
a397a0eb1a
commit
d035d73524
2 changed files with 9 additions and 7 deletions
|
@ -23,16 +23,16 @@ module Ci
|
|||
|
||||
unless allowed_to_trigger_pipeline?(triggering_user)
|
||||
if can?(triggering_user, :create_pipeline, project)
|
||||
return error("Insufficient permissions for protected ref '#{ref}'")
|
||||
if branch? || tag?
|
||||
return error("Insufficient permissions for protected ref '#{ref}'")
|
||||
else
|
||||
return error('Reference not found')
|
||||
end
|
||||
else
|
||||
return error('Insufficient permissions to create a new pipeline')
|
||||
end
|
||||
end
|
||||
|
||||
unless branch? || tag?
|
||||
return error('Reference not found')
|
||||
end
|
||||
|
||||
unless commit
|
||||
return error('Commit not found')
|
||||
end
|
||||
|
|
|
@ -94,13 +94,15 @@ module Gitlab
|
|||
|
||||
def protected_branch_accessible_to?(ref, action:)
|
||||
ProtectedBranch.protected_ref_accessible_to?(
|
||||
ref, user, action: action,
|
||||
ref, user,
|
||||
action: action,
|
||||
protected_refs: project.protected_branches)
|
||||
end
|
||||
|
||||
def protected_tag_accessible_to?(ref, action:)
|
||||
ProtectedTag.protected_ref_accessible_to?(
|
||||
ref, user, action: action,
|
||||
ref, user,
|
||||
action: action,
|
||||
protected_refs: project.protected_tags)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue