trabajo-afectivo/lib/sequencer/unit/import/freshdesk/agents/groups_permissions.rb

32 lines
845 B
Ruby
Raw Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
2021-05-25 12:30:12 +00:00
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).each_with_object({}) do |group_id, result|
result[group_id] = 'full'.freeze
end
end
end
end
end
end
end
end
end