Utility class for bulk operations on external user accounts.
Specifically this was written for soft deleting, undoing a soft deletion and password resetting of an external user account. It has since been extended to include bulk disabling and enabling of users.
NB: "soft deletion" is a mechanism to deactivate an account by marking it as deleted without actually deleting it.
Disabling prevents login of a user but, unlike soft deletion, does not prevent the user having claims submitted on their behalf via API submissions.
The utility class is not autoloaded so it needs to be required before use:
require 'utils/account_setter'
emails = ['[email protected]', '[email protected]']
accounts = Utils::AccountSetter.new(emails)
# To display a report of basic information
accounts.report
# To soft delete/undelete users
accounts.soft_delete
accounts.un_soft_delete
# To disable/enable users
accounts.disable
accounts.enable
# To force the user to request a password reset
accounts.change_password