Manages Asterisk extensions.

It implements the complete module interface and uses meta-data provided by the account modules for its functions.
Location and naming of modules
All LAM modules are placed in lib/modules/ and are named "<class name>.inc". E.g. if you create a new module and its class name is "qmail" then the filename would be "qmail.inc". The class name of a module must contain only a-z, A-Z, 0-9, -, and _.
You can avoid to override many functions by using get_metaData().
All module classes should extend the baseModule class.

package | modules
author | Roland Gruber

### Methods

## Creates a new base module class

    __construct(string $scope)

Inherited

inherited_from | \baseModule::__construct()

### Parameters

#### $scope

`string`

the account type (user, group, host)

## Sorts an array of arrays by the given key.

    array_sort(array $array, String $on, String $order)

### Parameters

#### $array

`array`

array

#### $on

`String`

key

#### $order

`String`

order (SORT_ASC or SORT_DESC)

## In this function the LDAP account is built up.

    build_uploadAccounts(array $rawAccounts, array $ids, array $partialAccounts, array $selectedModules) : array

Calling this method does not require the existence of an enclosing accountContainer.
Returns an array which contains subarrays to generate StatusMessages if any errors occured.

### Parameters

#### $rawAccounts

`array`

list of hash arrays (name => value) from user input

#### $ids

`array`

list of IDs for column position (e.g. "posixAccount_uid" => 5)

#### $partialAccounts

`array`

list of hash arrays (name => value) which are later added to LDAP

#### $selectedModules

`array`

list of selected account modules

### Returns

`array`list of error messages if any

## Returns if a given self service field can be set in read-only mode.

    canSelfServiceFieldBeReadOnly(String $fieldID, \selfServiceProfile $profile)

Inherited

inherited_from | \baseModule::canSelfServiceFieldBeReadOnly()

### Parameters

#### $fieldID

`String`

field identifier

#### $profile

`\selfServiceProfile`

currently edited profile

## Returns true if this module can manage accounts of the current type, otherwise false.

    can_manage() : boolean

Inherited

Calling this method does not require the existence of an enclosing accountContainer.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::can_manage()

### Returns

`boolean`true if module fits

## Checks if all input values are correct and returns the LDAP attributes which should be changed.

    checkSelfServiceOptions(string $fields, array $attributes, boolean $passwordChangeOnly, array $readOnlyFields) : array

Inherited

Return values:
messages: array of parameters to create status messages
add: array of attributes to add
del: array of attributes to remove
mod: array of attributes to modify
info: array of values with informational value (e.g. to be used later by pre/postModify actions)

Calling this method does not require the existence of an enclosing accountContainer.

inherited_from | \baseModule::checkSelfServiceOptions()

### Parameters

#### $fields

`string`

input fields

#### $attributes

`array`

LDAP attributes

#### $passwordChangeOnly

`boolean`

indicates that the user is only allowed to change his password and no LDAP content is readable

#### $readOnlyFields

`array`

list of read-only fields

### Returns

`array`messages and attributes (array('messages' => array(), 'add' => array('mail' => array('test@test.com')), 'del' => array(), 'mod' => array(), 'info' => array()))

## Checks if the self service settings are valid.

    checkSelfServiceSettings(array $options, \selfServiceProfile $profile) : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
If the input data is invalid the return value is an array that contains arrays to build StatusMessages (message type, message head, message text). If no errors occured the function returns an empty array.

inherited_from | \baseModule::checkSelfServiceSettings()

### Parameters

#### $options

`array`

hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements.

#### $profile

`\selfServiceProfile`

self service profile

### Returns

`array`error messages

## Checks input values of module settings.

    check_configOptions(array $scopes, array $options) : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text').
If no errors occured the function returns an empty array.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::check_configOptions()

### Parameters

#### $scopes

`array`

list of account types which are used

#### $options

`array`

hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements.

### Returns

`array`list of error messages

## Checks input values of account profiles.

    check_profileOptions(array $options) : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
$options is an hash array (option name => value) that contains the user input. The option values are all arrays containing one or more elements.
If the input data is invalid the return value is an array that contains arrays to build StatusMessages (message type, message head, message text). If no errors occured the function returns an empty array.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::check_profileOptions()

### Parameters

#### $options

`array`

a hash array (name => value) containing the user input

### Returns

`array`list of error messages (array(type, title, text)) to generate StatusMessages, if any

## This function returns an array with the same syntax as save_attributes().

    delete_attributes() : \List

Inherited

Calling this method requires the existence of an enclosing accountContainer.
It allows additional LDAP changes when an account is deleted.

inherited_from | \baseModule::delete_attributes()

### Returns

`\List`of LDAP operations, same as for save_attributes()

## This function creates meta HTML code to display the module specific page for the self service.

    displaySpecialSelfServicePage(\selfServiceProfile $profile) : \htmlElement

Inherited

see | \global\htmlElement
inherited_from | \baseModule::displaySpecialSelfServicePage()

### Parameters

#### $profile

`\selfServiceProfile`

self service settings

### Returns

`\htmlElement`meta HTML object

## This function will create the meta HTML code to show a page with all attributes.

    display_html_attributes() : \htmlElement

Calling this method requires the existence of an enclosing accountContainer.

### Returns

`\htmlElement`HTML meta data

## This function creates meta HTML code which will be displayed when an account should be deleted.

    display_html_delete() : \htmlElement

Inherited

Calling this method requires the existence of an enclosing accountContainer.
This can be used to interact with the user, e.g. should the home directory be deleted? The output of all modules is displayed on a single page.

see | \global\htmlElement
inherited_from | \baseModule::display_html_delete()

### Returns

`\htmlElement`meta HTML object

## Displays a list of possible owners of this extension.

    display_html_user() : \htmlElement

### Returns

`\htmlElement`HTML meta data

## This function is responsible to do additional tasks after the account has been created in LDAP (e.g.

    doUploadPostActions(array $data, array $ids, array $failed, array $temp, array $accounts) : array

Inherited

modifying group memberships, adding Quota etc..).

Calling this method does not require the existence of an enclosing accountContainer.
This function is called as long as the returned status is 'finished'. Please make sure that one function call lasts no longer than 3-4 seconds. Otherwise the upload may fail because the time limit is exceeded. You should not make more than one LDAP operation in each call.

inherited_from | \baseModule::doUploadPostActions()

### Parameters

#### $data

`array`

array containing one account in each element

#### $ids

`array`

maps the column names to keys for the sub arrays (array(<column_name> => <column number>))

#### $failed

`array`

list of account numbers which could not be successfully uploaded to LDAP

#### $temp

`array`

variable to store temporary data between two post actions

#### $accounts

`array`

list of LDAP entries

### Returns

`array`current status
array (
'status' => 'finished' | 'inProgress' // defines if all operations are complete
'progress' => 0..100 // the progress of the operations in percent
'errors' => array // list of arrays which are used to generate StatusMessages
)

## Runs any actions that need to be done before an LDAP entry is created.

    doUploadPreActions(array $attributes) : array

Inherited

inherited_from | \baseModule::doUploadPreActions()

### Parameters

#### $attributes

`array`

LDAP attributes of this entry (attributes are provided as reference, handle modifications of $attributes with care)

### Returns

`array`array which contains status messages. Each entry is an array containing the status message parameters.

## This function searches in the base subtree and finds all extensions names within.

    generateNextExtensionName() : String

The generation algorithm is the naive one, so only work when extension is numbers. All extension name is sorted and new extension name will be greates on + 1.

### Returns

`String`suggested extension name

## Returns the LDAP attributes which are managed in this module.

    getAttributes() : array

Inherited

inherited_from | \baseModule::getAttributes()

### Returns

`array`attributes

## Controls if the module button the account page is visible and activated.

    getButtonStatus() : string

Inherited

Calling this method requires the existence of an enclosing accountContainer.
Possible return values:

- enabled: button is visible and active
- disabled: button is visible and deactivated (greyed)
- hidden: no button will be shown

inherited_from | \baseModule::getButtonStatus()

### Returns

`string`status ("enabled", "disabled", "hidden")

## Returns the default extension owner.

    getDefaultExtensionOwner() : String

### Returns

`String`owner

## Returns the path to the module icon.

    getIcon() : \unknown

Inherited

The path must be releative to graphics (e.g. key.png). You can also set $this->meta['icon']. The preferred size is 32x32px.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::getIcon()

### Returns

`\unknown`

## Returns a list of aliases for LDAP attributes.

    getLDAPAliases() : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
All alias attributes will be renamed to the given attribute names.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::getLDAPAliases()

### Returns

`array`list of aliases like array("alias name" => "attribute name")

## This allows modules to create a link to a module specific page for the self service.

    getLinkToSpecialSelfServicePage(array $settings) : String

Inherited

The link is shown on the login page of the self service. You can use this to provide e.g. a page to reset passwords.

inherited_from | \baseModule::getLinkToSpecialSelfServicePage()

### Parameters

#### $settings

`array`

self service settings

### Returns

`String`link text (null if no special page used)

## Returns a list of LDAP attributes which are managed by this module.

    getManagedAttributes() : array

Inherited

All attribute names will be renamed to match the given spelling.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::getManagedAttributes()

### Returns

`array`list of attributes

## Returns a list of managed object classes for this module.

    getManagedObjectClasses() : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
This is used to fix spelling errors in LDAP-Entries (e.g. if "posixACCOUNT" is read instead of "posixAccount" from LDAP).
Example: return array('posixAccount')

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::getManagedObjectClasses()

### Returns

`array`list of object classes

## Returns the LDAP attributes which are managed in this module (with unchanged values).

    getOriginalAttributes() : array

Inherited

inherited_from | \baseModule::getOriginalAttributes()

### Returns

`array`attributes

## This function returns a list of PHP extensions (e.g.

    getRequiredExtensions() : array

Inherited

hash) which are needed by this module.

Calling this method does not require the existence of an enclosing accountContainer.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::getRequiredExtensions()

### Returns

`array`extensions

## Returns a list of possible input fields and their descriptions.

    getSelfServiceFields() : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
Format: array(<field identifier> => <field description>)

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::getSelfServiceFields()

### Returns

`array`fields

## Returns the meta HTML code for each input field.

    getSelfServiceOptions(array $fields, array $attributes, boolean $passwordChangeOnly, array $readOnlyFields) : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
It is not possible to display help links.

see | \global\htmlElement
inherited_from | \baseModule::getSelfServiceOptions()

### Parameters

#### $fields

`array`

list of active fields

#### $attributes

`array`

attributes of LDAP account

#### $passwordChangeOnly

`boolean`

indicates that the user is only allowed to change his password and no LDAP content is readable

#### $readOnlyFields

`array`

list of read-only fields

### Returns

`array`list of meta HTML elements (field name => htmlTableRow)

## This function returns a list of possible LDAP attributes (e.g.

    getSelfServiceSearchAttributes() : array

Inherited

uid, cn, ...) which can be used to search for LDAP objects.

Calling this method does not require the existence of an enclosing accountContainer.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::getSelfServiceSearchAttributes()

### Returns

`array`attributes

## Returns a list of self service configuration settings.

    getSelfServiceSettings(\selfServiceProfile $profile) : \htmlElement

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
The name attributes are used as keywords to load and save settings. We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts.

see | \global\baseModule::get_metaData()
see | \global\htmlElement
inherited_from | \baseModule::getSelfServiceSettings()

### Parameters

#### $profile

`\selfServiceProfile`

currently edited profile

### Returns

`\htmlElement`meta HTML object

## Returns a hash array containing a list of possible LDAP attributes that can be used to form the RDN (Relative Distinguished Name).

    get_RDNAttributes() : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
The returned elements have this form: <attribute> => <priority>
<attribute> is the name of the LDAP attribute
<priority> defines the priority of the attribute (can be "low", "normal", "high")
Example: return array('uid' => 'normal', 'cn' => 'low')

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_RDNAttributes()

### Returns

`array`list of attributes

## Returns an alias name for the module.

    get_alias() : string

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
This function returns a more descriptive string than the class name. Alias names are used for the buttons on the account pages and the module selection in the configuration wizard.
Please take care that your alias name is not too long. It may contain any character but should not include parts that may be interpreted by the browser (e.g. '<' or '>'). If you use different aliases dependent on the account type please make sure that there is a general alias for unknown types.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_alias()

### Returns

`string`alias name

## Returns a list of configuration options.

    get_configOptions(array $scopes, array $allScopes) : mixed

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
The field names are used as keywords to load and save settings. We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts.

see | \global\baseModule::get_metaData()
see | \global\htmlElement
inherited_from | \baseModule::get_configOptions()

### Parameters

#### $scopes

`array`

account types (user, group, host)

#### $allScopes

`array`

list of all active account modules and their scopes (module => array(scopes))

### Returns

`mixed`htmlElement or array of htmlElement

## This function returns a list with all depending and conflicting modules.

    get_dependencies() : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
The return value is an array with two sub arrays, "depends" and "conflicts". All values of the conflict array are string values with module names. All values of the depends array are either string values with module names or arrays which include only string values with module names.
If an element of the depends array is itself an array, this means that your module depends on one of these modules.
Example: return array("depends" => array("posixAccount", array("qmail", "sendmail")), "conflicts" => array("exim"))

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_dependencies()

### Returns

`array`list of dependencies and conflicts

## This function returns the help entry array for a specific help id.

    get_help(string $id) : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
The result is an hashtable with the following keys:

- Headline (required)
  The headline of this help entry. Can consist of any alpha-numeric characters. No HTML/CSS elements are allowed.
- Text (required)
  The text of the help entry which may contain any alpha-numeric characters.
- SeeAlso (optional)
  A reference to anonther related web site. It must be an array containing a field called "text" with the link text that should be displayed and a field called "link" which is the link target.

Example:
array('Headline' => 'This is the head line', 'Text' => 'Help content', 'SeeAlso' => array('text' => 'LAM homepage', 'link' => 'http://www.ldap-account-manager.org/'))

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_help()

### Parameters

#### $id

`string`

The id string for the help entry needed.

### Returns

`array`The desired help entry.

## Returns an LDAP filter for the account lists

    get_ldap_filter() : string

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
Returns an array('or' => '...', 'and' => '...') that is used to build the LDAP filter. Usually, this is used to filter object classes. All "or" filter parts of the base modules are combined with OR and then combined with the "and" parts.
The resulting LDAP filter will look like this: (&(|(OR1)(OR2)(OR3))(AND1)(AND2)(AND3))
Example: return array('or' => '(objectClass=posixAccount)', 'and' => '(!(uid=*$))')

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_ldap_filter()

### Returns

`string`LDAP filter

## Returns meta data that is interpreted by parent class

    get_metaData() : array

Only subclasses will return real data.
The aim of the meta data is to reduce the number of functions in the subclasses. All major data is centralized in one place.
The returned array contains a list of key-value pairs for the different functions.

- can_manage()
  Key: account_types
  Value: array of account types
  Example: "account_types" => array("user", "host")
- is_base_module()
  Key: is_base
  Value: boolean
  Example: "is_base" => true
- get_ldap_filter()
  Key: ldap_filter
  Value: array of filters
  Example: "ldap_filter" => array('or' => 'objectClass=posixAccount', 'and' => '(!(uid=*$))')
- getManagedObjectClasses()
  Key: objectClasses
  Value: array of object classes
  Example: "objectClasses" => array('posixAccount')
- getLDAPAliases()
  Key: LDAPaliases
  Value: array of aliases
  Example: "LDAPaliases" => array('commonName' => 'cn')
- get_RDNAttributes()
  Key: RDN
  Value: array of RDNs
  Example: "RDN" => array('uid' => 'normal', 'cn' => 'low')
- get_dependencies()
  Key: dependencies
  Value: array of dependencies
  Example: "dependencies" => array("depends" => array("posixAccount", array("qmail", "sendmail")), "conflicts" => array("exim"))
- get_profileOptions()
  Key: profile_options
  Value: array of profile options
  The syntax for the value array is the same as for the return value of get_profileOptions().
- check_profileOptions()
  Key: profile_checks
  Value: array of checks (array("optionName" => array()))
  The "optionName" keys of the value array are the names of the option identifiers.
  Each array element is an array itself containing these values:
  - type: determines how to check input
    Possible values:
    - regex: check with regular expression from regex variable, case sensitive
    - regex_i: check with regular expression from regex variable, case insensitive
    - int_greater: integer value of cmp_name1 must be greater than the integer value from the option cmp_name2
    - int_greaterOrEqual: integer value of cmp_name1 must be greater or equal than the integer value from the option cmp_name2
  - error_message: message that is displayed if input value was syntactically incorrect
    error_message is an array to build StatusMessages (message type, message head, message text, additional variables)
  - regex: regular expression string (only if type is regex/regex_i)
  - cmp_name1: name of first input variable that is used for comparison (only if type is int_greater/int_greaterOrEqual)
  - cmp_name2: name of second input variable that is used for comparison (only if type is int_greater/int_greaterOrEqual)
  - required: true or false, if this input field must be filled set to true (optional)
  - required_message: message that is displayed if no input value was given (only if required == true)
    required_message is an array to build StatusMessages (message type, message head, message text, additional variables)
- load_profile()
  Key: profile_mappings
  Value: array('profile_identifier1' => 'LDAP_attribute1', 'profile_identifier2' => 'LDAP_attribute2')
  The mapped values are stored directly in $this->attributes.
  Example: "profile_mappings" => array('inetOrgPerson_title' => 'title')
- get_configOptions()
  Key: config_options
  Value: array('user' => array, 'host' => array, 'all' => array)
  The values from 'all' are always returned, the other values only if they are inside the $scopes array.
  The syntax for sub arrays is the same as for the return value of get_configOptions().
- check_configOptions()
  Key: config_checks
  Value: array('user' => array, 'host' => 'array', 'all' => array)
  The values from 'all' are always used for checking, the other values only if they are inside the $scopes array. The syntax for sub arrays is the same as for check_configOptions().
- get_uploadColumns()
  Key: upload_columns
  Value: array
  The syntax for array is the same as for the return value of get_uploadColumns().
- get_uploadPreDepends()
  Key: upload_preDepends
  Value: array
  The syntax for array is the same as for the return value of get_uploadPreDepends().
- getRequiredExtensions()
  Key: extensions
  Value: array of extension names
  Example: "extensions" => array('hash')
- get_help()
  Key: help
  Value: hashtable of help entries
  The hashtable is an array which maps help IDs to help entries.
  Example: 'help' => array('myEntry' => array('Headline' => 'This is the head line', 'Text' => 'Help content'))
- getSelfServiceSearchAttributes()
  Key: selfServiceSearchAttributes
  Value: array of attribute names
  Example: "selfServiceSearchAttributes" => array('uid')
- getSelfServiceFields()
  Key: selfServiceFieldSettings
  Value: array of self service fields
  Example: "selfServiceFieldSettings" => array('pwd' => 'Password')

Example: return array("is_base" => true);

### Returns

`array`array with meta data

## Returns a list of PDF entries

    get_pdfEntries() : array

### Returns

`array`list of possible PDF entries

## Returns a hashtable with all entries that may be printed out in the PDF.

    get_pdfFields() : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
This method must be overwritten in case that there are non static values to be returned. The $this->meta['PDF_fields'] array may be used for static content.
Format of returned hashtable:
This function uses XML formatted commands to define the PDF output. Each part in the PDF document is surrounded by "<block>" and "</block>".
Inside the <block> tags there are different ways to format the output:

- simple line with attribute name and value: <block><key>attribute name</key><value>attribute value</value></block>
- table: <block><key>attribute name</key>
  value value
  </block><block>
  value value
  </block>

Special commands:

- Alignment in : You can specify the alignment in tags with align=(L|R|C) (e.g. )
- Cell width: allows an attribute "width" to set the cell width (e.g. or ).
- Line breaks: Line breaks can be specified by adding a <
  > tag. The new line will start at the left border of the PDF document.

Examples:
Simple name+value lines:
In most cases you will just want to display a single line per attribute with its name and value.
'myAttribute' => '<block><key>AttrName</key><value>12345</value></block>'
This will give the following PDF output:
Attribute name: 12345
Multiline values:
Sometimes you have multivalued attributes where it is not applicable to write all values in one line but where you want to list your values one below the other or show a table. This can be done by using the tag.
This example only uses one column but you can just use more tags per <block> tag to display more columns.
'myAttribute' => '<block><key>AttrName</key>

123
</block><block>
456
</block><block>
789
</block>'

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_pdfFields()

### Returns

`array`PDF entries

## This function defines what attributes will be used in the account profiles and their appearance in the profile editor.

    get_profileOptions() : \htmlElement

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
The return value is an object implementing htmlElement.
The field name are used as keywords to load and save profiles. We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts.

see | \global\baseModule::get_metaData()
see | \global\htmlElement
inherited_from | \baseModule::get_profileOptions()

### Returns

`\htmlElement`meta HTML object

## Returns the account type of this module (user, group, host)

    get_scope() : string

Inherited

inherited_from | \baseModule::get_scope()

### Returns

`string`account type

## Returns an array containing all input columns for the file upload.

    get_uploadColumns(array $selectedModules) : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
This funtion returns an array which contains subarrays which represent an upload column. Syntax of column arrays:
array(
string: name, // fixed non-translated name which is used as column name (should be of format: <module name>_<column name>)
string: description, // short descriptive name
string: help, // help ID
string: example, // example value
string: values, // possible input values (optional)
string: default, // default value (optional)
boolean: required // true, if user must set a value for this column
boolean: unique // true if all values of this column must be different values (optional, default: "false")
)

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_uploadColumns()

### Parameters

#### $selectedModules

`array`

list of selected account modules

### Returns

`array`column list

## Returns a list of module names which must be processed in building the account befor this module.

    get_uploadPreDepends() : array

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
The named modules may not be active, LAM will check this automatically.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::get_uploadPreDepends()

### Returns

`array`list of module names

## Manages AJAX requests.

    handleAjaxRequest()

Inherited

This function may be called with or without an account container.

inherited_from | \baseModule::handleAjaxRequest()

## Initializes the module after it became part of an {@link accountContainer}

    init(string $base)

Inherited

Calling this method requires the existence of an enclosing accountContainer.

inherited_from | \baseModule::init()

### Parameters

#### $base

`string`

the name of the {@link accountContainer} object ($_SESSION[$base])

## Returns true if at least one owner is set and false otherwise

    isExtensionOwnerSet() : boolean

### Returns

`boolean`true if one or more owners

## Returns if the extension was moved to another OU.

    isMoveToNewSuffix() : boolean

### Returns

`boolean`true if moved

## Search by extension name and retun true if fields with this extension name exists and false otherwise.

    isThisExtensionPresented(String $extension) : boolean

Equal extension names are allowed in different OUs.

### Parameters

#### $extension

`String`

extension name

### Returns

`boolean`true if there are entries with this extension name.

## Returns true if your module is a base module and otherwise false.

    is_base_module() : boolean

Inherited

Calling this method does not require the existence of an enclosing accountContainer.
Every account type needs exactly one base module. A base module manages a structural object class. E.g. the inetOrgPerson module is a base module since its object class is structural.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::is_base_module()

### Returns

`boolean`true if base module (defaults to false if no meta data is provided)

## This function fills the error message array with messages

    load_Messages()

Calling this method requires the existence of an enclosing accountContainer.

## This function loads the LDAP attributes when an account should be loaded.

    load_attributes(array $attributes)

Inherited

Calling this method requires the existence of an enclosing accountContainer.
By default this method loads the object classes and accounts which are specified in getManagedObjectClasses() and getManagedAttributes().

inherited_from | \baseModule::load_attributes()

### Parameters

#### $attributes

`array`

array like the array returned by get_ldap_attributes(dn of account) but without count indices

## Loads all related extension entries.

    load_extension_parts(String $extension)

### Parameters

#### $extension

`String`

extension name

## This function loads the values from an account profile to the module's internal data structures.

    load_profile(array $profile)

Inherited

Calling this method does not require the existence of an enclosing accountContainer.

see | \global\baseModule::get_metaData()
inherited_from | \baseModule::load_profile()

### Parameters

#### $profile

`array`

hash array with profile values (identifier => value)

## This function is used to check if all settings for this module have been made.

    module_complete() : boolean

Inherited

Calling this method requires the existence of an enclosing accountContainer.
This function tells LAM if it can create/modify the LDAP account. If your module needs any additional input then set this to false. The user will be notified that your module needs more input.
This method's return value defaults to true.

inherited_from | \baseModule::module_complete()

### Returns

`boolean`true, if settings are complete

## This function is used to check if this module page can be displayed.

    module_ready() : boolean

Inherited

Calling this method requires the existence of an enclosing accountContainer.
Your module might depend on input of other modules. This function determines if the user can change to your module page or not. The return value is true if your module accepts input, otherwise false.
This method's return value defaults to true.

inherited_from | \baseModule::module_ready()

### Returns

`boolean`true, if page can be displayed

## Get list of all applications for given extension and move it into new suffix.

    moveExtentionToNewSuffix(array $rowOrig) : array

### Parameters

#### $rowOrig

`array`

attributes of original extension

### Returns

`array`list of error messages

## Runs ufter main deltete procedure was done and do postmorten for other parts of extension wtith priority > 1.

    postDeleteActions() : array

Calling this method requires the existence of an enclosing accountContainer.

### Returns

`array`error messages

## Allows the module to run commands after the LDAP entry is changed or created.

    postModifyActions(boolean $newAccount, array $attributes) : array

Inherited

Calling this method requires the existence of an enclosing accountContainer.

inherited_from | \baseModule::postModifyActions()

### Parameters

#### $newAccount

`boolean`

new account

#### $attributes

`array`

LDAP attributes of this entry

### Returns

`array`array which contains status messages. Each entry is an array containing the status message parameters.

## Allows the module to run commands after the LDAP entry is changed or created.

    postModifySelfService(array $attributes) : boolean

Inherited

inherited_from | \baseModule::postModifySelfService()

### Parameters

#### $attributes

`array`

LDAP attributes of this entry

### Returns

`boolean`true, if no problems occured

## Allows the module to run commands before the LDAP entry is deleted.

    preDeleteActions() : array

Inherited

Calling this method requires the existence of an enclosing accountContainer.

inherited_from | \baseModule::preDeleteActions()

### Returns

`array`Array which contains status messages. Each entry is an array containing the status message parameters.

## Allows the module to run commands before the LDAP entry is changed or created.

    preModifyActions(boolean $newAccount, array $attributes) : array

Inherited

Calling this method requires the existence of an enclosing accountContainer.
The modification is aborted if an error message is returned.

inherited_from | \baseModule::preModifyActions()

### Parameters

#### $newAccount

`boolean`

new account

#### $attributes

`array`

LDAP attributes of this entry (added/modified attributes are provided as reference, handle modifications of $attributes with care)

### Returns

`array`array which contains status messages. Each entry is an array containing the status message parameters.

## Allows the module to run commands before the LDAP entry is changed or created.

    preModifySelfService(array $attributes) : boolean

Inherited

An error message should be printed if the function returns false.

inherited_from | \baseModule::preModifySelfService()

### Parameters

#### $attributes

`array`

LDAP attributes of this entry

### Returns

`boolean`true, if no problems occured

## Processes the rule data.

    processExtensionRows(String $extensionName, String $extensionContext) : array

### Parameters

#### $extensionName

`String`

extension name

#### $extensionContext

`String`

extension context

### Returns

`array`error messages

## Reorders the rules if the user clicked on a move button.

    processPriorityChange()

## Fills the fileds of a single extension row.

    processSingleExtension(array $extRow, String $extensionName, String $extensionContext, int $entryCounter, int $extensionPriorityCntr)

In Asterisk it would only be an extension name,a priority,an application, but LDAP spicific add to processing context field.

### Parameters

#### $extRow

`array`

- hash array to store single extension properties;

#### $extensionName

`String`

extension name

#### $extensionContext

`String`

extension context

#### $entryCounter

`int`

- counter to distinguish single extensuion properties from $_POST

#### $extensionPriorityCntr

`int`

- it is the variable where actual number of extension rules wuld be aggregated

## Writes variables into object and does some regex checks.

    process_attributes() : array

Calling this method requires the existence of an enclosing accountContainer.
It checks the user input and saves changes in the module's data structures.
Example: return array(array('ERROR', 'Invalid input!', 'This is not allowed here.'));

### Returns

`array`error messages

## Processes user input of the user selection page.

    process_user() : array

It checks if all input values are correct and updates the associated LDAP attributes.

### Returns

`array`list of info/error messages

## This function prints management elements to manipulate owners of an extension.

    render_exten_owners_set_controls(\htmlTable $renderContainer)

### Parameters

#### $renderContainer

`\htmlTable`

container

## Generates the meta HTML for a single rule.

    render_extension(array $extensLine, int $placeInList, \htmlTable $renderContainer)

### Parameters

#### $extensLine

`array`

attributes of rule

#### $placeInList

`int`

rule position

#### $renderContainer

`\htmlTable`

container

## Generates the meta HTML for the rules.

    render_extensions_by_priority(String $extension, \htmlTable $renderContainer)

### Parameters

#### $extension

`String`

extension name

#### $renderContainer

`\htmlTable`

container

## Returns a list of modifications which have to be made to the LDAP account.

    save_attributes() : array

Calling this method requires the existence of an enclosing accountContainer.

This function returns an array with 3 entries:
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
DN is the DN to change. It is possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid)
"add" are attributes which have to be added to the LDAP entry
"remove" are attributes which have to be removed from the LDAP entry
"modify" are attributes which have to be modified in the LDAP entry
"notchanged" are attributes which stay unchanged
"info" values with informational value (e.g. to be used later by pre/postModify actions)
This builds the required comands from $this-attributes and $this->orig.

### Returns

`array`list of modifications

## Set extension owner as current logged in user.

    setDefaultExtensionOwner()

## Specifies if this module supports the LAM admin interface.

    supportsAdminInterface() : boolean

Inherited

The LAM admin interface are the pages that allow to manage e.g. users and groups. In contrast there is also the LAM self service interface. Most modules support the admin interface.

inherited_from | \baseModule::supportsAdminInterface()

### Returns

`boolean`support admin interface

## Adds a text input field that may contain multiple values to the given htmlTable.

    addMultiValueInputTextField(\htmlTable $container, String $attrName, String $label, boolean $required, integer $length)

Inherited

The field name will be the same as the attribute name plus a counting number (e.g. street_0). The last field will be followed by a button to add a new value. This is named add_{attribute name} (e.g. add_street). There must be a help entry with the attribute name as ID. A new line will also be added after this entry so multiple calls will show the fields one below the other.

inherited_from | \baseModule::addMultiValueInputTextField()

### Parameters

#### $container

`\htmlTable`

parent container

#### $attrName

`String`

attribute name

#### $label

`String`

label name

#### $required

`boolean`

this is a required field (default false)

#### $length

`integer`

field length

## Adds a simple text input field to the given htmlTable.

    addSimpleInputTextField(\htmlTable $container, String $attrName, String $label, boolean $required, integer $length, boolean $isTextArea)

Inherited

The field name will be the same as the attribute name. There must also be a help entry with the attribute name as ID. A new line will also be added after this entry so multiple calls will show the fields one below the other.

inherited_from | \baseModule::addSimpleInputTextField()

### Parameters

#### $container

`\htmlTable`

parent container

#### $attrName

`String`

attribute name

#### $label

`String`

label name

#### $required

`boolean`

this is a required field (default false)

#### $length

`integer`

field length

#### $isTextArea

`boolean`

show as text area (default false)

## Adds a simple PDF entry to the given array.

    addSimplePDFField(array $result, String $name, String $label, String $attrName, String $delimiter)

Inherited

inherited_from | \baseModule::addSimplePDFField()

### Parameters

#### $result

`array`

result array (entry will be added here)

#### $name

`String`

ID

#### $label

`String`

label name

#### $attrName

`String`

attribute name (default: =$name)

#### $delimiter

`String`

delimiter if multiple attribute values exist (default: ", ")

## Adds a simple text input field for the self service.

    addSimpleSelfServiceTextField(array $container, String $name, String $label, array $fields, array $attributes, array $readOnlyFields, boolean $required, boolean $isTextArea)

Inherited

The field name will be the same as the class name plus "_" plus attribute name (e.g. posixAccount_cn).

inherited_from | \baseModule::addSimpleSelfServiceTextField()

### Parameters

#### $container

`array`

array that is used as return value for getSelfServiceOptions()

#### $name

`String`

attribute name (== field name)

#### $label

`String`

label to display in front of input field

#### $fields

`array`

list of active fields

#### $attributes

`array`

attributes of LDAP account

#### $readOnlyFields

`array`

list of read-only fields

#### $required

`boolean`

field is required

#### $isTextArea

`boolean`

display as text area

## Checks the input value of a self service text field.

    checkSimpleSelfServiceTextField(array $container, String $name, array $attributes, string $fields, array $readOnlyFields, String $validationID)

Inherited

The field name must be the same as the class name plus "_" plus attribute name (e.g. posixAccount_cn). If validation is used then there must exist a message named [{attribute name}][0] (e.g. $this->messages['street'][0]).

inherited_from | \baseModule::checkSimpleSelfServiceTextField()

### Parameters

#### $container

`array`

return value of checkSelfServiceOptions()

#### $name

`String`

attribute name

#### $attributes

`array`

LDAP attributes

#### $fields

`string`

input fields

#### $readOnlyFields

`array`

list of read-only fields

#### $validationID

`String`

validation ID for get_preg()

## Returns the {@link accountContainer} object.

    getAccountContainer() : \accountContainer

Inherited

see | \global\accountContainer
inherited_from | \baseModule::getAccountContainer()

### Returns

`\accountContainer`accountContainer object

## Returns if the given configuration option is set.

    isBooleanConfigOptionSet(String $optionName) : boolean

Inherited

This function returns false if the configuration options cannot be read.

inherited_from | \baseModule::isBooleanConfigOptionSet()

### Parameters

#### $optionName

`String`

name of the option

### Returns

`boolean`true if option is set

## Validates a multi-value text field.

    processMultiValueInputTextField(String $attrName, array $errors, String $validationID)

Inherited

The input fields must be created with function addMultiValueInputTextField(). If validation is used then there must exist a message named [{attribute name}][0] (e.g. $this->messages['street'][0]).

inherited_from | \baseModule::processMultiValueInputTextField()

### Parameters

#### $attrName

`String`

attribute name

#### $errors

`array`

errors array where to put validation errors

#### $validationID

`String`

validation ID for function get_preg() (default: null, null means no validation)

### Properties

## contains all ldap attributes which should be written

    $attributes

Inherited

inherited_from | \baseModule::$$attributes

## if true, managed object classes are added when an account is created or loaded (default: true)

    $autoAddObjectClasses

Inherited

inherited_from | \baseModule::$$autoAddObjectClasses

## contains all error messages of a module

    $messages

Inherited

inherited_from | \baseModule::$$messages

## includes all meta data provided by the sub class

    $meta

Inherited

inherited_from | \baseModule::$$meta

## configuration settings of all modules

    $moduleSettings

Inherited

inherited_from | \baseModule::$$moduleSettings

## contains all ldap attributes which are loaded from ldap

    $orig

Inherited

inherited_from | \baseModule::$$orig

## self service settings of all modules

    $selfServiceSettings

Inherited

inherited_from | \baseModule::$$selfServiceSettings

## flag if new rule should be added

    $addRuleFlag

## name of parent accountContainer ($_SESSION[$base])

    $base

Inherited

inherited_from | \baseModule::$$base

## extension owners

    $extensionOwners

## Contains all attributes information for set of accounts

    $extensionRows

## Contains all original attributes information for set of accounts

    $extensionRowsOrig

## if true then only Asterisk accounts are shown as possible owners

    $filterOwnerForAsteriskAccounts

## the account type of this module (user, group, host)

    $scope

Inherited

inherited_from | \baseModule::$$scope

## if true then the tree suffix will be used to search potential owners

    $searchOwnersInTreeSuffix