\Horde_Kolab_Server_Connection_Mock_Ldap

This class provides a class for testing the Kolab Server DB.

Copyright 2008-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
__construct()
bind()
getEntry()
search()
getEntries()
parse()
parseSub()
doSearch()
add()
modify()
delete()
move()
schema()
No public properties found
No constants found
toStorage()
No protected properties found
N/A
_checkBound()
$_params
$_data
$_bound
N/A

Properties

$_params

$_params : array

Connection parameters.

Type

array

$_data

$_data : array

The current database data.

Type

array

$_bound

$_bound : boolean

Is the connection bound via username / password?

Type

boolean

Methods

__construct()

__construct(array  $params, array  $data) 

Constructor.

Parameters

array $params

Connection parameters.

array $data

Mockup LDAP data.

bind()

bind(string  $dn = '', string  $pw = '') : NULL

Binds the LDAP connection with a specific user and pass.

Parameters

string $dn

DN to bind with

string $pw

Password associated to this DN.

Throws

\Horde_Kolab_Server_Exception

If the user does not exit, he has no password, provided an incorrect password or anonymous binding is not allowed.

Returns

NULL

getEntry()

getEntry(string  $dn, array  $attr = array()) : \Horde_Ldap_Entry|\Horde_Ldap_Error

Get a specific entry based on the DN

Parameters

string $dn

DN of the entry that should be fetched

array $attr

Array of Attributes to select. If ommitted, all attributes are fetched.

Returns

\Horde_Ldap_Entry|\Horde_Ldap_Error —

Reference to a Horde_Ldap_Entry object or Horde_Ldap_Error object

search()

search(string  $base = null, string  $filter = null, string  $params = array()) : array

Search for object data.

Parameters

string $base

The search base

string $filter

The LDAP search filter.

string $params

Additional search parameters.

Throws

\Horde_Kolab_Server_Exception

If the search operation encountered a problem.

Returns

array —

The result array.

getEntries()

getEntries(array  $result) : mixed

Return the entries of a result.

Parameters

array $result

The LDAP search result.

Returns

mixed —

The entries of the result or false.

parse()

parse(string  $filter) : array

Parse LDAP filter.

Partially derived from Net_LDAP_Filter.

Parameters

string $filter

The filter string.

Throws

\Horde_Kolab_Server_Exception

If parsing the filter expression fails.

Returns

array —

An array of the parsed filter.

parseSub()

parseSub(string  $filter) : array

Parse a LDAP subfilter.

Parameters

string $filter

The subfilter string.

Throws

\Horde_Kolab_Server_Exception

Returns

array —

An array of the parsed subfilter.

doSearch()

doSearch(array  $filter, array  $attributes = null) : array

Perform the search.

Parameters

array $filter

Filter criteria-

array $attributes

Restrict the search result to these attributes.

Throws

\Horde_Kolab_Server_Exception

If the search operation is not available.

Returns

array —

A LDAP serach result.

add()

add(\Horde_Ldap_Entry  $entry) : \Horde_Ldap_Error|true

Add a new entryobject to a directory.

Parameters

\Horde_Ldap_Entry $entry

Horde_Ldap_Entry

Returns

\Horde_Ldap_Error|true —

Horde_Ldap_Error object or true

modify()

modify(  $entry,   $data = array()) : \Horde_Ldap_Error|true

Modify an ldapentry directly on the server

Parameters

$entry
$data

Returns

\Horde_Ldap_Error|true —

Horde_Ldap_Error object or true

delete()

delete(string  $uid) : NULL

Delete an object.

Parameters

string $uid

The UID of the object to be deleted.

Throws

\Horde_Kolab_Server_Exception

Returns

NULL

move()

move(string  $uid, string  $new) : NULL

Rename an object.

Parameters

string $uid

The UID of the object to be renamed.

string $new

The new UID of the object.

Throws

\Horde_Kolab_Server_Exception

Returns

NULL

schema()

schema() 

toStorage()

toStorage(array  $data) : array

Rewrite a data array to our internal storage format.

Parameters

array $data

The attributes of the object to be added/replaced.

Returns

array —

The transformed data set.

_checkBound()

_checkBound() : NULL

Check if the current connection is bound.

Throws

\Horde_Kolab_Server_Exception

If the connection is not bound.

Returns

NULL