Horde_Ldap_Schema
in package
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/)
Tags
Table of Contents
- SYNTAX_BOOLEAN = '1.3.6.1.4.1.1466.115.121.1.7'
- Syntax definitions.
- SYNTAX_DIRECTORY_STRING = '1.3.6.1.4.1.1466.115.121.1.15'
- SYNTAX_DISTINGUISHED_NAME = '1.3.6.1.4.1.1466.115.121.1.12'
- SYNTAX_INTEGER = '1.3.6.1.4.1.1466.115.121.1.27'
- SYNTAX_JPEG = '1.3.6.1.4.1.1466.115.121.1.28'
- SYNTAX_NUMERIC_STRING = '1.3.6.1.4.1.1466.115.121.1.36'
- SYNTAX_OCTET_STRING = '1.3.6.1.4.1.1466.115.121.1.40'
- SYNTAX_OID = '1.3.6.1.4.1.1466.115.121.1.38'
- $types : array<string|int, mixed>
- Map of entry types to LDAP attributes of subschema entry.
- $_attributeTypes : array<string|int, mixed>
- Array of entries belonging to this type
- $_dITContentRules : mixed
- $_dITStructureRules : mixed
- $_initialized : bool
- Whether the schema is initialized.
- $_ldapSyntaxes : mixed
- $_matchingRules : mixed
- $_matchingRuleUse : mixed
- $_nameForms : mixed
- $_objectClasses : mixed
- $_oids : array<string|int, mixed>
- Hash of all fetched OIDs.
- __construct() : mixed
- Constructor.
- get() : mixed
- Returns a specific entry.
- getAll() : array<string|int, mixed>
- Returns a hash of entries for the given type.
- isBinary() : bool
- Returns wether a attribute syntax is binary or not.
- may() : array<string|int, mixed>
- Fetches attributes that MAY be present in the given objectclass.
- must() : array<string|int, mixed>
- Fetches attributes that MUST be present in the given objectclass.
- parse() : mixed
- Parses the schema of the given subschema entry.
- superclass() : array<string|int, mixed>
- Returns the name(s) of the immediate superclass(es).
- _getAttr() : array<string|int, mixed>
- Fetches the given attribute from the given objectclass.
- _parse_entry() : array<string|int, mixed>
- Parses an attribute value into a schema entry.
- _tokenize() : array<string|int, mixed>
- Tokenizes the given value into an array of tokens.
Constants
SYNTAX_BOOLEAN
Syntax definitions.
public
mixed
SYNTAX_BOOLEAN
= '1.3.6.1.4.1.1466.115.121.1.7'
Please don't forget to add binary attributes to isBinary() below to support proper value fetching from Horde_Ldap_Entry.
SYNTAX_DIRECTORY_STRING
public
mixed
SYNTAX_DIRECTORY_STRING
= '1.3.6.1.4.1.1466.115.121.1.15'
SYNTAX_DISTINGUISHED_NAME
public
mixed
SYNTAX_DISTINGUISHED_NAME
= '1.3.6.1.4.1.1466.115.121.1.12'
SYNTAX_INTEGER
public
mixed
SYNTAX_INTEGER
= '1.3.6.1.4.1.1466.115.121.1.27'
SYNTAX_JPEG
public
mixed
SYNTAX_JPEG
= '1.3.6.1.4.1.1466.115.121.1.28'
SYNTAX_NUMERIC_STRING
public
mixed
SYNTAX_NUMERIC_STRING
= '1.3.6.1.4.1.1466.115.121.1.36'
SYNTAX_OCTET_STRING
public
mixed
SYNTAX_OCTET_STRING
= '1.3.6.1.4.1.1466.115.121.1.40'
SYNTAX_OID
public
mixed
SYNTAX_OID
= '1.3.6.1.4.1.1466.115.121.1.38'
Properties
$types
Map of entry types to LDAP attributes of subschema entry.
public
array<string|int, mixed>
$types
= array('attribute' => 'attributeTypes', 'ditcontentrule' => 'dITContentRules', 'ditstructurerule' => 'dITStructureRules', 'matchingrule' => 'matchingRules', 'matchingruleuse' => 'matchingRuleUse', 'nameform' => 'nameForms', 'objectclass' => 'objectClasses', 'syntax' => 'ldapSyntaxes')
$_attributeTypes
Array of entries belonging to this type
protected
array<string|int, mixed>
$_attributeTypes
= array()
$_dITContentRules
protected
mixed
$_dITContentRules
= array()
$_dITStructureRules
protected
mixed
$_dITStructureRules
= array()
$_initialized
Whether the schema is initialized.
protected
bool
$_initialized
= \false
Tags
$_ldapSyntaxes
protected
mixed
$_ldapSyntaxes
= array()
$_matchingRules
protected
mixed
$_matchingRules
= array()
$_matchingRuleUse
protected
mixed
$_matchingRuleUse
= array()
$_nameForms
protected
mixed
$_nameForms
= array()
$_objectClasses
protected
mixed
$_objectClasses
= array()
$_oids
Hash of all fetched OIDs.
protected
array<string|int, mixed>
$_oids
= array()
Methods
__construct()
Constructor.
public
__construct(Horde_Ldap $ldap[, string $dn = null ]) : mixed
Fetches the Schema from an LDAP connection.
Parameters
- $ldap : Horde_Ldap
-
LDAP connection.
- $dn : string = null
-
Subschema entry DN.
Tags
Return values
mixed —get()
Returns a specific entry.
public
get(string $type, string $name) : mixed
Parameters
- $type : string
-
Type of name.
- $name : string
-
Name or OID to fetch.
Tags
Return values
mixed —getAll()
Returns a hash of entries for the given type.
public
getAll(string $type) : array<string|int, mixed>
Types may be: objectclasses, attributes, ditcontentrules, ditstructurerules, matchingrules, matchingruleuses, nameforms, syntaxes.
Parameters
- $type : string
-
Type to fetch.
Tags
Return values
array<string|int, mixed> —isBinary()
Returns wether a attribute syntax is binary or not.
public
isBinary(string $attribute) : bool
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
- $attribute : string
-
The name of the attribute (eg.: 'sn').
Return values
bool —True if the attribute is a binary type.
may()
Fetches attributes that MAY be present in the given objectclass.
public
may(string $oc[, bool $checksup = false ]) : array<string|int, mixed>
Parameters
- $oc : string
-
Name or OID of objectclass.
- $checksup : bool = false
-
Check all superiour objectclasses too?
Return values
array<string|int, mixed> —Array with attributes.
must()
Fetches attributes that MUST be present in the given objectclass.
public
must(string $oc[, bool $checksup = false ]) : array<string|int, mixed>
Parameters
- $oc : string
-
Name or OID of objectclass.
- $checksup : bool = false
-
Check all superiour objectclasses too?
Return values
array<string|int, mixed> —Array with attributes.
parse()
Parses the schema of the given subschema entry.
public
parse(Horde_Ldap_Entry $entry) : mixed
Parameters
- $entry : Horde_Ldap_Entry
-
Subschema entry.
Return values
mixed —superclass()
Returns the name(s) of the immediate superclass(es).
public
superclass(string $oc) : array<string|int, mixed>
Parameters
- $oc : string
-
Name or OID of objectclass.
Tags
Return values
array<string|int, mixed> —_getAttr()
Fetches the given attribute from the given objectclass.
protected
_getAttr(string $oc, string $attr) : array<string|int, mixed>
Parameters
- $oc : string
-
Name or OID of objectclass.
- $attr : string
-
Name of attribute to fetch.
Tags
Return values
array<string|int, mixed> —The attribute.
_parse_entry()
Parses an attribute value into a schema entry.
protected
_parse_entry(string $value) : array<string|int, mixed>
Parameters
- $value : string
-
Attribute value.
Return values
array<string|int, mixed> —Schema entry array.
_tokenize()
Tokenizes the given value into an array of tokens.
protected
_tokenize(string $value) : array<string|int, mixed>
Parameters
- $value : string
-
String to parse.
Return values
array<string|int, mixed> —Array of tokens.