Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Rydkin <maks.rydkin@gmail.com>2017-09-06 19:35:28 +0300
committerMaxim Rydkin <maks.rydkin@gmail.com>2017-09-07 13:16:15 +0300
commit9151ca7bb37b7c0f36b0a1c6ba4ba1c37fd3660b (patch)
tree72254e78caca3a9a1eb3a67ac81d3b19ffd1d12f /app/services/ci
parent2a54cbcab83612991c0c61ffed1b2472e4e49047 (diff)
refactor Ci::CreatePipelineService#allowed_to_create?
Diffstat (limited to 'app/services/ci')
-rw-r--r--app/services/ci/create_pipeline_service.rb18
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