2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-02-17 08:41:33 -05:00
|
|
|
class DeleteUserWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2016-02-17 08:41:33 -05:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :authentication_and_authorization
|
|
|
|
|
2016-02-25 03:20:28 -05:00
|
|
|
def perform(current_user_id, delete_user_id, options = {})
|
2016-02-17 08:41:33 -05:00
|
|
|
delete_user = User.find(delete_user_id)
|
|
|
|
current_user = User.find(current_user_id)
|
|
|
|
|
2016-08-13 08:45:31 -04:00
|
|
|
Users::DestroyService.new(current_user).execute(delete_user, options.symbolize_keys)
|
2017-02-04 03:14:17 -05:00
|
|
|
rescue Gitlab::Access::AccessDeniedError => e
|
2019-07-10 15:26:47 -04:00
|
|
|
Rails.logger.warn("User could not be destroyed: #{e}") # rubocop:disable Gitlab/RailsLogger
|
2016-02-17 08:41:33 -05:00
|
|
|
end
|
|
|
|
end
|