2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2017-11-29 16:54:52 +00:00
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Import
|
|
|
|
module Ldap
|
|
|
|
module User
|
|
|
|
module Lookup
|
2018-01-12 12:38:43 +00:00
|
|
|
class Attributes < Sequencer::Unit::Import::Common::Model::FindBy::UserAttributes
|
|
|
|
|
|
|
|
uses :found_ids, :external_sync_source
|
|
|
|
|
2017-11-29 16:54:52 +00:00
|
|
|
private
|
|
|
|
|
2018-01-12 12:38:43 +00:00
|
|
|
def lookup(attribute:, value:)
|
|
|
|
entries = model_class.where(attribute => value).to_a
|
|
|
|
return if entries.blank?
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2018-01-12 12:38:43 +00:00
|
|
|
not_synced(entries)
|
|
|
|
end
|
|
|
|
|
|
|
|
def not_synced(entries)
|
2020-11-24 16:20:57 +00:00
|
|
|
entries.find { |entry| not_synced?(entry) }
|
2018-01-12 12:38:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def not_synced?(entry)
|
|
|
|
found_ids.exclude?(entry.id)
|
2017-11-29 16:54:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|