trabajo-afectivo/lib/sequencer/unit/import/freshdesk/agents/groups_permissions.rb
2022-01-01 14:38:12 +01:00

31 lines
798 B
Ruby

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
class Sequencer
class Unit
module Import
module Freshdesk
class Agents < Sequencer::Unit::Import::Freshdesk::SubSequence::Object
class GroupsPermissions < Sequencer::Unit::Base
def process
::Role.find_by(name: 'Agent').users.each do |user|
user.group_ids_access_map = group_ids_access_map
user.save!
end
end
private
def group_ids_access_map
@group_ids_access_map ||= begin
::Group.all.pluck(:id).index_with do
'full'.freeze
end
end
end
end
end
end
end
end
end