Turba_Driver_Ldap
extends Turba_Driver
in package
Turba directory driver implementation for PHP's LDAP extension.
Copyright 2010-2017 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.
Tags
Table of Contents
- $alternativeName : string
- The name of a field to use as an alternative to the name field if that one is empty.
- $approximate : array<string|int, mixed>
- Array of fields to search "approximately" (@see config/backends.php).
- $fields : array<string|int, mixed>
- List of all fields that can be accessed in the backend (excludes composite attributes, etc.).
- $listNameField : string
- The name of a field to store contact list names in if not the default.
- $map : array<string|int, mixed>
- Hash describing the mapping between Turba attributes and driver-specific fields.
- $strict : array<string|int, mixed>
- Array of fields that must match exactly.
- $tabs : array<string|int, mixed>
- Hash with all tabs and their fields.
- $title : string
- The symbolic title of this source.
- $_asMap : array<string|int, mixed>
- Mapping of Turba attributes to ActiveSync fields.
- $_capabilities : array<string|int, mixed>
- What can this backend do?
- $_contact_owner : string
- Hold the value for the owner of this address book.
- $_count : int
- Number of contacts in this source.
- $_ds : resource
- Handle for the current LDAP connection.
- $_name : string
- The internal name of this source.
- $_objectOptions : array<string|int, mixed>
- Any additional options passed to Turba_Object constructors.
- $_params : array<string|int, mixed>
- Hash holding the driver's additional parameters.
- $_syntaxCache : array<string|int, mixed>
- Cache _getSyntax() calls.
- __construct() : Turba_Driver_Ldap
- Constructs a new Turba LDAP driver object.
- add() : string
- Adds a new entry to the contact source.
- canAdd() : bool
- Returns ability of the backend to add new contacts.
- checkDefaultShare() : bool
- Check if the passed in share is the default share for this source.
- count() : int
- Returns the number of contacts of the current user in this address book.
- createShare() : Horde_Share
- Creates a new Horde_Share for this source type.
- delete() : mixed
- Deletes the specified entry from the contact source.
- deleteAll() : mixed
- Deletes all contacts from an address book.
- fromASContact() : array<string|int, mixed>
- Convert an ActiveSync contact message into a hash suitable for importing via self::add().
- getBlobs() : array<string|int, mixed>
- Returns the attributes that are blob types.
- getContactOwner() : string
- Return the owner to use when searching or creating contacts in this address book.
- getCriteria() : array<string|int, mixed>
- Returns the criteria available for this source except '__key'.
- getDateFields() : array<string|int, mixed>
- Returns the attributes that represent dates.
- getFields() : array<string|int, mixed>
- Returns all non-composite fields for this source. Useful for importing and exporting data, etc.
- getName() : mixed
- Return the name of this address book.
- getObject() : Turba_Object
- Retrieves one object from the source.
- getObjects() : array<string|int, mixed>
- Retrieves a set of objects from the source.
- getParams() : array<string|int, mixed>
- Returns the current driver's additional parameters.
- getTimeObjectTurbaList() : Turba_List
- Default implementation for obtaining a Turba_List to get TimeObjects out of.
- hasCapability() : bool
- Checks if this backend has a certain capability.
- hasPermission() : bool
- Checks if the current user has the requested permissions on this address book.
- listTimeObjects() : array<string|int, mixed>
- Returns a list of birthday or anniversary hashes from this source for a certain period.
- makeSearch() : array<string|int, mixed>
- Takes a hash of Turba key => search value and return a (possibly nested) array, using backend attribute names, that can be turned into a search by the driver. The translation is based on the contents of $this->map, and includes nested OR searches for composite fields.
- removeUserData() : mixed
- Remove all entries owned by the specified user.
- save() : string
- Modifies an existing entry in the contact source.
- search() : mixed
- Searches the source based on the provided criteria.
- searchDuplicates() : array<string|int, mixed>
- Searches the current address book for duplicate entries.
- setContactOwner() : mixed
- Override the contactOwner setting for this driver.
- setDefaultShare() : mixed
- Runs any actions after setting a new default tasklist.
- setSourceName() : mixed
- Override the name setting for this driver.
- synchronize() : mixed
- Synchronize, if needed.
- toASContact() : Horde_ActiveSync_Message_Contact
- Convert the contact to an ActiveSync contact message
- toDriver() : string
- Translates a single Turba attribute to the driver-specific counterpart. The translation is based on the contents of $this->map. This ignores composite fields.
- toDriverKeys() : array<string|int, mixed>
- Extends parent function to build composed fields needed for the dn based on the contents of $this->map.
- toHash() : array<string|int, mixed>
- Function to convert a Horde_Icalendar_Vcard object into a Turba Object Hash with Turba attributes suitable as a parameter for add().
- toTurbaKeys() : array<string|int, mixed>
- Translates a hash from being keyed on driver-specific fields to being keyed on the generalized Turba attributes. The translation is based on the contents of $this->map.
- tovCard() : Horde_Icalendar_Vcard
- Exports a given Turba_Object as an iCalendar vCard.
- _add() : mixed
- Adds the specified contact to the addressbook.
- _buildSearchQuery() : string
- Build a piece of a search query.
- _canAdd() : bool
- TODO
- _checkRequiredAttributes() : array<string|int, mixed>
- Returns a list of required attributes.
- _connect() : mixed
- Initiate LDAP connection.
- _convertParameters() : array<string|int, mixed>
- Converts Turba connection parameter so Horde_Ldap parameters.
- _delete() : mixed
- Deletes the specified entry from the LDAP directory.
- _deleteAll() : array<string|int, mixed>
- Deletes all contacts from an address book.
- _emptyAttributeFilter() : bool
- Remove empty attributes from attributes array.
- _encodeAttributes() : mixed
- Format and encode attributes including postal addresses, character set encoding, etc.
- _filterTags() : Turba_List
- Returns a Turba_List object containing $objects filtered by $tags.
- _getContactOwner() : string
- Return the owner to use when searching or creating contacts in this address book.
- _getResults() : array<string|int, mixed>
- Get some results from a result identifier and clean them up.
- _getSyntax() : string
- Returns the syntax of an attribute, if necessary recursively.
- _getTimeObjectTurbaListFallback() : Turba_List
- Default implementation for obtaining a Turba_List to get TimeObjects out of.
- _guessName() : mixed
- Helper function for guessing name parts from a single name string.
- _hasValEnum() : bool
- Returns whether a ValEnum entry from a DevInf object contains a certain type.
- _init() : mixed
- Initialize the driver.
- _isPostalAddress() : bool
- Checks if an attribute refers to a Postal Address.
- _isString() : bool
- Checks if an attribute refers to a string.
- _makeKey() : string
- Build a DN based on a set of attributes and what attributes make a DN for the current source.
- _makeRDN() : string
- Build a RDN based on a set of attributes and what attributes make a RDN for the current source.
- _makeRDNhelper() : string
- Helper function for _makeRDN().
- _makeUid() : string
- Creates an object UID for a new object.
- _parseName() : array<string|int, mixed>
- Checks $hash for the presence of a 'name' attribute. If not found, attempt to build one from other available values.
- _read() : array<string|int, mixed>
- Reads the LDAP directory for a given element and returns the results.
- _save() : string
- Modifies the specified entry in the LDAP directory.
- _search() : array<string|int, mixed>
- Searches the LDAP directory with the given criteria and returns a filtered list of results. If no criteria are specified, all records are returned.
- _toTurbaObjects() : Turba_List
- Takes an array of object hashes and returns a Turba_List containing the correct Turba_Objects
Properties
$alternativeName
The name of a field to use as an alternative to the name field if that one is empty.
public
string
$alternativeName
= \null
$approximate
Array of fields to search "approximately" (@see config/backends.php).
public
array<string|int, mixed>
$approximate
= array()
$fields
List of all fields that can be accessed in the backend (excludes composite attributes, etc.).
public
array<string|int, mixed>
$fields
= array()
$listNameField
The name of a field to store contact list names in if not the default.
public
string
$listNameField
= \null
$map
Hash describing the mapping between Turba attributes and driver-specific fields.
public
array<string|int, mixed>
$map
= array()
$strict
Array of fields that must match exactly.
public
array<string|int, mixed>
$strict
= array()
$tabs
Hash with all tabs and their fields.
public
array<string|int, mixed>
$tabs
= array()
$title
The symbolic title of this source.
public
string
$title
$_asMap
Mapping of Turba attributes to ActiveSync fields.
protected
static array<string|int, mixed>
$_asMap
= array('name' => 'fileas', 'lastname' => 'lastname', 'firstname' => 'firstname', 'middlenames' => 'middlename', 'nickname' => 'nickname', 'namePrefix' => 'title', 'nameSuffix' => 'suffix', 'homeStreet' => 'homestreet', 'homeCity' => 'homecity', 'homeProvince' => 'homestate', 'homePostalCode' => 'homepostalcode', 'homeCountryFree' => 'homecountry', 'otherStreet' => 'otherstreet', 'otherCity' => 'othercity', 'otherProvince' => 'otherstate', 'otherPostalCode' => 'otherpostalcode', 'otherCountryFree' => 'othercountry', 'workStreet' => 'businessstreet', 'workCity' => 'businesscity', 'workProvince' => 'businessstate', 'workPostalCode' => 'businesspostalcode', 'workCountryFree' => 'businesscountry', 'title' => 'jobtitle', 'company' => 'companyname', 'department' => 'department', 'office' => 'officelocation', 'spouse' => 'spouse', 'website' => 'webpage', 'assistant' => 'assistantname', 'manager' => 'managername', 'yomifirstname' => 'yomifirstname', 'yomilastname' => 'yomilastname', 'imaddress' => 'imaddress', 'imaddress2' => 'imaddress2', 'imaddress3' => 'imaddress3', 'homePhone' => 'homephonenumber', 'homePhone2' => 'home2phonenumber', 'workPhone' => 'businessphonenumber', 'workPhone2' => 'business2phonenumber', 'fax' => 'businessfaxnumber', 'homeFax' => 'homefaxnumber', 'pager' => 'pagernumber', 'cellPhone' => 'mobilephonenumber', 'carPhone' => 'carphonenumber', 'assistPhone' => 'assistnamephonenumber', 'companyPhone' => 'companymainphone', 'radioPhone' => 'radiophonenumber')
$_capabilities
What can this backend do?
protected
array<string|int, mixed>
$_capabilities
= array()
$_contact_owner
Hold the value for the owner of this address book.
protected
string
$_contact_owner
= ''
$_count
Number of contacts in this source.
protected
int
$_count
= \null
$_ds
Handle for the current LDAP connection.
protected
resource
$_ds
= 0
$_name
The internal name of this source.
protected
string
$_name
$_objectOptions
Any additional options passed to Turba_Object constructors.
protected
array<string|int, mixed>
$_objectOptions
= array()
$_params
Hash holding the driver's additional parameters.
protected
array<string|int, mixed>
$_params
= array()
$_syntaxCache
Cache _getSyntax() calls.
protected
array<string|int, mixed>
$_syntaxCache
= array()
Methods
__construct()
Constructs a new Turba LDAP driver object.
public
__construct([string $name = '' ][, array<string|int, mixed> $params = array() ]) : Turba_Driver_Ldap
Parameters
- $name : string = ''
-
The source name
- $params : array<string|int, mixed> = array()
-
Hash containing additional configuration parameters.
Return values
Turba_Driver_Ldap —add()
Adds a new entry to the contact source.
public
add(array<string|int, mixed> $attributes) : string
Parameters
- $attributes : array<string|int, mixed>
-
The attributes of the new object to add.
Tags
Return values
string —The new __key value on success.
canAdd()
Returns ability of the backend to add new contacts.
public
canAdd() : bool
Return values
bool —Can backend add?
checkDefaultShare()
Check if the passed in share is the default share for this source.
public
checkDefaultShare(Horde_Share_Object $share, array<string|int, mixed> $srcconfig) : bool
Parameters
- $share : Horde_Share_Object
-
The share object.
- $srcconfig : array<string|int, mixed>
-
The cfgSource entry for the share.
Return values
bool —TODO
count()
Returns the number of contacts of the current user in this address book.
public
count() : int
Tags
Return values
int —The number of contacts that the user owns.
createShare()
Creates a new Horde_Share for this source type.
public
createShare(string $share_name, array<string|int, mixed> $params) : Horde_Share
Parameters
- $share_name : string
-
The share name
- $params : array<string|int, mixed>
-
The params for the share.
Return values
Horde_Share —The share object.
delete()
Deletes the specified entry from the contact source.
public
delete(string $object_id[, bool $remove_tags = true ]) : mixed
Parameters
- $object_id : string
-
The ID of the object to delete.
- $remove_tags : bool = true
-
Remove tags if true.
Tags
Return values
mixed —deleteAll()
Deletes all contacts from an address book.
public
deleteAll([string $sourceName = null ]) : mixed
Parameters
- $sourceName : string = null
-
The identifier of the address book to delete. If omitted, will clear the current user's 'default' address book for this source type.
Tags
Return values
mixed —fromASContact()
Convert an ActiveSync contact message into a hash suitable for importing via self::add().
public
fromASContact(Horde_ActiveSync_Message_Contact $message) : array<string|int, mixed>
Parameters
- $message : Horde_ActiveSync_Message_Contact
-
The contact message object.
Return values
array<string|int, mixed> —A contact hash.
getBlobs()
Returns the attributes that are blob types.
public
getBlobs() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of blob attributes in the array keys.
getContactOwner()
Return the owner to use when searching or creating contacts in this address book.
public
getContactOwner() : string
Return values
string —Contact owner.
getCriteria()
Returns the criteria available for this source except '__key'.
public
getCriteria() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array containing the criteria.
getDateFields()
Returns the attributes that represent dates.
public
getDateFields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —List of date attributes in the array keys.
getFields()
Returns all non-composite fields for this source. Useful for importing and exporting data, etc.
public
getFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —The field list.
getName()
Return the name of this address book.
public
getName() : mixed
(This is the key into the cfgSources array)
Tags
Return values
mixed —getObject()
Retrieves one object from the source.
public
getObject(string $objectId) : Turba_Object
Parameters
- $objectId : string
-
The unique id of the object to retrieve.
Tags
Return values
Turba_Object —The retrieved object.
getObjects()
Retrieves a set of objects from the source.
public
getObjects(array<string|int, mixed> $objectIds) : array<string|int, mixed>
Parameters
- $objectIds : array<string|int, mixed>
-
The unique ids of the objects to retrieve.
Tags
Return values
array<string|int, mixed> —The array of retrieved objects (Turba_Objects).
getParams()
Returns the current driver's additional parameters.
public
getParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —Hash containing the driver's additional parameters.
getTimeObjectTurbaList()
Default implementation for obtaining a Turba_List to get TimeObjects out of.
public
getTimeObjectTurbaList(Horde_Date $start, Horde_Date $end, string $field) : Turba_List
Parameters
- $start : Horde_Date
-
The starting date.
- $end : Horde_Date
-
The ending date.
- $field : string
-
The address book field containing the timeObject information (birthday, anniversary).
Tags
Return values
Turba_List —A list of objects.
hasCapability()
Checks if this backend has a certain capability.
public
hasCapability(string $capability) : bool
Parameters
- $capability : string
-
The capability to check for.
Return values
bool —Supported or not.
hasPermission()
Checks if the current user has the requested permissions on this address book.
public
hasPermission(int $perm) : bool
Parameters
- $perm : int
-
The permission to check for.
Return values
bool —True if the user has permission, otherwise false.
listTimeObjects()
Returns a list of birthday or anniversary hashes from this source for a certain period.
public
listTimeObjects(Horde_Date $start, Horde_Date $end, string $category) : array<string|int, mixed>
Parameters
- $start : Horde_Date
-
The start date of the valid period.
- $end : Horde_Date
-
The end date of the valid period.
- $category : string
-
The timeObjects category to return.
Tags
Return values
array<string|int, mixed> —A list of timeObject hashes.
makeSearch()
Takes a hash of Turba key => search value and return a (possibly nested) array, using backend attribute names, that can be turned into a search by the driver. The translation is based on the contents of $this->map, and includes nested OR searches for composite fields.
public
makeSearch(array<string|int, mixed> $criteria, string $search_type, array<string|int, mixed> $strict[, bool $match_begin = false ][, array<string|int, mixed> $custom_strict = array() ]) : array<string|int, mixed>
Parameters
- $criteria : array<string|int, mixed>
-
Hash of criteria using Turba keys.
- $search_type : string
-
OR search or AND search?
- $strict : array<string|int, mixed>
-
Fields that must be matched exactly.
- $match_begin : bool = false
-
Whether to match only at beginning of words.
- $custom_strict : array<string|int, mixed> = array()
-
Custom set of fields that are to matched exactly, but are glued using $search_type and 'AND' together with $strict fields. Allows an 'OR' search pm a custom set of $strict fields.
Return values
array<string|int, mixed> —An array of search criteria.
removeUserData()
Remove all entries owned by the specified user.
public
removeUserData(string $user) : mixed
Parameters
- $user : string
-
The user's data to remove.
Tags
Return values
mixed —save()
Modifies an existing entry in the contact source.
public
save(Turba_Object $object) : string
Parameters
- $object : Turba_Object
-
The object to update.
Tags
Return values
string —The object id, possibly updated.
search()
Searches the source based on the provided criteria.
public
search(array<string|int, mixed> $search_criteria[, string $sort_order = null ][, string $search_type = 'AND' ][, array<string|int, mixed> $return_fields = array() ][, array<string|int, mixed> $custom_strict = array() ][, bool $match_begin = false ][, bool $count_only = false ]) : mixed
Parameters
- $search_criteria : array<string|int, mixed>
-
Hash containing the search criteria.
- $sort_order : string = null
-
The requested sort order which is passed to Turba_List::sort().
- $search_type : string = 'AND'
-
Do an AND or an OR search (defaults to AND).
- $return_fields : array<string|int, mixed> = array()
-
A list of fields to return; defaults to all fields.
- $custom_strict : array<string|int, mixed> = array()
-
A list of fields that must match exactly.
- $match_begin : bool = false
-
Whether to match only at beginning of words.
- $count_only : bool = false
-
Only return the count of matching entries, not the entries themselves.
Tags
Return values
mixed —Turba_List|integer The sorted, filtered list of search results or the number of matching entries (if $count_only is true).
searchDuplicates()
Searches the current address book for duplicate entries.
public
searchDuplicates() : array<string|int, mixed>
Duplicates are determined by comparing email and name or last name and first name values.
Tags
Return values
array<string|int, mixed> —A hash with the following format:
array('name' => array('John Doe' => Turba_List, ...), ...)
setContactOwner()
Override the contactOwner setting for this driver.
public
setContactOwner(string $owner) : mixed
Parameters
- $owner : string
-
The contact owner.
Return values
mixed —setDefaultShare()
Runs any actions after setting a new default tasklist.
public
setDefaultShare(string $share) : mixed
Parameters
- $share : string
-
The default share ID.
Return values
mixed —setSourceName()
Override the name setting for this driver.
public
setSourceName(string $name) : mixed
Parameters
- $name : string
-
The source name. This is the key into the $cfgSources array.
Return values
mixed —synchronize()
Synchronize, if needed.
public
synchronize([mixed $token = false ]) : mixed
Parameters
- $token : mixed = false
-
A value indicating the last synchronization point, if available.
Return values
mixed —toASContact()
Convert the contact to an ActiveSync contact message
public
toASContact(Turba_Object $object[, array<string|int, mixed> $options = array() ]) : Horde_ActiveSync_Message_Contact
Parameters
- $object : Turba_Object
-
The turba object to convert
- $options : array<string|int, mixed> = array()
-
Options:
- protocolversion: (float) The EAS version to support DEFAULT: 2.5
- bodyprefs: (array) A BODYPREFERENCE array. DEFAULT: none (No body prefs enforced).
- truncation: (integer) Truncate event body to this length DEFAULT: none (No truncation).
- device: (Horde_ActiveSync_Device) The device object.
Return values
Horde_ActiveSync_Message_Contact —toDriver()
Translates a single Turba attribute to the driver-specific counterpart. The translation is based on the contents of $this->map. This ignores composite fields.
public
toDriver(string $attribute) : string
Parameters
- $attribute : string
-
The Turba attribute to translate.
Return values
string —The driver name for this attribute.
toDriverKeys()
Extends parent function to build composed fields needed for the dn based on the contents of $this->map.
public
toDriverKeys(array<string|int, mixed> $hash) : array<string|int, mixed>
Parameters
- $hash : array<string|int, mixed>
-
Hash using Turba keys.
Return values
array<string|int, mixed> —Translated version of $hash.
toHash()
Function to convert a Horde_Icalendar_Vcard object into a Turba Object Hash with Turba attributes suitable as a parameter for add().
public
toHash(Horde_Icalendar_Vcard $vcard) : array<string|int, mixed>
Parameters
- $vcard : Horde_Icalendar_Vcard
-
The Horde_Icalendar_Vcard object to parse.
Tags
Return values
array<string|int, mixed> —A Turba attribute hash.
toTurbaKeys()
Translates a hash from being keyed on driver-specific fields to being keyed on the generalized Turba attributes. The translation is based on the contents of $this->map.
public
toTurbaKeys(array<string|int, mixed> $entry) : array<string|int, mixed>
Parameters
- $entry : array<string|int, mixed>
-
A hash using driver-specific keys.
Return values
array<string|int, mixed> —Translated version of $entry.
tovCard()
Exports a given Turba_Object as an iCalendar vCard.
public
tovCard(Turba_Object $object[, string $version = '2.1' ][, array<string|int, mixed> $fields = null ][, bool $skipEmpty = false ]) : Horde_Icalendar_Vcard
Parameters
- $object : Turba_Object
-
Turba_Object.
- $version : string = '2.1'
-
The vcard version to produce.
- $fields : array<string|int, mixed> = null
-
Hash of field names and Horde_SyncMl_Property properties with the requested fields.
- $skipEmpty : bool = false
-
Whether to skip empty fields.
Return values
Horde_Icalendar_Vcard —A vcard object.
_add()
Adds the specified contact to the addressbook.
protected
_add(array<string|int, mixed> $attributes[, array<string|int, mixed> $blob_fields = array() ][, array<string|int, mixed> $date_fields = array() ]) : mixed
Parameters
- $attributes : array<string|int, mixed>
-
The attribute values of the contact.
- $blob_fields : array<string|int, mixed> = array()
-
Fields that represent binary data.
- $date_fields : array<string|int, mixed> = array()
-
Fields that represent dates. @since 4.2.0
Tags
Return values
mixed —_buildSearchQuery()
Build a piece of a search query.
protected
_buildSearchQuery(array<string|int, mixed> $criteria) : string
Parameters
- $criteria : array<string|int, mixed>
-
The array of criteria.
Return values
string —An LDAP query fragment.
_canAdd()
TODO
protected
_canAdd() : bool
Return values
bool —TODO
_checkRequiredAttributes()
Returns a list of required attributes.
protected
_checkRequiredAttributes(array<string|int, mixed> $objectclasses) : array<string|int, mixed>
Parameters
- $objectclasses : array<string|int, mixed>
-
List of objectclasses that should be checked for required attributes.
Tags
Return values
array<string|int, mixed> —List of attribute names of the specified objectclasses that have been configured as being required.
_connect()
Initiate LDAP connection.
protected
_connect() : mixed
Not done in __construct(), only when a read or write action is necessary.
Return values
mixed —_convertParameters()
Converts Turba connection parameter so Horde_Ldap parameters.
protected
_convertParameters(array<string|int, mixed> $in) : array<string|int, mixed>
Parameters
- $in : array<string|int, mixed>
-
Turba parameters.
Return values
array<string|int, mixed> —Horde_Ldap parameters.
_delete()
Deletes the specified entry from the LDAP directory.
protected
_delete(string $object_key, string $object_id) : mixed
Parameters
- $object_key : string
- $object_id : string
Tags
Return values
mixed —_deleteAll()
Deletes all contacts from an address book.
protected
_deleteAll() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of UIDs that have been deleted.
_emptyAttributeFilter()
Remove empty attributes from attributes array.
protected
_emptyAttributeFilter(mixed $var) : bool
Parameters
- $var : mixed
Return values
bool —Boolean used by array_filter.
_encodeAttributes()
Format and encode attributes including postal addresses, character set encoding, etc.
protected
_encodeAttributes(array<string|int, mixed> &$attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
-
The attributes array.
Return values
mixed —_filterTags()
Returns a Turba_List object containing $objects filtered by $tags.
protected
_filterTags(array<string|int, mixed> $objects, array<string|int, mixed> $tags[, array<string|int, mixed> $sort_order = null ]) : Turba_List
Parameters
- $objects : array<string|int, mixed>
-
A hash of objects, as returned by self::_search.
- $tags : array<string|int, mixed>
-
An array of tags to filter by.
- $sort_order : array<string|int, mixed> = null
-
The sort order to pass to Turba_List::sort.
Return values
Turba_List —The filtered Turba_List object.
_getContactOwner()
Return the owner to use when searching or creating contacts in this address book.
protected
_getContactOwner() : string
Return values
string —Contact owner.
_getResults()
Get some results from a result identifier and clean them up.
protected
_getResults(array<string|int, mixed> $fields, resource $res) : array<string|int, mixed>
Parameters
- $fields : array<string|int, mixed>
-
List of fields to return.
- $res : resource
-
Result identifier.
Tags
Return values
array<string|int, mixed> —Hash containing the results.
_getSyntax()
Returns the syntax of an attribute, if necessary recursively.
protected
_getSyntax(string $att) : string
Parameters
- $att : string
-
Attribute name.
Tags
Return values
string —Attribute syntax.
_getTimeObjectTurbaListFallback()
Default implementation for obtaining a Turba_List to get TimeObjects out of.
protected
_getTimeObjectTurbaListFallback(Horde_Date $start, Horde_Date $end, string $field) : Turba_List
Parameters
- $start : Horde_Date
-
The starting date.
- $end : Horde_Date
-
The ending date.
- $field : string
-
The address book field containing the timeObject information (birthday, anniversary).
Tags
Return values
Turba_List —A list of objects.
_guessName()
Helper function for guessing name parts from a single name string.
protected
_guessName(array<string|int, mixed> &$hash) : mixed
Parameters
- $hash : array<string|int, mixed>
-
The attributes array.
Return values
mixed —_hasValEnum()
Returns whether a ValEnum entry from a DevInf object contains a certain type.
protected
_hasValEnum(array<string|int, mixed> $valEnum, string $type) : bool
Parameters
- $valEnum : array<string|int, mixed>
-
A ValEnum hash.
- $type : string
-
A requested attribute type.
Return values
bool —True if $type exists in $valEnum.
_init()
Initialize the driver.
protected
_init() : mixed
Tags
Return values
mixed —_isPostalAddress()
Checks if an attribute refers to a Postal Address.
protected
_isPostalAddress(string $attribute) : bool
Parameters
- $attribute : string
-
An attribute name.
Return values
bool —True if the specified attribute refers to a Postal Address.
_isString()
Checks if an attribute refers to a string.
protected
_isString(string $attribute) : bool
Parameters
- $attribute : string
-
An attribute name.
Return values
bool —True if the specified attribute refers to a string.
_makeKey()
Build a DN based on a set of attributes and what attributes make a DN for the current source.
protected
_makeKey(array<string|int, mixed> $attributes) : string
Parameters
- $attributes : array<string|int, mixed>
-
The attributes (in driver keys) of the object being added.
Return values
string —The DN for the new object.
_makeRDN()
Build a RDN based on a set of attributes and what attributes make a RDN for the current source.
protected
_makeRDN(array<string|int, mixed> $attributes) : string
Parameters
- $attributes : array<string|int, mixed>
-
The attributes (in driver keys) of the object being added.
Return values
string —The RDN for the new object.
_makeRDNhelper()
Helper function for _makeRDN().
protected
_makeRDNhelper(array<string|int, mixed> $attributes, array<string|int, mixed> $dn) : string
Recursively builds the (possibly nested) attribute-value array to build a DN. Nested arrays will be joined with the '+' character, see Horde_Ldap::quoteDN().
Parameters
- $attributes : array<string|int, mixed>
-
The attributes (in driver keys) of the object being added.
- $dn : array<string|int, mixed>
-
The array describing how the DN should be built.
Return values
string —The array to be passed to Horde_Ldap::quoteDN().
_makeUid()
Creates an object UID for a new object.
protected
_makeUid() : string
Return values
string —A unique ID for the new object.
_parseName()
Checks $hash for the presence of a 'name' attribute. If not found, attempt to build one from other available values.
protected
_parseName(array<string|int, mixed> $hash) : array<string|int, mixed>
Parameters
- $hash : array<string|int, mixed>
-
A hash of turba attributes.
Return values
array<string|int, mixed> —Hash of Turba attributes, with the 'name' attribute populated.
_read()
Reads the LDAP directory for a given element and returns the results.
protected
_read(string $key, mixed $ids, string $owner, array<string|int, mixed> $fields[, array<string|int, mixed> $blobFields = array() ][, array<string|int, mixed> $dateFields = array() ]) : array<string|int, mixed>
Parameters
- $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<string|int, mixed>
-
List of fields to return.
- $blobFields : array<string|int, mixed> = array()
-
Array of fields containing binary data.
- $dateFields : array<string|int, mixed> = array()
-
Array of fields containing date data. @since 4.2.0
Tags
Return values
array<string|int, mixed> —Hash containing the search results.
_save()
Modifies the specified entry in the LDAP directory.
protected
_save(Turba_Object $object) : string
Parameters
- $object : Turba_Object
-
The object we wish to save.
Tags
Return values
string —The object id, possibly updated.
_search()
Searches the LDAP directory with the given criteria and returns a filtered list of results. If no criteria are specified, all records are returned.
protected
_search(array<string|int, mixed> $criteria, array<string|int, mixed> $fields[, array<string|int, mixed> $blobFields = array() ][, mixed $count_only = false ]) : array<string|int, mixed>
Parameters
- $criteria : array<string|int, mixed>
-
Array containing the search criteria.
- $fields : array<string|int, mixed>
-
List of fields to return.
- $blobFields : array<string|int, mixed> = array()
-
Fields that contain binary data.
- $count_only : mixed = false
-
Only return the count of matching entries, not the entries themselves.
Tags
Return values
array<string|int, mixed> —Hash containing the search results.
_toTurbaObjects()
Takes an array of object hashes and returns a Turba_List containing the correct Turba_Objects
protected
_toTurbaObjects(array<string|int, mixed> $objects[, array<string|int, mixed> $sort_order = null ]) : Turba_List
Parameters
- $objects : array<string|int, mixed>
-
An array of object hashes (keyed to backend).
- $sort_order : array<string|int, mixed> = null
-
Array of hashes describing sort fields. Each hash has the following fields:
ascending - (boolean) Indicating sort direction. field - (string) Sort field.
Return values
Turba_List —A list object.