unhex.rb 632 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Ldap::User::RemoteId::Unhex < Sequencer::Unit::Base
  3. prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
  4. skip_action :skipped, :failed
  5. uses :remote_id
  6. provides :remote_id
  7. def process
  8. # check if a remote_id is given and
  9. # prefer .nil? over .blank? etc. because
  10. # the HEX values cause errors otherwise
  11. return if remote_id.nil?
  12. return if remote_id.ascii_only?
  13. state.provide(:remote_id, unhexed)
  14. end
  15. private
  16. def unhexed
  17. ::Ldap::Guid.string(remote_id)
  18. end
  19. end