BigW Consortium Gitlab

Commit d035d735 by Lin Jen-Shin

Fix tests and fine tweak permission error message

parent a397a0eb
...@@ -23,16 +23,16 @@ module Ci ...@@ -23,16 +23,16 @@ module Ci
unless allowed_to_trigger_pipeline?(triggering_user) unless allowed_to_trigger_pipeline?(triggering_user)
if can?(triggering_user, :create_pipeline, project) 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 else
return error('Insufficient permissions to create a new pipeline') return error('Insufficient permissions to create a new pipeline')
end end
end end
unless branch? || tag?
return error('Reference not found')
end
unless commit unless commit
return error('Commit not found') return error('Commit not found')
end end
......
...@@ -94,13 +94,15 @@ module Gitlab ...@@ -94,13 +94,15 @@ module Gitlab
def protected_branch_accessible_to?(ref, action:) def protected_branch_accessible_to?(ref, action:)
ProtectedBranch.protected_ref_accessible_to?( ProtectedBranch.protected_ref_accessible_to?(
ref, user, action: action, ref, user,
action: action,
protected_refs: project.protected_branches) protected_refs: project.protected_branches)
end end
def protected_tag_accessible_to?(ref, action:) def protected_tag_accessible_to?(ref, action:)
ProtectedTag.protected_ref_accessible_to?( ProtectedTag.protected_ref_accessible_to?(
ref, user, action: action, ref, user,
action: action,
protected_refs: project.protected_tags) protected_refs: project.protected_tags)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment