Commit 177a192b authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'sh-fix-delete-pipeline-api' into 'master'

Fix Error 500 when deleting a pipeline via the API

Closes gitlab-ce#55481

See merge request gitlab-org/gitlab-ee!9105
parents dc8ca3dc 0c0e6440
......@@ -5,8 +5,6 @@ module Ci
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
......
---
title: Fix Error 500 when deleting a pipeline via the API
merge_request: 9104
author:
type: fixed
......@@ -458,11 +458,11 @@ describe API::Pipelines do
context 'when audit events is enabled' do
before do
stub_licensed_features(extended_audit_events: true)
stub_licensed_features(extended_audit_events: true, admin_audit_log: true)
end
it 'logs an audit event' do
expect { delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", owner) }.to change { SecurityEvent.count }.by(1)
it 'does not log an audit event' do
expect { delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", owner) }.not_to change { SecurityEvent.count }
end
end
......
......@@ -19,11 +19,11 @@ describe ::Ci::DestroyPipelineService do
context 'when audit events is enabled' do
before do
stub_licensed_features(extended_audit_events: true)
stub_licensed_features(extended_audit_events: true, admin_audit_log: true)
end
it 'logs an audit event' do
expect { subject }.to change { SecurityEvent.count }.by(1)
it 'does not log an audit event' do
expect { subject }.not_to change { SecurityEvent.count }
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment