diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-28 12:00:02 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-28 12:00:02 +0200 |
commit | 499154518a1555523ed5f203c9ce4bbe6317c9a5 (patch) | |
tree | a353b24c08673cfdc4f0c9cb8617e8c57af822a4 /app/controllers | |
parent | c843e092f309d22281205e34658221f17642ea33 (diff) | |
download | gitlab-ce-499154518a1555523ed5f203c9ce4bbe6317c9a5.tar.gz |
You can not remove user if he/she is an only owner of group
To prevent loose of group data you need to transfer or remove group
first before you can remove user
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/users_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/registrations_controller.rb | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index d36e359934c..06d6d61e907 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -86,11 +86,7 @@ class Admin::UsersController < Admin::ApplicationController end def destroy - # 1. Remove groups where user is the only owner - user.solo_owned_groups.map(&:destroy) - - # 2. Remove user with all authored content including personal projects - user.destroy + DeleteUserService.new.execute(user) respond_to do |format| format.html { redirect_to admin_users_path } diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 830751a989f..6e57fded337 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -6,7 +6,7 @@ class RegistrationsController < Devise::RegistrationsController end def destroy - current_user.destroy + DeleteUserService.new.execute(user) respond_to do |format| format.html { redirect_to new_user_session_path, notice: "Account successfully removed." } |