Method: JSS::LDAPServer.server_for_user

Defined in:
lib/jss/api_object/ldap_server.rb

.server_for_user(user, api: JSS.api) ⇒ Integer?

Returns the id of the first LDAP server with the user, nil if not found.

Returns:

  • (Integer, nil)

    the id of the first LDAP server with the user, nil if not found



95
96
97
98
99
100
101
# File 'lib/jss/api_object/ldap_server.rb', line 95

def self.server_for_user(user, api: JSS.api)
  all_objects(:refresh, api: api).each do |ldap|
    next if ldap.find_user(user, :exact).empty?
    return ldap.id
  end
  nil
end