mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
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>
21 lines
547 B
Ruby
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
|