ldap_source.rb 465 B

123456789101112131415161718
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class LdapSource < ApplicationModel
  3. include CanPriorization
  4. include ChecksClientNotification
  5. default_scope { order(:prio, :id) }
  6. scope :active, -> { where(active: true) }
  7. store :preferences
  8. def self.by_user(user)
  9. return if user.blank? || user.source.blank?
  10. return if !%r{^Ldap::(\d+)$}.match?(user.source)
  11. LdapSource.find(user.source.split('::')[1])
  12. end
  13. end