Method: LDAP::Conn#schema

Defined in:
lib/ldap/schema.rb

#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