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