groups_permissions.rb 592 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Freshdesk::Agents < Sequencer::Unit::Import::Freshdesk::SubSequence::Object
  3. class GroupsPermissions < Sequencer::Unit::Base
  4. def process
  5. ::Role.find_by(name: 'Agent').users.each do |user|
  6. user.group_ids_access_map = group_ids_access_map
  7. user.save!
  8. end
  9. end
  10. private
  11. def group_ids_access_map
  12. @group_ids_access_map ||= begin
  13. ::Group.all.pluck(:id).index_with do
  14. 'full'.freeze
  15. end
  16. end
  17. end
  18. end
  19. end