diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-07-20 01:31:20 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-07-20 01:31:20 +0800 |
commit | c9c715cd5510456d83da5272f28b7ce7f248c77f (patch) | |
tree | aa0e7b9185903e2b54b9ecd340477c432ca75753 /app/services/ci/create_pipeline_service.rb | |
parent | a05bc477b99500fa919295e1086f7a8de903e3c4 (diff) | |
download | gitlab-ce-c9c715cd5510456d83da5272f28b7ce7f248c77f.tar.gz |
Make permission checks easier to understand
Diffstat (limited to 'app/services/ci/create_pipeline_service.rb')
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 700ac42d56e..5da70ba87e9 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -23,16 +23,16 @@ module Ci unless allowed_to_trigger_pipeline?(triggering_user) if can?(triggering_user, :create_pipeline, project) - if branch? || tag? - return error("Insufficient permissions for protected ref '#{ref}'") - else - return error('Reference not found') - end + return error("Insufficient permissions for protected ref '#{ref}'") 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 @@ -93,7 +93,7 @@ module Ci elsif tag? access.can_create_tag?(ref) else - false + true # Allow it for now and we'll reject when we check ref existence end end |