\Shout_Driver_Ldap

Provides the LDAP backend driver for the Shout application.

Copyright 2005-2010 Alkaloid Networks LLC (http://projects.alkaloid.net)

See the enclosed file LICENSE for license information (BSD). If you did not receive this file, see http://www.opensource.org/licenses/bsd-license.php.

Summary

Methods
Properties
Constants
__construct()
getAccounts()
checkAccountType()
getUsers()
getHomeAccount()
getAccountProperties()
getDialplan()
saveExtension()
deleteExtension()
saveDevice()
deleteDevice()
factory()
getExtensions()
addDestination()
getDestinations()
deleteDestination()
$_params
$_ldapKey
$_appKey
No constants found
_getDestAttr()
_getExtensionDn()
_connect()
No protected properties found
N/A
No private methods found
$_LDAP
$_connected
N/A

Properties

$_params

$_params : array

Hash containing connection parameters.

Type

array

$_ldapKey

$_ldapKey : 

Type

$_appKey

$_appKey : 

Type

$_LDAP

$_LDAP : object

Handle for the current database connection.

Type

object — LDAP $_LDAP

$_connected

$_connected : boolean

Boolean indicating whether or not we're connected to the LDAP server.

Type

boolean

Methods

__construct()

__construct(array  $params = array()) 

Constructs a new Shout LDAP driver object.

Parameters

array $params

A hash containing connection parameters.

getAccounts()

getAccounts(  $filters = "all",   $filterperms = null) : array

Get a list of accounts from the instantiated driver and filter the returned accounts for those which the current user can see/edit

Parameters

$filters
$filterperms

Returns

array —

Accounts valid for this user

checkAccountType()

checkAccountType(string  $account, string  $type) : boolean

For the given account and type, make sure the account has the appropriate properties, that it is effectively of that "type"

Parameters

string $account

the account to check type for

string $type

the type to verify the account is of

Returns

boolean —

true of the account is of type, false if not

getUsers()

getUsers(string  $account) : array

Get a list of users valid for the current account. Return an array indexed by the extension.

Parameters

string $account

Account for which users should be returned

Returns

array —

User information indexed by voice mailbox number

getHomeAccount()

getHomeAccount() : string

Returns the name of the user's default account

Returns

string —

User's default account

getAccountProperties()

getAccountProperties(string  $account) : integer

Get a account's properties

Parameters

string $account

Account for which to get properties

Returns

integer —

Bitfield of properties valid for this account

getDialplan()

getDialplan(string  $account) : array

Get a account's extensions and return as a multi-dimensional associative array

Parameters

string $account

account to return extensions for

Returns

array —

Multi-dimensional associative array of extensions data

saveExtension()

saveExtension(string  $account, string  $extension, array  $details) : TRUE

Save an extension to the LDAP tree

This method is intended to be overridden by a child class. However it also implements some basic checks, so a typical backend will still call this method via parent::

Parameters

string $account

Account to which the user should be added

string $extension

Extension to be saved

array $details

Phone numbers, PIN, options, etc to be saved

Throws

\Shout_Exception

Returns

TRUE —

on success, PEAR::Error object on error

deleteExtension()

deleteExtension(string  $account, string  $extension) : boolean

Deletes an extension from the LDAP tree

Parameters

string $account

Account to delete the user from

string $extension

Extension of the user to be deleted

Returns

boolean —

True on success, PEAR::Error object on error

saveDevice()

saveDevice(string  $account,   $devid, array  $details) : TRUE

Save a device to the backend.

This method is intended to be overridden by a child class. However it also implements some basic checks, so a typical backend will still call this method via parent::

Parameters

string $account

Account to which the user should be added

$devid
array $details

Phone numbers, PIN, options, etc to be saved

Throws

\Shout_Exception

Returns

TRUE —

on success, PEAR::Error object on error

deleteDevice()

deleteDevice(\<type>  $account, \<type>  $devid) 

Delete a device from the backend.

This method is intended to be overridden by a child class. However it also implements some basic checks, so a typical backend will still call this method via parent::

Parameters

\ $account
\ $devid

factory()

factory(  $class, string  $driver = null, array  $params = null) : mixed

Attempts to return a concrete Shout_Driver instance based on $driver.

Parameters

$class
string $driver

The type of the concrete Shout_Driver subclass to return. The class name is based on the storage driver ($driver). The code is dynamically included.

array $params

(optional) A hash containing any additional configuration or connection parameters a subclass might need.

Returns

mixed —

The newly created concrete Shout_Driver instance, or false on an error.

getExtensions()

getExtensions(string  $account) : array

Get a list of users valid for the accounts

Parameters

string $account

Account in which to search

Returns

array —

User information indexed by voice mailbox number

addDestination()

addDestination(string  $account, string  $extension, string  $type, string  $destination) : boolean

Add a new destination valid for this extension.

A destination is either a telephone number or a VoIP device.

Parameters

string $account

Account for the extension

string $extension

Extension for which to return destinations

string $type

Destination type ("device" or "number")

string $destination

The destination itself

Returns

boolean —

True on success.

getDestinations()

getDestinations(string  $account, string  $extension) 

Get a list of destinations valid for this extension.

A destination is either a telephone number or a VoIP device.

Parameters

string $account

Account for the extension

string $extension

Extension for which to return destinations

deleteDestination()

deleteDestination(  $account,   $extension,   $type,   $destination) 

Parameters

$account
$extension
$type
$destination

_getDestAttr()

_getDestAttr(  $type,   $destination) 

Parameters

$type
$destination

_getExtensionDn()

_getExtensionDn(\<type>  $account, \<type>  $extension) 

Parameters

\ $account
\ $extension

_connect()

_connect() : boolean

Attempts to open a connection to the LDAP server.

Throws

\Shout_Exception

Returns

boolean —

True on success.