mapping.rb 950 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Kayako::User::Mapping < Sequencer::Unit::Base
  3. include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
  4. uses :resource, :login, :password, :roles, :group_ids, :organization_id, :identifier
  5. def process
  6. provide_mapped do
  7. {
  8. login: login,
  9. firstname: resource['full_name'],
  10. lastname: '', # makes sure name guessing is triggered for updating existing users.
  11. email: identifier[:email],
  12. phone: identifier[:phone],
  13. password: password,
  14. active: active?,
  15. group_ids: group_ids,
  16. roles: roles,
  17. organization_id: organization_id,
  18. last_login: resource['last_logged_in_at'],
  19. }
  20. end
  21. end
  22. private
  23. def active?
  24. resource['is_enabled']
  25. end
  26. end