PHP Class Vilma_Driver, horde

See the enclosed file LICENSE for license information (BSD). If you did not did not receive this file, see http://www.horde.org/licenses/bsd.
Author: Marko Djukic ([email protected])
Author: Daniel Collins ([email protected])
Mostra file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_params array A hash containing any parameters for the current driver.

Public Methods

Method Description
__construct ( array $params ) Constructor.
deleteAlias ( array $info ) Deletes alias records for a given user.
deleteDomain ( integer $domain_id ) Deletes a domain and all the users and virtuals within it.
deleteForward ( array $info ) Deletes forward records for a given user.
deleteUser ( integer $user_id ) Deletes a user.
deleteVirtual ( integer $virtual_id ) Deletes a virtual email.
factory ( string $driver = null, array $params = null ) : Vilma_Driver Attempts to return a concrete Vilma_Driver instance based on $driver.
getAddressInfo ( string $address, string $type = 'all' ) : array Returns an array of information related to the address passed in.
getAddresses ( string $domain, string $type = 'all', string $key = 'user_name', integer $direction ) : array Returns a list of all users, aliases, or groups and forwards for a domain.
getAllUsers ( ) : array Returns all the users sorted by domain and as arrays of each domain.
getDomain ( integer $domain_id ) : array Returns the specified domain information from the backend.
getDomainAdmin ( string $domain_name ) : string Returns the user who is the domain administrator.
getDomainByName ( $domain_name ) : array Given a domain name returns the information from the backend.
getDomainMaxUsers ( string $domain_name ) : integer Returns the maximum number of users allowed for a given domain.
getDomainNumUsers ( string $domain_name ) : integer Returns the current number of users for a domain.
getDomainQuota ( string $domain_name ) : integer Returns the configured quota for this domain.
getDomains ( ) : array Returns the list of domains from the backend.
getUser ( integer $user_id ) : array Returns the user information for a given user id.
getUserFormAttributes ( )
getUserStatus ( array $user ) : array Does a series of checks for a given user to determine the status.
getUsers ( string $domain = null ) : array Returns all available users, if a domain name is passed then limit the list of users only to those users.
getVirtual ( integer $virtual_id ) : array Returns information for a virtual id.
getVirtuals ( string $filter ) : array Returns available virtual emails.
isBelowMaxUsers ( string $domain ) : boolean Checks if the given domain is below the maximum allowed users.
saveAlias ( array $info ) Saves or creates alias records for a user.
saveDomain ( array $info ) Saves a domain with the provided information.
saveForward ( array $info ) Saves or creates forward records for a given user.
saveUser ( $info )
saveVirtual ( array $info, string $domain ) Saves virtual email address to the backend.

Protected Methods

Method Description
_deleteDomain ( integer $domain_id ) Deletes a domain.
_getAddresses ( string $domain, string $type = 'all' ) : array Returns a list of all users, aliases, or groups and forwards for a domain.
_saveDomain ( array $info ) Saves a domain with the provided information.
_saveUser ( array $info ) : string Saves a user to the backend.

Method Details

__construct() public method

Constructor.
public __construct ( array $params )
$params array Any parameters needed for this driver.

_deleteDomain() abstract protected method

Deletes a domain.
abstract protected _deleteDomain ( integer $domain_id )
$domain_id integer The id of the domain to delete.

_getAddresses() abstract protected method

Returns a list of all users, aliases, or groups and forwards for a domain.
abstract protected _getAddresses ( string $domain, string $type = 'all' ) : array
$domain string Domain on which to search.
$type string Only return a specific type. One of 'all', 'user', 'alias','forward', or 'group'.
return array Account information for this domain.

_saveDomain() abstract protected method

Saves a domain with the provided information.
abstract protected _saveDomain ( array $info )
$info array Array of details to save the domain.

_saveUser() abstract protected method

Saves a user to the backend.
abstract protected _saveUser ( array $info ) : string
$info array The user information to save.
return string The user ID.

deleteAlias() public method

Deletes alias records for a given user.
public deleteAlias ( array $info )
$info array The info used to store the information. Required fields are: - 'address': The destination address (used for LDAP ID lookup). - 'alias': The alias we are deleting.

deleteDomain() public method

Deletes a domain and all the users and virtuals within it.
public deleteDomain ( integer $domain_id )
$domain_id integer The id of the domain to delete.

deleteForward() public method

Deletes forward records for a given user.
public deleteForward ( array $info )
$info array The info used to store the information. Required fields are: - 'address': The destination address (used for LDAP ID lookup). - 'forward': The forward we are deleting.

deleteUser() abstract public method

Deletes a user.
abstract public deleteUser ( integer $user_id )
$user_id integer The id of the user to delete.

deleteVirtual() public method

Deletes a virtual email.
public deleteVirtual ( integer $virtual_id )
$virtual_id integer The id of the virtual email to delete.

factory() public static method

Attempts to return a concrete Vilma_Driver instance based on $driver.
public static factory ( string $driver = null, array $params = null ) : Vilma_Driver
$driver string The type of concrete Vilma_Driver subclass to return.
$params array A hash containing any additional configuration or connection parameters a subclass might need.
return Vilma_Driver The newly created concrete Vilma_Driver instance.

getAddressInfo() public method

This method may be overridden by the backend driver if there is a more efficient way to do this than a linear array search.
public getAddressInfo ( string $address, string $type = 'all' ) : array
$address string Address for which information will be pulled.
$type string Address type to request. One of 'all', 'user', 'alias', 'forward' or 'group'.
return array Array of user information on success or empty array if the user does not exist.

getAddresses() public method

Returns a list of all users, aliases, or groups and forwards for a domain.
public getAddresses ( string $domain, string $type = 'all', string $key = 'user_name', integer $direction ) : array
$domain string Domain on which to search.
$type string Only return a specific type. One of 'all', 'user', 'alias', 'forward', or 'group'.
$key string Sort list by this key.
$direction integer Sort direction.
return array Account information for this domain.

getAllUsers() public method

Returns all the users sorted by domain and as arrays of each domain.
public getAllUsers ( ) : array
return array An array of domains then users for each domain.

getDomain() abstract public method

Returns the specified domain information from the backend.
abstract public getDomain ( integer $domain_id ) : array
$domain_id integer The id of the domain to fetch.
return array The domain's information in an array.

getDomainAdmin() public method

Returns the user who is the domain administrator.
public getDomainAdmin ( string $domain_name ) : string
$domain_name string The name of the domain for which to return the administrator.
return string The domain administrator.

getDomainByName() abstract public method

Given a domain name returns the information from the backend.
abstract public getDomainByName ( $domain_name ) : array
return array The domain's information in an array.

getDomainMaxUsers() public method

Returns the maximum number of users allowed for a given domain.
public getDomainMaxUsers ( string $domain_name ) : integer
$domain_name string The name of the domain for which to return the maximum users.
return integer The maximum number of allowed users.

getDomainNumUsers() abstract public method

Returns the current number of users for a domain.
abstract public getDomainNumUsers ( string $domain_name ) : integer
$domain_name string The name of the domain for which to get the current number of users.
return integer The current number of users.

getDomainQuota() public method

Returns the configured quota for this domain.
public getDomainQuota ( string $domain_name ) : integer
$domain_name string The name of the domain for which to return the quota.
return integer The domain quota.

getDomains() abstract public method

Returns the list of domains from the backend.
abstract public getDomains ( ) : array
return array All the domains and their data in an array.

getUser() abstract public method

Returns the user information for a given user id.
abstract public getUser ( integer $user_id ) : array
$user_id integer The id of the user for which to fetch information.
return array The user information.

getUserFormAttributes() public method

getUserStatus() public method

Does a series of checks for a given user to determine the status.
public getUserStatus ( array $user ) : array
$user array The user's details in an array as returned by the getUser() function.
return array Either an array of error messages found during the checks or an array with a single element stating that the user is ready.

getUsers() abstract public method

Returns all available users, if a domain name is passed then limit the list of users only to those users.
abstract public getUsers ( string $domain = null ) : array
$domain string The name of the domain for which to fetch the users.
return array The available users and their stored information.

getVirtual() public method

Returns information for a virtual id.
public getVirtual ( integer $virtual_id ) : array
$virtual_id integer The virtual id for which to return information.
return array The virtual email information.

getVirtuals() public method

Returns available virtual emails.
public getVirtuals ( string $filter ) : array
$filter string If passed a domain then return all virtual emails for the domain, otherwise if passed a user name return all virtual emails for that user.
return array The available virtual emails.

isBelowMaxUsers() public method

Checks if the given domain is below the maximum allowed users.
public isBelowMaxUsers ( string $domain ) : boolean
$domain string The domain name to check.
return boolean True if the domain does not have a maximum limit (0) or current number of users is below the maximum number allowed.

saveAlias() public method

Saves or creates alias records for a user.
public saveAlias ( array $info )
$info array The info used to store the information. Required fields are: - 'address': The destination address (used for LDAP ID lookup). - 'alias_address': The alias to create or the new data for the modified entry. - 'alias': The alias we are modifying, if we are modifying an existing one.

saveDomain() public method

Saves a domain with the provided information.
public saveDomain ( array $info )
$info array Array of details to save the domain.

saveForward() public method

Saves or creates forward records for a given user.
public saveForward ( array $info )
$info array The info used to store the information. Required fields are: - 'address': The destination address (used for LDAP ID lookup). - 'forward_address': The forward to create or the new data for the modified entry. - 'forward': The forward we are modifying, if we are modifying an existing one.

saveUser() public method

public saveUser ( $info )

saveVirtual() public method

Saves virtual email address to the backend.
public saveVirtual ( array $info, string $domain )
$info array The virtual email data.
$domain string The name of the domain for this virtual email.

Property Details

$_params protected_oe property

A hash containing any parameters for the current driver.
protected array $_params
return array