Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
5fbb6ddf
Commit
5fbb6ddf
authored
Aug 13, 2018
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Project deletion may not log audit events during group deletion
parent
3dd44f2b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
app/services/groups/destroy_service.rb
app/services/groups/destroy_service.rb
+4
-3
changelogs/unreleased/49796-project-deletion-may-not-log-audit-events-during-group-deletion.yml
...letion-may-not-log-audit-events-during-group-deletion.yml
+5
-0
spec/services/groups/destroy_service_spec.rb
spec/services/groups/destroy_service_spec.rb
+11
-0
No files found.
app/services/groups/destroy_service.rb
View file @
5fbb6ddf
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
Groups
module
Groups
class
DestroyService
<
Groups
::
BaseService
class
DestroyService
<
Groups
::
BaseService
DestroyError
=
Class
.
new
(
StandardError
)
def
async_execute
def
async_execute
job_id
=
GroupDestroyWorker
.
perform_async
(
group
.
id
,
current_user
.
id
)
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
}
"
)
Rails
.
logger
.
info
(
"User
#{
current_user
.
id
}
scheduled a deletion of group ID
#{
group
.
id
}
with job ID
#{
job_id
}
"
)
...
@@ -12,9 +14,8 @@ module Groups
...
@@ -12,9 +14,8 @@ module Groups
group
.
projects
.
each
do
|
project
|
group
.
projects
.
each
do
|
project
|
# Execute the destruction of the models immediately to ensure atomic cleanup.
# Execute the destruction of the models immediately to ensure atomic cleanup.
# Skip repository removal because we remove directory with namespace
success
=
::
Projects
::
DestroyService
.
new
(
project
,
current_user
).
execute
# that contain all these repositories
raise
DestroyError
,
"Project
#{
project
.
id
}
can't be deleted"
unless
success
::
Projects
::
DestroyService
.
new
(
project
,
current_user
,
skip_repo:
project
.
legacy_storage?
).
execute
end
end
group
.
children
.
each
do
|
group
|
group
.
children
.
each
do
|
group
|
...
...
changelogs/unreleased/49796-project-deletion-may-not-log-audit-events-during-group-deletion.yml
0 → 100644
View file @
5fbb6ddf
---
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 @
5fbb6ddf
...
@@ -135,6 +135,17 @@ describe Groups::DestroyService do
...
@@ -135,6 +135,17 @@ describe Groups::DestroyService do
it_behaves_like
'group destruction'
,
false
it_behaves_like
'group destruction'
,
false
end
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
describe
'repository removal'
do
before
do
before
do
destroy_group
(
group
,
user
,
false
)
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