2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-10-20 09:43:35 +00:00
|
|
|
|
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Import
|
|
|
|
module Kayako
|
|
|
|
module User
|
|
|
|
class Mapping < Sequencer::Unit::Base
|
|
|
|
include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
|
|
|
|
|
|
|
|
uses :resource, :login, :password, :roles, :group_ids, :organization_id, :identifier
|
|
|
|
|
|
|
|
def process
|
|
|
|
provide_mapped do
|
|
|
|
{
|
|
|
|
login: login,
|
|
|
|
firstname: resource['full_name'],
|
|
|
|
email: identifier[:email],
|
|
|
|
phone: identifier[:phone],
|
|
|
|
password: password,
|
|
|
|
active: active?,
|
|
|
|
group_ids: group_ids,
|
|
|
|
roles: roles,
|
|
|
|
organization_id: organization_id,
|
|
|
|
last_login: resource['last_logged_in_at'],
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def active?
|
|
|
|
resource['is_enabled']
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|