PHP Класс 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.
Автор: Marko Djukic ([email protected])
Автор: Daniel Collins ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_params array A hash containing any parameters for the current driver.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
_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.

Описание методов

__construct() публичный Метод

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

_deleteDomain() абстрактный защищенный Метод

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

_getAddresses() абстрактный защищенный Метод

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'.
Результат array Account information for this domain.

_saveDomain() абстрактный защищенный Метод

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

_saveUser() абстрактный защищенный Метод

Saves a user to the backend.
abstract protected _saveUser ( array $info ) : string
$info array The user information to save.
Результат string The user ID.

deleteAlias() публичный Метод

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() публичный Метод

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() публичный Метод

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() абстрактный публичный Метод

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

deleteVirtual() публичный Метод

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

factory() публичный статический Метод

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.
Результат Vilma_Driver The newly created concrete Vilma_Driver instance.

getAddressInfo() публичный Метод

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'.
Результат array Array of user information on success or empty array if the user does not exist.

getAddresses() публичный Метод

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.
Результат array Account information for this domain.

getAllUsers() публичный Метод

Returns all the users sorted by domain and as arrays of each domain.
public getAllUsers ( ) : array
Результат array An array of domains then users for each domain.

getDomain() абстрактный публичный Метод

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.
Результат array The domain's information in an array.

getDomainAdmin() публичный Метод

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.
Результат string The domain administrator.

getDomainByName() абстрактный публичный Метод

Given a domain name returns the information from the backend.
abstract public getDomainByName ( $domain_name ) : array
Результат array The domain's information in an array.

getDomainMaxUsers() публичный Метод

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.
Результат integer The maximum number of allowed users.

getDomainNumUsers() абстрактный публичный Метод

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.
Результат integer The current number of users.

getDomainQuota() публичный Метод

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.
Результат integer The domain quota.

getDomains() абстрактный публичный Метод

Returns the list of domains from the backend.
abstract public getDomains ( ) : array
Результат array All the domains and their data in an array.

getUser() абстрактный публичный Метод

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.
Результат array The user information.

getUserFormAttributes() публичный Метод

getUserStatus() публичный Метод

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.
Результат 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() абстрактный публичный Метод

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.
Результат array The available users and their stored information.

getVirtual() публичный Метод

Returns information for a virtual id.
public getVirtual ( integer $virtual_id ) : array
$virtual_id integer The virtual id for which to return information.
Результат array The virtual email information.

getVirtuals() публичный Метод

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.
Результат array The available virtual emails.

isBelowMaxUsers() публичный Метод

Checks if the given domain is below the maximum allowed users.
public isBelowMaxUsers ( string $domain ) : boolean
$domain string The domain name to check.
Результат boolean True if the domain does not have a maximum limit (0) or current number of users is below the maximum number allowed.

saveAlias() публичный Метод

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() публичный Метод

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

saveForward() публичный Метод

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 saveUser ( $info )

saveVirtual() публичный Метод

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.

Описание свойств

$_params защищенное свойство

A hash containing any parameters for the current driver.
protected array $_params
Результат array