diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-11-16 17:02:54 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-11-16 17:02:54 +0300 |
commit | 9c233fa972192940acdc1090c3d9a9ec6e6f5de7 (patch) | |
tree | 9222b4d40a3f96b57b881bbe9bdad71a757622ff /app/services | |
parent | 4e24ccc436e1678c79d71225a3cb9eb3c11ed17a (diff) | |
parent | de605ad1437e8e0beb5da76c900623dd541e1f72 (diff) |
Merge branch '41875-allow-pipelines-to-be-deleted-by-project-owners' into 'master'
Resolve "Allow pipelines to be deleted by project owners"
Closes #41875
See merge request gitlab-org/gitlab-ce!22988
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/ci/destroy_pipeline_service.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/services/ci/destroy_pipeline_service.rb b/app/services/ci/destroy_pipeline_service.rb new file mode 100644 index 00000000000..13f892aabb8 --- /dev/null +++ b/app/services/ci/destroy_pipeline_service.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Ci + class DestroyPipelineService < BaseService + def execute(pipeline) + raise Gitlab::Access::AccessDeniedError unless can?(current_user, :destroy_pipeline, pipeline) + + AuditEventService.new(current_user, pipeline).security_event + + pipeline.destroy! + end + end +end |