zammad/app/models/ldap_source.rb
Mantas Masalskis 1615e3c995 Maintenance: Improve configuration details returned by the server.
Co-authored-by: Dusan Vuckovic <dv@zammad.com>
Co-authored-by: Florian Liebe <fl@zammad.com>
Co-authored-by: Mantas Masalskis <mm@zammad.com>
Co-authored-by: Marcel Bialas <mb@zammad.com>
Co-authored-by: Martin Gruner <mg@zammad.com>
2026-03-04 08:07:54 +01:00

21 lines
547 B
Ruby

# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
class LdapSource < ApplicationModel
include CanPriorization
include CanSensitiveAssets
include ChecksClientNotification
SENSITIVE_FIELDS = %i[preferences.bind_pw].freeze
default_scope { order(:prio, :id) }
scope :active, -> { where(active: true) }
store :preferences
def self.by_user(user)
return if user.blank? || user.source.blank?
return if !%r{^Ldap::(\d+)$}.match?(user.source)
LdapSource.find(user.source.split('::')[1])
end
end