2017-11-29 16:54:52 +00:00
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Import
|
|
|
|
module Ldap
|
|
|
|
module Users
|
|
|
|
module Lost
|
|
|
|
class Ids < Sequencer::Unit::Base
|
|
|
|
uses :found_ids, :external_sync_source, :model_class
|
|
|
|
provides :lost_ids
|
|
|
|
|
|
|
|
def process
|
|
|
|
state.provide(:lost_ids, active_ids - found_ids)
|
|
|
|
end
|
|
|
|
|
|
|
|
def active_ids
|
2018-01-10 10:55:02 +00:00
|
|
|
::ExternalSync.joins('INNER JOIN users ON (users.id = external_syncs.o_id)')
|
|
|
|
.where(
|
|
|
|
source: external_sync_source,
|
|
|
|
object: model_class.name,
|
|
|
|
users: {
|
|
|
|
active: true
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.pluck(:o_id)
|
2017-11-29 16:54:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|