attributes.rb 558 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Ldap::User::Lookup::Attributes < Sequencer::Unit::Import::Common::Model::FindBy::UserAttributes
  3. uses :found_ids, :external_sync_source
  4. private
  5. def lookup(attribute:, value:)
  6. entries = model_class.where(attribute => value).to_a
  7. return if entries.blank?
  8. not_synced(entries)
  9. end
  10. def not_synced(entries)
  11. entries.find { |entry| not_synced?(entry) }
  12. end
  13. def not_synced?(entry)
  14. found_ids.exclude?(entry.id)
  15. end
  16. end