PHP Class Turba_Driver_Imsp, 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: Michael Rubinsky ([email protected])
Inheritance: extends Turba_Driver
Show file Open project: horde/horde

Protected Properties

Property Type Description
$_authenticated boolean Holds if we are authenticated.
$_bookName string The name of the addressbook.
$_capabilities array Driver capabilities.
$_groupField string Holds name of the field indicating an IMSP group.
$_groupValue string Holds value that $_groupField will have if entry is an IMSP group.
$_imsp Horde_Imsp Horde_Imsp object
$_noGroups boolean Used to set if the current search is for contacts only.

Public Methods

Method Description
__construct ( string $name = '', array $params = [] ) Constructs a new Turba imsp driver object.
_sendSearch ( array $criteria ) : array Sends a search request to the server.
checkDefaultShare ( $share, $srcConfig ) : TODO Check if the passed in share is the default share for this source.
createShare ( $share_id, $params ) : Horde_Share Creates a new Horde_Share and creates the address book on the IMSP server.
hasPermission ( integer $perm ) : boolean Checks if the current user has the requested permission on this source.

Protected Methods

Method Description
_aclToHordePerms ( string $acl ) : integer Converts an acl string to a Horde Permissions bitmask.
_add ( array $attributes, array $blob_fields = [], array $date_fields = [] ) Adds the specified contact to the addressbook.
_canAdd ( ) TODO
_countDelimiters ( string $in ) : integer Helper function to count the occurances of the ':' * delimiter in group member entries.
_delete ( $object_key, $object_id ) Deletes the specified object from the IMSP server.
_deleteAll ( ) Deletes the address book represented by this driver from the IMSP server.
_doSearch ( array $criteria, string $glue ) : array Parses the search criteria, requests the individual searches from the server and performs any necessary ANDs / ORs on the results.
_getContactOwner ( ) : string Returns the owner for this contact. For an IMSP source, this should be the name of the address book.
_getDuplicated ( array $names ) : array Returns only those names that are duplicated in $names
_getGroupEmails ( string $emailText ) : array Parses out $emailText into an array of pure email addresses suitable for searching the IMSP datastore with.
_makeKey ( array $attributes ) : string Create an object key for a new object.
_read ( string $key, mixed $ids, string $owner, array $fields, array $blobFields = [] ) : array Reads the given data from the address book and returns the results.
_removeDuplicated ( array $names ) : array Returns an array with all duplicate names removed.
_save ( Turba_Object $object ) : string Saves the specified object to the IMSP server.
_search ( array $criteria, array $fields, array $blobFields = [], $count_only = false ) : array Returns all entries matching $critera.

Method Details

__construct() public method

Constructs a new Turba imsp driver object.
public __construct ( string $name = '', array $params = [] )
$name string Source name
$params array Hash containing additional configuration parameters.

_aclToHordePerms() protected method

Converts an acl string to a Horde Permissions bitmask.
protected _aclToHordePerms ( string $acl ) : integer
$acl string A standard, IMAP style acl string.
return integer Horde Permissions bitmask.

_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

_canAdd() protected method

TODO
protected _canAdd ( )

_countDelimiters() protected method

Helper function to count the occurances of the ':' * delimiter in group member entries.
protected _countDelimiters ( string $in ) : integer
$in string The group member entry.
return integer The number of ':' in $in.

_delete() protected method

Deletes the specified object from the IMSP server.
protected _delete ( $object_key, $object_id )

_deleteAll() protected method

Deletes the address book represented by this driver from the IMSP server.
protected _deleteAll ( )

_doSearch() protected method

Parses the search criteria, requests the individual searches from the server and performs any necessary ANDs / ORs on the results.
protected _doSearch ( array $criteria, string $glue ) : array
$criteria array Array containing the search criteria.
$glue string Type of search to perform (AND / OR).
return array Array containing contact names that match $criteria.

_getContactOwner() protected method

Returns the owner for this contact. For an IMSP source, this should be the name of the address book.
protected _getContactOwner ( ) : string
return string TODO

_getDuplicated() protected method

Returns only those names that are duplicated in $names
protected _getDuplicated ( array $names ) : array
$names array A nested array of arrays containing names
return array Array containing the 'AND' of all arrays in $names

_getGroupEmails() protected method

Parses out $emailText into an array of pure email addresses suitable for searching the IMSP datastore with.
protected _getGroupEmails ( string $emailText ) : array
$emailText string Single string containing email addressses.
return array Pure email address.

_makeKey() protected method

Create an object key for a new object.
protected _makeKey ( array $attributes ) : string
$attributes array The attributes (in driver keys) of the object being added.
return string A unique ID for the new object.

_read() protected method

Reads the given data from the address book and returns the results.
protected _read ( string $key, mixed $ids, string $owner, array $fields, array $blobFields = [] ) : array
$key string The primary key field to use (always 'name' for IMSP).
$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.
return array Hash containing the search results.

_removeDuplicated() protected method

Returns an array with all duplicate names removed.
protected _removeDuplicated ( array $names ) : array
$names array Nested array of arrays containing names.
return array Array containg the 'OR' of all arrays in $names.

_save() protected method

Saves the specified object to the IMSP server.
protected _save ( Turba_Object $object ) : string
$object Turba_Object The object to save/update.
return string The object id, possibly updated.

_sendSearch() public method

Sends a search request to the server.
public _sendSearch ( array $criteria ) : array
$criteria array Array containing the search critera.
return array Array containing a list of names that match the search.

checkDefaultShare() public method

Check if the passed in share is the default share for this source.
public checkDefaultShare ( $share, $srcConfig ) : TODO
return TODO

createShare() public method

Creates a new Horde_Share and creates the address book on the IMSP server.
public createShare ( $share_id, $params ) : Horde_Share
return Horde_Share The share object.

hasPermission() public method

Checks if the current user has the requested permission on this source.
public hasPermission ( integer $perm ) : boolean
$perm integer The permission to check for.
return boolean true if user has permission, false otherwise.

Property Details

$_authenticated protected property

Holds if we are authenticated.
protected bool $_authenticated
return boolean

$_bookName protected property

The name of the addressbook.
protected string $_bookName
return string

$_capabilities protected property

Driver capabilities.
protected array $_capabilities
return array

$_groupField protected property

Holds name of the field indicating an IMSP group.
protected string $_groupField
return string

$_groupValue protected property

Holds value that $_groupField will have if entry is an IMSP group.
protected string $_groupValue
return string

$_imsp protected property

Horde_Imsp object
protected Horde_Imsp $_imsp
return Horde_Imsp

$_noGroups protected property

Used to set if the current search is for contacts only.
protected bool $_noGroups
return boolean