groups.rb 481 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Zendesk::User::Groups < Sequencer::Unit::Common::Provider::Named
  3. uses :resource, :group_map, :user_group_map
  4. private
  5. def groups
  6. remote_ids.filter_map { |remote_id| group_map[remote_id] }
  7. .map { |local_id| ::Group.find(local_id) }
  8. end
  9. def remote_ids
  10. return [] if user_group_map.blank?
  11. user_group_map.fetch(resource.id, [])
  12. end
  13. end