mapping.rb 1.1 KB

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Zendesk::User::Mapping < Sequencer::Unit::Base
  3. include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
  4. uses :resource, :login, :password, :roles, :groups, :organization_id, :image_source
  5. def process
  6. provide_mapped do
  7. {
  8. login: login,
  9. firstname: resource.name,
  10. lastname: '', # makes sure name guessing is triggered for updating existing users. Which happens when importing a big list of users due to overlapping pagination.
  11. email: resource.email,
  12. phone: resource.phone,
  13. password: password,
  14. active: (!resource.suspended && resource.active) || false,
  15. groups: groups,
  16. roles: roles,
  17. note: resource.notes,
  18. verified: resource.verified,
  19. organization_id: organization_id,
  20. last_login: resource.last_login_at,
  21. image_source: image_source,
  22. }
  23. end
  24. end
  25. end