ids.rb 677 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Ldap::Sources::Lost::Ids < Sequencer::Unit::Base
  3. uses :found_ids, :external_sync_source, :model_class
  4. provides :lost_ids
  5. def process
  6. state.provide(:lost_ids, active_ids - found_ids)
  7. end
  8. def active_ids
  9. ::ExternalSync.joins('INNER JOIN users ON (users.id = external_syncs.o_id)')
  10. .where(
  11. source: external_sync_source,
  12. object: model_class.name,
  13. users: {
  14. active: true
  15. }
  16. )
  17. .pluck(:o_id)
  18. end
  19. end