PHP Class Turba_Driver_Ldap, horde

Copyright 2010-2016 Horde LLC (http://www.horde.org/) See the enclosed file LICENSE for license information (ASL). If you did did not receive this file, see http://www.horde.org/licenses/apache.
Author: Chuck Hagenbuch ([email protected])
Author: Jon Parise ([email protected])
Inheritance: extends Turba_Driver
Show file Open project: horde/horde

Protected Properties

Property Type Description
$_ds resource Handle for the current LDAP connection.
$_syntaxCache array Cache _getSyntax() calls.

Public Methods

Method Description
__construct ( string $name = '', array $params = [] ) : Turba_Driver_Ldap Constructs a new Turba LDAP driver object.
toDriverKeys ( array $hash ) : array Extends parent function to build composed fields needed for the dn based on the contents of $this->map.

Protected Methods

Method Description
_add ( array $attributes, array $blob_fields = [], array $date_fields = [] ) Adds the specified contact to the addressbook.
_buildSearchQuery ( array $criteria ) : string Build a piece of a search query.
_canAdd ( ) : boolean TODO
_checkRequiredAttributes ( array $objectclasses ) : array Returns a list of required attributes.
_connect ( ) Initiate LDAP connection.
_convertParameters ( array $in ) : array Converts Turba connection parameter so Horde_Ldap parameters.
_delete ( string $object_key, string $object_id ) Deletes the specified entry from the LDAP directory.
_emptyAttributeFilter ( $var ) : boolean Remove empty attributes from attributes array.
_encodeAttributes ( array &$attributes ) Format and encode attributes including postal addresses, character set encoding, etc.
_getResults ( array $fields, resource $res ) : array Get some results from a result identifier and clean them up.
_getSyntax ( string $att ) : string Returns the syntax of an attribute, if necessary recursively.
_isPostalAddress ( string $attribute ) : boolean Checks if an attribute refers to a Postal Address.
_isString ( string $attribute ) : boolean Checks if an attribute refers to a string.
_makeKey ( array $attributes ) : string Build a DN based on a set of attributes and what attributes make a DN for the current source.
_makeRDN ( array $attributes ) : string Build a RDN based on a set of attributes and what attributes make a RDN for the current source.
_makeRDNhelper ( array $attributes, array $dn ) : string Helper function for _makeRDN().
_read ( string $key, mixed $ids, string $owner, array $fields, array $blobFields = [], array $dateFields = [] ) : array Reads the LDAP directory for a given element and returns the results.
_save ( Turba_Object $object ) : string Modifies the specified entry in the LDAP directory.
_search ( array $criteria, array $fields, array $blobFields = [], $count_only = false ) : array Searches the LDAP directory with the given criteria and returns a filtered list of results. If no criteria are specified, all records are returned.

Method Details

__construct() public method

Constructs a new Turba LDAP driver object.
public __construct ( string $name = '', array $params = [] ) : Turba_Driver_Ldap
$name string The source name
$params array Hash containing additional configuration parameters.
return Turba_Driver_Ldap

_add() protected method

Adds the specified contact to the addressbook.
protected _add ( array $attributes, array $blob_fields = [], array $date_fields = [] )
$attributes array The attribute values of the contact.
$blob_fields array Fields that represent binary data.
$date_fields array Fields that represent dates. @since 4.2.0

_buildSearchQuery() protected method

Build a piece of a search query.
protected _buildSearchQuery ( array $criteria ) : string
$criteria array The array of criteria.
return string An LDAP query fragment.

_canAdd() protected method

TODO
protected _canAdd ( ) : boolean
return boolean TODO

_checkRequiredAttributes() protected method

Returns a list of required attributes.
protected _checkRequiredAttributes ( array $objectclasses ) : array
$objectclasses array List of objectclasses that should be checked for required attributes.
return array List of attribute names of the specified objectclasses that have been configured as being required.

_connect() protected method

Not done in __construct(), only when a read or write action is necessary.
protected _connect ( )

_convertParameters() protected method

Converts Turba connection parameter so Horde_Ldap parameters.
protected _convertParameters ( array $in ) : array
$in array Turba parameters.
return array Horde_Ldap parameters.

_delete() protected method

Deletes the specified entry from the LDAP directory.
protected _delete ( string $object_key, string $object_id )
$object_key string
$object_id string

_emptyAttributeFilter() protected method

Remove empty attributes from attributes array.
protected _emptyAttributeFilter ( $var ) : boolean
return boolean Boolean used by array_filter.

_encodeAttributes() protected method

Format and encode attributes including postal addresses, character set encoding, etc.
protected _encodeAttributes ( array &$attributes )
$attributes array The attributes array.

_getResults() protected method

Get some results from a result identifier and clean them up.
protected _getResults ( array $fields, resource $res ) : array
$fields array List of fields to return.
$res resource Result identifier.
return array Hash containing the results.

_getSyntax() protected method

Returns the syntax of an attribute, if necessary recursively.
protected _getSyntax ( string $att ) : string
$att string Attribute name.
return string Attribute syntax.

_isPostalAddress() protected method

Checks if an attribute refers to a Postal Address.
protected _isPostalAddress ( string $attribute ) : boolean
$attribute string An attribute name.
return boolean True if the specified attribute refers to a Postal Address.

_isString() protected method

Checks if an attribute refers to a string.
protected _isString ( string $attribute ) : boolean
$attribute string An attribute name.
return boolean True if the specified attribute refers to a string.

_makeKey() protected method

Build a DN based on a set of attributes and what attributes make a DN for the current source.
protected _makeKey ( array $attributes ) : string
$attributes array The attributes (in driver keys) of the object being added.
return string The DN for the new object.

_makeRDN() protected method

Build a RDN based on a set of attributes and what attributes make a RDN for the current source.
protected _makeRDN ( array $attributes ) : string
$attributes array The attributes (in driver keys) of the object being added.
return string The RDN for the new object.

_makeRDNhelper() protected method

Recursively builds the (possibly nested) attribute-value array to build a DN. Nested arrays will be joined with the '+' character, see Horde_Ldap::quoteDN().
protected _makeRDNhelper ( array $attributes, array $dn ) : string
$attributes array The attributes (in driver keys) of the object being added.
$dn array The array describing how the DN should be built.
return string The array to be passed to Horde_Ldap::quoteDN().

_read() protected method

Reads the LDAP directory for a given element and returns the results.
protected _read ( string $key, mixed $ids, string $owner, array $fields, array $blobFields = [], array $dateFields = [] ) : array
$key string The primary key field to use.
$ids mixed The ids of the contacts to load.
$owner string Only return contacts owned by this user.
$fields array List of fields to return.
$blobFields array Array of fields containing binary data.
$dateFields array Array of fields containing date data. @since 4.2.0
return array Hash containing the search results.

_save() protected method

Modifies the specified entry in the LDAP directory.
protected _save ( Turba_Object $object ) : string
$object Turba_Object The object we wish to save.
return string The object id, possibly updated.

toDriverKeys() public method

Extends parent function to build composed fields needed for the dn based on the contents of $this->map.
public toDriverKeys ( array $hash ) : array
$hash array Hash using Turba keys.
return array Translated version of $hash.

Property Details

$_ds protected property

Handle for the current LDAP connection.
protected resource $_ds
return resource

$_syntaxCache protected property

Cache _getSyntax() calls.
protected array $_syntaxCache
return array