Property | Type | Description | |
---|---|---|---|
$_config | array | - hostspec: the LDAP host to connect to (may be an array of several hosts to try). - port: the server port. - version: LDAP version (defaults to 3). - tls: when set, ldap_start_tls() is run after connecting. - binddn: the DN to bind as when searching. - bindpw: password to use when searching LDAP. - basedn: LDAP base. - options: hash of LDAP options to set. - filter: default search filter. - scope: default search scope. - user: configuration parameters for {@link findUserDN()}, must contain 'uid', and may contain 'basedn' entries. - timeout: Connection timeout in seconds (defaults to 5). - auto_reconnect: if true, the class will automatically attempt to reconnect to the LDAP server in certain failure conditions when attempting a search, or other LDAP operations. Defaults to false. Note that if you set this to true, calls to search() may block indefinitely if there is a catastrophic server failure. - min_backoff: minimum reconnection delay period (in seconds). - current_backof: initial reconnection delay period (in seconds). - max_backoff: maximum reconnection delay period (in seconds). - cache a Horde_Cache instance for caching schema requests. | |
$_downHostList | array | List of hosts that are known to be down. | |
$_hostList | array | List of hosts we try to establish a connection to. | |
$_link | resource | LDAP resource link. | |
$_rootDSECache | array | Hash with requested rootDSE attr names as key and rootDSE object as value. Since the RootDSE object itself may request a rootDSE object, {@link rootDSE()} caches successful requests. Internally, Horde_Ldap needs several lookups to this object, so caching increases performance significally. | |
$_schema | Horde_Ldap_Schema | Schema object. | |
$_schemaAttrs | Cache for attribute encoding checks. | ||
$_schemaCache | string | Schema cache function callback. |
Method | Description | |
---|---|---|
__construct ( array $config = [] ) | Constructor. | |
__destruct ( ) | Destructor. | |
add ( Horde_Ldap_Entry $entry ) | Adds a new entry to the directory. | |
bind ( string $dn = null, string $password = null ) | Bind or rebind to the LDAP server. | |
buildClause ( string $lhs, string $op, string $rhs, array $params = [] ) : string | Builds an LDAP search filter fragment. | |
checkLDAPExtension ( ) | Checks if PHP's LDAP extension is loaded. | |
copy ( Horde_Ldap_Entry $entry, string $newdn ) : Horde_Ldap_Entry | Copies an entry to a new location. | |
delete ( string | Horde_Ldap_Entry $dn, boolean $recursive = false ) | Deletes an entry from the directory. | |
disconnect ( ) | Closes the LDAP connection. | |
errorName ( integer $errorcode ) : string | Returns the string for an LDAP errorcode. | |
exists ( string | Horde_Ldap_Entry $dn ) : boolean | Returns whether a DN exists in the directory. | |
findUserDN ( string $user ) : string | Returns the DN of a user. | |
getEntry ( string $dn, array $attributes = [] ) : Horde_Ldap_Entry | Returns a specific entry based on the DN. | |
getLink ( ) : resource | Returns the LDAP link resource. | |
getOption ( string $option ) : Horde_Ldap_Error | string | Returns an LDAP option value. | |
getVersion ( ) : integer | Returns the LDAP protocol version that is used on the connection. | |
modify ( string | Horde_Ldap_Entry $entry, array $parms = [] ) | Modifies an LDAP entry on the server. | |
move ( string | Horde_Ldap_Entry $entry, string $newdn, Horde_Ldap $target_ldap = null ) | Renames or moves an entry. | |
quote ( string $clause ) : string | Escapes characters with special meaning in LDAP searches. | |
quoteDN ( array $parts ) : string | Takes an array of DN elements and properly quotes it according to RFC 1485. | |
rootDSE ( array $attrs = [] ) : Horde_Ldap_RootDse | Returns a rootDSE object | |
schema ( string $dn = null ) : Horde_Ldap_Schema | Returns a schema object | |
search ( string | Horde_Ldap_Entry $base = null, string | Horde_Ldap_Filter $filter = null, array $params = [] ) : Horde_Ldap_Search | Runs an LDAP search query. | |
setOption ( string $option, mixed $value ) | Sets an LDAP option. | |
setVersion ( integer $version, boolean $force = false ) | Sets the LDAP protocol version that is used on the connection. | |
startTLS ( ) | Starts an encrypted session. | |
utf8Decode ( array $attributes ) : array | Horde_Ldap_Error | ||
utf8Encode ( array $attributes ) : array | Horde_Ldap_Error |
Method | Description | |
---|---|---|
_connect ( ) | Connects to the LDAP server. | |
_quoteRDN ( array $attribute ) : string | Takes an RDN array with an attribute name and value and properly quotes it according to RFC 1485. | |
_quoteRDNs ( array $attribute ) : string | Takes a single or a list of RDN arrays with an attribute name and value and properly quotes it according to RFC 1485. | |
_reconnect ( ) | Reconnects to the LDAP server. | |
setConfig ( array $config ) | Sets the internal configuration array. | |
utf8 ( array $attributes, array $function ) : array |
public __construct ( array $config = [] ) | ||
$config | array | Configuration array. |
protected _connect ( ) |
protected static _quoteRDNs ( array $attribute ) : string | ||
$attribute | array | A tuple or array of tuples containing the attribute name and that attribute's value which make up the RDN. |
return | string | The properly quoted string RDN. |
protected _reconnect ( ) |
public add ( Horde_Ldap_Entry $entry ) | ||
$entry | Horde_Ldap_Entry | An LDAP entry. |
public static checkLDAPExtension ( ) |
public findUserDN ( string $user ) : string | ||
$user | string | The user to find. |
return | string | The user's full DN. |
public getLink ( ) : resource | ||
return | resource | LDAP link. |
public getVersion ( ) : integer | ||
return | integer | The protocol version. |
array('add' => array('attribute1' => array('val1', 'val2'),
'attribute2' => array('val1')),
'delete' => array('attribute1'),
'replace' => array('attribute1' => array('val1')),
'changes' => array('add' => ...,
'replace' => ...,
'delete' => array('attribute1', 'attribute2' => array('val1')))
The order of execution is as following:
1. adds from 'add' array
2. deletes from 'delete' array
3. replaces from 'replace' array
4. changes (add, replace, delete) in order of appearance
The function calls the corresponding functions of an Horde_Ldap_Entry
object. A detailed description of array structures can be found there.
Unlike the modification methods provided by the Horde_Ldap_Entry object,
this method will instantly carry out an update() after each operation,
thus modifying "directly" on the server. public static quoteDN ( array $parts ) : string | ||
$parts | array | An array of tuples containing the attribute
name and that attribute's value which make
up the DN. Example:
$parts = array(
array('cn', 'John Smith'),
array('dc', 'example'),
array('dc', 'com')
);
Nested arrays are supported since 2.1.0, to form
multi-valued RDNs. Example:
$parts = array(
array(
array('cn', 'John'),
array('sn', 'Smith'),
array('o', 'Acme Inc.'),
),
array('dc', 'example'),
array('dc', 'com')
);
which will result in
cn=John+sn=Smith+o=Acme Inc.,dc=example,dc=com |
return | string | The properly quoted string DN. |
public search ( string | Horde_Ldap_Entry $base = null, string | Horde_Ldap_Filter $filter = null, array $params = [] ) : Horde_Ldap_Search | ||
$base | string | Horde_Ldap_Entry | LDAP searchbase. |
$filter | string | Horde_Ldap_Filter | LDAP search filter. |
$params | array | Array of options. |
return | Horde_Ldap_Search | The search result. |
public setVersion ( integer $version, boolean $force = false ) | ||
$version | integer | LDAP version that should be used. |
$force | boolean | If set to true, the check against the rootDSE will be skipped. |
public utf8Decode ( array $attributes ) : array | Horde_Ldap_Error | ||
$attributes | array | Array of attributes |
return | array | Horde_Ldap_Error | Array with decoded attribute values or Error |
public utf8Encode ( array $attributes ) : array | Horde_Ldap_Error | ||
$attributes | array | An array of attributes. |
return | array | Horde_Ldap_Error | An array of UTF8 encoded attributes or an error. |
protected array $_config | ||
return | array |
protected array $_downHostList | ||
return | array |
protected array $_hostList | ||
return | array |
protected array $_rootDSECache | ||
return | array |
protected Horde_Ldap_Schema $_schema | ||
return | Horde_Ldap_Schema |
protected string $_schemaCache | ||
return | string |