\Horde_Ldap_Schema

Load an LDAP Schema and provide information

This class takes a Subschema entry, parses this information and makes it available in an array. Most of the code has been inspired by perl-ldap( http://perl-ldap.sourceforge.net). You will find portions of their implementation in here.

Copyright 2009 Jan Wagner, Benedikt Hallinger Copyright 2010-2017 Horde LLC (http://www.horde.org/)

Summary

Methods
Properties
Constants
__construct()
getAll()
get()
may()
must()
superclass()
parse()
isBinary()
$types
SYNTAX_BOOLEAN
SYNTAX_DIRECTORY_STRING
SYNTAX_DISTINGUISHED_NAME
SYNTAX_INTEGER
SYNTAX_JPEG
SYNTAX_NUMERIC_STRING
SYNTAX_OID
SYNTAX_OCTET_STRING
_getAttr()
_parse_entry()
_tokenize()
$_attributeTypes
$_matchingRules
$_matchingRuleUse
$_ldapSyntaxes
$_objectClasses
$_dITContentRules
$_dITStructureRules
$_nameForms
$_oids
$_initialized
N/A
No private methods found
No private properties found
N/A

Constants

SYNTAX_BOOLEAN

SYNTAX_BOOLEAN

Syntax definitions.

Please don't forget to add binary attributes to isBinary() below to support proper value fetching from Horde_Ldap_Entry.

SYNTAX_DIRECTORY_STRING

SYNTAX_DIRECTORY_STRING

SYNTAX_DISTINGUISHED_NAME

SYNTAX_DISTINGUISHED_NAME

SYNTAX_INTEGER

SYNTAX_INTEGER

SYNTAX_JPEG

SYNTAX_JPEG

SYNTAX_NUMERIC_STRING

SYNTAX_NUMERIC_STRING

SYNTAX_OID

SYNTAX_OID

SYNTAX_OCTET_STRING

SYNTAX_OCTET_STRING

Properties

$types

$types : array

Map of entry types to LDAP attributes of subschema entry.

Type

array

$_attributeTypes

$_attributeTypes : array

Array of entries belonging to this type

Type

array

$_matchingRules

$_matchingRules : 

Type

$_matchingRuleUse

$_matchingRuleUse : 

Type

$_ldapSyntaxes

$_ldapSyntaxes : 

Type

$_objectClasses

$_objectClasses : 

Type

$_dITContentRules

$_dITContentRules : 

Type

$_dITStructureRules

$_dITStructureRules : 

Type

$_nameForms

$_nameForms : 

Type

$_oids

$_oids : array

Hash of all fetched OIDs.

Type

array

$_initialized

$_initialized : boolean

Whether the schema is initialized.

Type

boolean

Methods

__construct()

__construct(\Horde_Ldap  $ldap, string  $dn = null) 

Constructor.

Fetches the Schema from an LDAP connection.

Parameters

\Horde_Ldap $ldap

LDAP connection.

string $dn

Subschema entry DN.

Throws

\Horde_Ldap_Exception

getAll()

getAll(string  $type) : array

Returns a hash of entries for the given type.

Types may be: objectclasses, attributes, ditcontentrules, ditstructurerules, matchingrules, matchingruleuses, nameforms, syntaxes.

Parameters

string $type

Type to fetch.

Throws

\Horde_Ldap_Exception

Returns

array

get()

get(string  $type, string  $name) : mixed

Returns a specific entry.

Parameters

string $type

Type of name.

string $name

Name or OID to fetch.

Throws

\Horde_Ldap_Exception

Returns

mixed

may()

may(string  $oc, boolean  $checksup = false) : array

Fetches attributes that MAY be present in the given objectclass.

Parameters

string $oc

Name or OID of objectclass.

boolean $checksup

Check all superiour objectclasses too?

Returns

array —

Array with attributes.

must()

must(string  $oc, boolean  $checksup = false) : array

Fetches attributes that MUST be present in the given objectclass.

Parameters

string $oc

Name or OID of objectclass.

boolean $checksup

Check all superiour objectclasses too?

Returns

array —

Array with attributes.

superclass()

superclass(string  $oc) : array

Returns the name(s) of the immediate superclass(es).

Parameters

string $oc

Name or OID of objectclass.

Throws

\Horde_Ldap_Exception

Returns

array

parse()

parse(\Horde_Ldap_Entry  $entry) 

Parses the schema of the given subschema entry.

Parameters

\Horde_Ldap_Entry $entry

Subschema entry.

isBinary()

isBinary(string  $attribute) : boolean

Returns wether a attribute syntax is binary or not.

This method is used by Horde_Ldap_Entry to decide which PHP function needs to be used to fetch the value in the proper format (e.g. binary or string).

Parameters

string $attribute

The name of the attribute (eg.: 'sn').

Returns

boolean —

True if the attribute is a binary type.

_getAttr()

_getAttr(string  $oc, string  $attr) : array

Fetches the given attribute from the given objectclass.

Parameters

string $oc

Name or OID of objectclass.

string $attr

Name of attribute to fetch.

Throws

\Horde_Ldap_Exception

Returns

array —

The attribute.

_parse_entry()

_parse_entry(string  $value) : array

Parses an attribute value into a schema entry.

Parameters

string $value

Attribute value.

Returns

array —

Schema entry array.

_tokenize()

_tokenize(string  $value) : array

Tokenizes the given value into an array of tokens.

Parameters

string $value

String to parse.

Returns

array —

Array of tokens.