diff options
author | Maxim Rydkin <maks.rydkin@gmail.com> | 2017-09-06 19:35:28 +0300 |
---|---|---|
committer | Maxim Rydkin <maks.rydkin@gmail.com> | 2017-09-07 13:16:15 +0300 |
commit | 9151ca7bb37b7c0f36b0a1c6ba4ba1c37fd3660b (patch) | |
tree | 72254e78caca3a9a1eb3a67ac81d3b19ffd1d12f /app/services | |
parent | 2a54cbcab83612991c0c61ffed1b2472e4e49047 (diff) | |
download | gitlab-ce-9151ca7bb37b7c0f36b0a1c6ba4ba1c37fd3660b.tar.gz |
refactor Ci::CreatePipelineService#allowed_to_create?
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 6f1f3c4d2e8..d20de9b16a4 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -96,16 +96,16 @@ module Ci end def allowed_to_create? - access = Gitlab::UserAccess.new(current_user, project: project) + return unless can?(current_user, :create_pipeline, project) - can?(current_user, :create_pipeline, project) && - if branch? - access.can_update_branch?(ref) - elsif tag? - access.can_create_tag?(ref) - else - true # Allow it for now and we'll reject when we check ref existence - end + access = Gitlab::UserAccess.new(current_user, project: project) + if branch? + access.can_update_branch?(ref) + elsif tag? + access.can_create_tag?(ref) + else + true # Allow it for now and we'll reject when we check ref existence + end end def update_merge_requests_head_pipeline |