diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-17 11:13:16 +0100 |
---|---|---|
committer | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-17 11:13:16 +0100 |
commit | 481e73fb76bbdc845ba6899682ab5fa8c05b11bc (patch) | |
tree | 70becb0067bba3e9f529e81a3bca9608408929a9 /app/services | |
parent | 48274581551b73575149463be0c050f6b5a564ee (diff) | |
parent | 4171933c0963696626c879c2d05afa1594a71d99 (diff) | |
download | gitlab-ce-481e73fb76bbdc845ba6899682ab5fa8c05b11bc.tar.gz |
Merge branch 'master' into new-branch-button-issue
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/delete_user_service.rb | 24 | ||||
-rw-r--r-- | app/services/destroy_group_service.rb | 4 |
2 files changed, 16 insertions, 12 deletions
diff --git a/app/services/delete_user_service.rb b/app/services/delete_user_service.rb index 173e50c9206..ce79287e35a 100644 --- a/app/services/delete_user_service.rb +++ b/app/services/delete_user_service.rb @@ -5,18 +5,22 @@ class DeleteUserService @current_user = current_user end - def execute(user) - if user.solo_owned_groups.present? + def execute(user, options = {}) + if !options[:delete_solo_owned_groups] && user.solo_owned_groups.present? user.errors[:base] << 'You must transfer ownership or delete groups before you can remove user' - user - else - user.personal_projects.each do |project| - # Skip repository removal because we remove directory with namespace - # that contain all this repositories - ::Projects::DestroyService.new(project, current_user, skip_repo: true).pending_delete! - end + return user + end + + user.solo_owned_groups.each do |group| + DestroyGroupService.new(group, current_user).execute + end - user.destroy + user.personal_projects.each do |project| + # Skip repository removal because we remove directory with namespace + # that contain all this repositories + ::Projects::DestroyService.new(project, current_user, skip_repo: true).pending_delete! end + + user.destroy end end diff --git a/app/services/destroy_group_service.rb b/app/services/destroy_group_service.rb index 9189de390a2..3c42ac61be4 100644 --- a/app/services/destroy_group_service.rb +++ b/app/services/destroy_group_service.rb @@ -6,12 +6,12 @@ class DestroyGroupService end def execute - @group.projects.each do |project| + group.projects.each do |project| # Skip repository removal because we remove directory with namespace # that contain all this repositories ::Projects::DestroyService.new(project, current_user, skip_repo: true).pending_delete! end - @group.destroy + group.destroy end end |