Commit c9c715cd authored by Lin Jen-Shin's avatar Lin Jen-Shin

Make permission checks easier to understand

parent a05bc477
...@@ -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)
if branch? || tag?
return error("Insufficient permissions for protected ref '#{ref}'") 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
...@@ -93,7 +93,7 @@ module Ci ...@@ -93,7 +93,7 @@ module Ci
elsif tag? elsif tag?
access.can_create_tag?(ref) access.can_create_tag?(ref)
else else
false true # Allow it for now and we'll reject when we check ref existence
end end
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