refactor Ci::CreatePipelineService#allowed_to_create?
This commit is contained in:
parent
2a54cbcab8
commit
9151ca7bb3
1 changed files with 9 additions and 9 deletions
|
@ -96,16 +96,16 @@ module Ci
|
||||||
end
|
end
|
||||||
|
|
||||||
def allowed_to_create?
|
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) &&
|
access = Gitlab::UserAccess.new(current_user, project: project)
|
||||||
if branch?
|
if branch?
|
||||||
access.can_update_branch?(ref)
|
access.can_update_branch?(ref)
|
||||||
elsif tag?
|
elsif tag?
|
||||||
access.can_create_tag?(ref)
|
access.can_create_tag?(ref)
|
||||||
else
|
else
|
||||||
true # Allow it for now and we'll reject when we check ref existence
|
true # Allow it for now and we'll reject when we check ref existence
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_merge_requests_head_pipeline
|
def update_merge_requests_head_pipeline
|
||||||
|
|
Loading…
Reference in a new issue