trabajo-afectivo/lib/sequencer/unit/import/zendesk/user/groups.rb

30 lines
689 B
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
class Sequencer
class Unit
module Import
module Zendesk
module User
class Groups < Sequencer::Unit::Common::Provider::Named
uses :resource, :group_map, :user_group_map
private
def groups
2021-06-24 07:05:39 +00:00
remote_ids.filter_map { |remote_id| group_map[remote_id] }
.map { |local_id| ::Group.find(local_id) }
end
def remote_ids
return [] if user_group_map.blank?
user_group_map.fetch(resource.id, [])
end
end
end
end
end
end
end