deactivate.rb 482 B

12345678910111213141516
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Ldap::Sources::Lost::Deactivate < Sequencer::Unit::Base
  3. uses :dry_run, :lost_ids
  4. def process
  5. return if dry_run
  6. # Why not use `#update_all`?
  7. # It bypasses validations/callbacks
  8. # (which are used to send notifications to the client)
  9. ::User.where(id: lost_ids).find_each do |user|
  10. user.update!(active: false, updated_by_id: 1)
  11. end
  12. end
  13. end