2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class DeleteUserWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2016-02-17 08:41:33 -05:00
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :authentication_and_authorization
|
2020-06-12 08:08:56 -04:00
|
|
|
loggable_arguments 2
|
2019-10-18 07:11:44 -04:00
|
|
|
|
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
|
2020-05-21 17:08:31 -04:00
|
|
|
Gitlab::AppLogger.warn("User could not be destroyed: #{e}")
|
2016-02-17 08:41:33 -05:00
|
|
|
end
|
|
|
|
end
|