Class: LDAP::Conn
- Inherits:
-
Object
- Object
- LDAP::Conn
- Includes:
- ConnImplementation
- Defined in:
- lib/ldap/conn.rb,
lib/ldap/schema.rb
Instance Method Summary collapse
-
#initialize(host = 'localhost', port = LDAP_PORT) ⇒ Conn
constructor
A new instance of Conn.
-
#root_dse(attrs = nil, sec = 0, usec = 0) ⇒ Object
Fetch the root DSE (DSA-specific Entry) for the connection.
-
#schema(base = nil, attrs = nil, sec = 0, usec = 0) ⇒ Object
Fetch the schema data for the connection.
Methods included from ConnImplementation
#__jndi_context, #add, #bind, #bound?, #controls, #delete, #err, #err2string, #get_option, #modify, #modrdn, #perror, #referrals, #result2error, #search, #search2, #set_option, #simple_bind, #unbind
Constructor Details
#initialize(host = 'localhost', port = LDAP_PORT) ⇒ Conn
Returns a new instance of Conn.
253 254 255 256 |
# File 'lib/ldap/conn.rb', line 253 def initialize(host='localhost', port=LDAP_PORT) super @use_ssl = false end |
Instance Method Details
#root_dse(attrs = nil, sec = 0, usec = 0) ⇒ Object
Fetch the root DSE (DSA-specific Entry) for the connection. DSA stands for Directory System Agent and simply refers to the LDAP server you are using.
attrs
, if given, is an array of attributes that should be returned from the server. The default list is subschemaSubentry, namingContexts, monitorContext, altServer, supportedControl, supportedExtension, supportedFeatures, supportedSASLMechanisms and supportedLDAPVersion.
sec
and usec
can be used to specify a time-out for the search in seconds and microseconds, respectively.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/ldap/schema.rb', line 113 def root_dse(attrs = nil, sec = 0, usec = 0) attrs ||= [ 'subschemaSubentry', 'namingContexts', 'monitorContext', 'altServer', 'supportedControl', 'supportedExtension', 'supportedFeatures', 'supportedSASLMechanisms', 'supportedLDAPVersion', ] entries = search2('', LDAP_SCOPE_BASE, '(objectClass=*)', attrs, false, sec, usec) return entries end |
#schema(base = nil, attrs = nil, sec = 0, usec = 0) ⇒ Object
Fetch the schema data for the connection.
If base
is given, it gives the base DN for the search. attrs
, if given, is an array of attributes that should be returned from the server. The default list is objectClasses, attributeTypes, matchingRules, matchingRuleUse, dITStructureRules, dITContentRules, nameForms and ldapSyntaxes.
sec
and usec
can be used to specify a time-out for the search in seconds and microseconds, respectively.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ldap/schema.rb', line 82 def schema(base = nil, attrs = nil, sec = 0, usec = 0) attrs ||= [ 'objectClasses', 'attributeTypes', 'matchingRules', 'matchingRuleUse', 'dITStructureRules', 'dITContentRules', 'nameForms', 'ldapSyntaxes', ] base ||= root_dse(['subschemaSubentry'], sec, usec)[0]['subschemaSubentry'][0] base ||= 'cn=schema' ent = search2(base, LDAP_SCOPE_BASE, '(objectClass=subschema)', attrs, false, sec, usec) return Schema.new(ent[0]) end |