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

32 lines
798 B
Ruby
Raw Permalink Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://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).index_with do
'full'.freeze
2021-05-25 12:30:12 +00:00
end
end
end
end
end
end
end
end
end