Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
b6ffeb3b9c42
Commit
9747ad9d
authored
Aug 13, 2018
by
Valery Sizov
Browse files
Fix: Project deletion may not log audit events during group deletion
parent
587d9d58736b
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/services/groups/destroy_service.rb
View file @
b6ffeb3b
...
...
@@ -2,6 +2,8 @@
module
Groups
class
DestroyService
<
Groups
::
BaseService
DestroyError
=
Class
.
new
(
StandardError
)
def
async_execute
job_id
=
GroupDestroyWorker
.
perform_async
(
group
.
id
,
current_user
.
id
)
Rails
.
logger
.
info
(
"User
#{
current_user
.
id
}
scheduled a deletion of group ID
#{
group
.
id
}
with job ID
#{
job_id
}
"
)
...
...
@@ -12,9 +14,8 @@ def execute
group
.
projects
.
each
do
|
project
|
# Execute the destruction of the models immediately to ensure atomic cleanup.
# Skip repository removal because we remove directory with namespace
# that contain all these repositories
::
Projects
::
DestroyService
.
new
(
project
,
current_user
,
skip_repo:
project
.
legacy_storage?
).
execute
success
=
::
Projects
::
DestroyService
.
new
(
project
,
current_user
).
execute
raise
DestroyError
,
"Project
#{
project
.
id
}
can't be deleted"
unless
success
end
group
.
children
.
each
do
|
group
|
...
...
changelogs/unreleased/49796-project-deletion-may-not-log-audit-events-during-group-deletion.yml
0 → 100644
View file @
b6ffeb3b
---
title
:
'
Fix:
Project
deletion
may
not
log
audit
events
during
group
deletion'
merge_request
:
21162
author
:
type
:
fixed
spec/services/groups/destroy_service_spec.rb
View file @
b6ffeb3b
...
...
@@ -135,6 +135,17 @@ def destroy_group(group, user, async)
it_behaves_like
'group destruction'
,
false
end
context
'repository removal status is taken into account'
do
it
'raises exception'
do
expect_next_instance_of
(
::
Projects
::
DestroyService
)
do
|
destroy_service
|
expect
(
destroy_service
).
to
receive
(
:execute
).
and_return
(
false
)
end
expect
{
destroy_group
(
group
,
user
,
false
)
}
.
to
raise_error
(
Groups
::
DestroyService
::
DestroyError
,
"Project
#{
project
.
id
}
can't be deleted"
)
end
end
describe
'repository removal'
do
before
do
destroy_group
(
group
,
user
,
false
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment