diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-06-06 18:00:34 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-06-06 18:00:34 +0800 |
commit | 9984f07a28273035d6c989913cb76c9c371965d0 (patch) | |
tree | be761d3a2306c6a6b3bc174e41b8676b9b14759c /app/services/ci/create_pipeline_service.rb | |
parent | d44305eba7fb739447a698e8df123f03dadca9d2 (diff) | |
download | gitlab-ce-9984f07a28273035d6c989913cb76c9c371965d0.tar.gz |
Disallow legacy trigger without a owner
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11910#note_31594492
https://gitlab.com/gitlab-org/gitlab-ce/issues/30634#note_31601001
Diffstat (limited to 'app/services/ci/create_pipeline_service.rb')
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 7efea564ba6..a51c52b3f91 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -23,6 +23,10 @@ module Ci return error('Insufficient permissions to create a new pipeline') end + unless trigger_request && trigger_request.trigger.owner + return error('Legacy trigger without a owner is not allowed') + end + unless branch? || tag? return error('Reference not found') end @@ -59,9 +63,7 @@ module Ci def triggering_user_allowed_for_ref?(trigger_request, ref) triggering_user = current_user || trigger_request.trigger.owner - (triggering_user && - Ci::Pipeline.allowed_to_create?(triggering_user, project, ref)) || - !project.protected_for?(ref) + Ci::Pipeline.allowed_to_create?(triggering_user, project, ref) end def process! |