# LDAP Account Manager

# lib/modules/asteriskExtension.inc

# Properties

author
author
package

## Description

Manages Asterisk extensions.

## Classes

### asteriskExtension

# Properties

Extends
Implements
package
modules
Abstract
No
Final
No

#### Description

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 {@link get_metaData()}.
All module classes should extend the baseModule class.

#### Methods

array_sort, build_uploadAccounts, display_html_attributes, display_html_user, generateNextExtensionName, getDefaultExtensionOwner, get_metaData, get_pdfEntries, isExtensionOwnerSet, isMoveToNewSuffix, isThisExtensionPresented, load_Messages, load_extension_parts, moveExtentionToNewSuffix, postDeleteActions, processExtensionRows, processPriorityChange, processSingleExtension, process_attributes, process_user, render_exten_owners_set_controls, render_extension, render_extensions_by_priority, save_attributes, setDefaultExtensionOwner,

### array_sort( array $array, String $on, String $order = 'SORT_ASC', ) : n/a

#### Description

Sorts an array of arrays by the given key.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$array | array | array |
$on | String | key |
$order | String | order (SORT_ASC or SORT_DESC) | 'SORT_ASC'

#### Return value

Type | Description
--- | ---
n/a | n/a

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

#### Description

In this function the LDAP account is built up.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$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 |

#### Return value

Type | Description
--- | ---
array | list of error messages if any

### display_html_attributes( ) : \htmlElement

#### Description

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

#### Return value

Type | Description
--- | ---
\htmlElement | HTML meta data

### display_html_user( ) : \htmlElement

#### Description

Displays a list of possible owners of this extension.

#### Return value

Type | Description
--- | ---
\htmlElement | HTML meta data

### generateNextExtensionName( ) : String

#### Description

This function searches in the base subtree and finds all extensions names within.
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.

#### Return value

Type | Description
--- | ---
String | suggested extension name

### getDefaultExtensionOwner( ) : String

#### Description

Returns the default extension owner.

#### Return value

Type | Description
--- | ---
String | owner

### get_metaData( ) : array

#### Description

Returns meta data that is interpreted by parent class

#### Return value

Type | Description
--- | ---
array | array with meta data

### get_pdfEntries( ) : n/a

#### Description

Returns a list of PDF entries

#### Return value

Type | Description
--- | ---
n/a | n/a

### isExtensionOwnerSet( ) : boolean

#### Description

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

#### Return value

Type | Description
--- | ---
boolean | true if one or more owners

### isMoveToNewSuffix( ) : boolean

#### Description

Returns if the extension was moved to another OU.

#### Return value

Type | Description
--- | ---
boolean | true if moved

### isThisExtensionPresented( String $extension, ) : boolean

#### Description

Search by extension name and retun true if fields with this extension name exists and false otherwise.
Equal extension names are allowed in different OUs.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$extension | String | extension name |

#### Return value

Type | Description
--- | ---
boolean | true if there are entries with this extension name.

### load_Messages( ) : n/a

#### Description

This function fills the error message array with messages

#### Return value

Type | Description
--- | ---
n/a | n/a

### load_extension_parts( String $extension, ) : n/a

#### Description

Loads all related extension entries.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$extension | String | extension name |

#### Return value

Type | Description
--- | ---
n/a | n/a

### moveExtentionToNewSuffix( array $rowOrig, ) : array

#### Description

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

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$rowOrig | array | attributes of original extension |

#### Return value

Type | Description
--- | ---
array | list of error messages

### postDeleteActions( ) : array

#### Description

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

#### Return value

Type | Description
--- | ---
array | error messages

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

#### Description

Processes the rule data.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$extensionName | String | extension name |
$extensionContext | String | extension context |

#### Return value

Type | Description
--- | ---
array | error messages

### processPriorityChange( ) : n/a

#### Description

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

#### Return value

Type | Description
--- | ---
n/a | n/a

### processSingleExtension( array $extRow, String $extensionName, String $extensionContext, int $entryCounter, int $extensionPriorityCntr, ) : n/a

#### Description

Fills the fileds of a single extension row.
In Asterisk it would only be an extension name,a priority,an application, but LDAP spicific add to processing context field.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---

$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

#### Return value

Type | Description
--- | ---
n/a | n/a

### process_attributes( ) : array

#### Description

Writes variables into object and does some regex checks.

#### Return value

Type | Description
--- | ---
array | error messages

### process_user( ) : array

#### Description

Processes user input of the user selection page.
It checks if all input values are correct and updates the associated LDAP attributes.

#### Return value

Type | Description
--- | ---
array | list of info/error messages

### render_exten_owners_set_controls( $renderContainer, ) : n/a

#### Description

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

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$renderContainer | n/a |  |

#### Return value

Type | Description
--- | ---
n/a | n/a

### render_extension( array $extensLine, int $placeInList, \htmlTable $renderContainer, ) : n/a

#### Description

Generates the meta HTML for a single rule.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$extensLine | array | attributes of rule |
$placeInList | int | rule position |
$renderContainer | \htmlTable | container |

#### Return value

Type | Description
--- | ---
n/a | n/a

### render_extensions_by_priority( String $extension, \htmlTable $renderContainer, ) : n/a

#### Description

Generates the meta HTML for the rules.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$extension | String | extension name |
$renderContainer | \htmlTable | container |

#### Return value

Type | Description
--- | ---
n/a | n/a

### save_attributes( ) : array

#### Description

Returns a list of modifications which have to be made to the LDAP account.
Calling this method requires the existence of an enclosing {@link 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.

#### Return value

Type | Description
--- | ---
array | list of modifications

### setDefaultExtensionOwner( ) : n/a

#### Description

Set extension owner as current logged in user.

#### Return value

Type | Description
--- | ---
n/a | n/a

#### Properties

$addRuleFlag, $extensionOwners, $extensionRows, $extensionRowsOrig, $filterOwnerForAsteriskAccounts, $searchOwnersInTreeSuffix,

### private $addRuleFlag = false

flag if new rule should be added

### private $extensionOwners = array()

extension owners

### private $extensionRows = array()

Contains all attributes information for set of accounts

### private $extensionRowsOrig = array()

Contains all original attributes information for set of accounts

### private $filterOwnerForAsteriskAccounts = true

if true then only Asterisk accounts are shown as possible owners

### private $searchOwnersInTreeSuffix = false

if true then the tree suffix will be used to search potential owners
Documentation was generated by phpDocumentor 2.0.1 .

# Namespaces

- global

# Packages

- Crypt_AES
  - Crypt_AES
    Pure-PHP implementation of AES.
- Crypt_DES
  - Crypt_DES
    Pure-PHP implementation of DES.
- Crypt_Hash
  - Crypt_Hash
    Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions.
- Crypt_RC4
  - Crypt_RC4
    Pure-PHP implementation of RC4.
- Crypt_RSA
  - Crypt_RSA
    Pure-PHP PKCS#1 compliant implementation of RSA.
- Crypt_Random
- Crypt_Rijndael
  - Crypt_Rijndael
    Pure-PHP implementation of Rijndael.
- Crypt_TerraDES
  - Crypt_TripleDES
    Pure-PHP implementation of Triple DES.
- Crypt_TripleDES
- Help
- LDAP
  - Ldap
    Ldap manages connection to LDAP and includes several helper functions.
- Math_BigInteger
  - Math_BigInteger
    Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 numbers.
- Net_SFTP
  - Net_SFTP
    Pure-PHP implementations of SFTP.
- Net_SSH1
  - Net_SSH1
    Pure-PHP implementation of SSHv1.
- Net_SSH2
  - Net_SSH2
    Pure-PHP implementation of SSHv2.
- PDF
  - UFPDF
    Main UFPDF class for creating Unicode PDF documents
  - lamPDF
    Creates a LAM information page in PDF format.
  - xmlParser
    Simple XML parser.
- PHP_Compat
- configuration
  - LAMCfgMain
    This class manages config.cfg.
  - LAMConfig
    This class manages .conf files.
- horde.cipher
  - Horde_Cipher_blowfish
- lam
  - smbHash
    Calculates NT and LM hashes.
- lib
  - AttributeType
    Represents an LDAP AttributeType
  - MatchingRule
    Represents an LDAP MatchingRule
  - MatchingRuleUse
    Represents an LDAP schema matchingRuleUse entry
  - ObjectClass
    Represents an LDAP objectClass
  - ObjectClassAttribute
    A simple class for representing AttributeTypes used only by the ObjectClass class.
  - SchemaItem
    Generic parent class for all schema items. A schema item is an ObjectClass, an AttributeBype, a MatchingRule, or a Syntax.
  - Syntax
    Represents an LDAP Syntax
- lists
  - lamAsteriskExtList
    Generates the list view.
  - lamBooleanListOption
    Boolean option for list configuration.
  - lamDHCPList
    Generates the list view.
  - lamGroupList
    Generates the list view.
  - lamHostList
    Generates the list view.
  - lamList
    Generates the list view.
  - lamListOption
    Represents a list configuration option.
  - lamListTool
    Represents a tool which can be included in the account lists.
  - lamMailAliasList
    Generates the list view.
  - lamNetgroupList
    Generates the list view.
  - lamSelectListOption
    Boolean option for list configuration.
  - lamSmbDomainList
    Generates the list view.
  - lamUserList
    Generates the list view.
- main
- metaHTML
  - htmlAccountPageButton
    Prints a button for the account pages.
  - htmlButton
    Simple button.
  - htmlDiv
    Creates a simple DIV element.
  - htmlElement
    Represents a HTML element.
  - htmlEqualHeight
    Sets all given elements to the same height.
  - htmlEqualWidth
    Sets all given elements to the same width.
  - htmlFieldset
    Generates a fieldset.
  - htmlGroup
    Groups multiple htmlElements.
  - htmlHelpLink
    Renders a help link.
  - htmlHiddenInput
    Generates a hidden input field.
  - htmlHorizontalLine
    Prints a horizontal line.
  - htmlImage
    Prints the HTML code for an image.
  - htmlInputCheckbox
    Prints the HTML code for a checkbox.
  - htmlInputField
    A standard input field.
  - htmlInputFileUpload
    Prints the HTML code for a file upload field.
  - htmlInputTextarea
    Prints the HTML code for a textarea.
  - htmlJavaScript
    Creates a JavaScript element.
  - htmlLink
    Generates a link.
  - htmlOutputText
    Prints the text and escapes contained HTML code by default.
  - htmlRadio
    Represents a radio selection.
  - htmlSelect
    Represents a select box.
  - htmlSortableList
    Creates a list of elements that can be sorted by the user via drag'n'drop.
  - htmlSpacer
    Adds an empty space with given width and height.
  - htmlStatusMessage
    Prints a status message (e.g. error message).
  - htmlSubTitle
    Generates a subtitle line. This is used to group multiple fields.
  - htmlTable
    Structures elements using a table.
  - htmlTableExtendedInputCheckbox
    Checkbox with descriptive label and help link.
  - htmlTableExtendedInputField
    An extended input field that combines label, input field and help.
  - htmlTableExtendedInputFileUpload
    File upload with descriptive label and help link.
  - htmlTableExtendedInputTextarea
    Text area with label and help link.
  - htmlTableExtendedRadio
    Radio list with descriptive label and help link.
  - htmlTableExtendedSelect
    Select with label and help link.
  - htmlTableRow
    A row inside a htmlTable.
  - htmlTitle
    Generates a title line. This is used for page titles.
- modules
  - account
    Manages the object class "account" for users and hosts.
  - accountContainer
    This class includes all modules and attributes of an account.
  - asteriskAccount
    Manages the Asterisk extension of user accounts.
  - asteriskExtension
    Manages Asterisk extensions.
  - asteriskVoicemail
    Manages the Asterisk extension of user accounts.
  - authorizedServiceObject
    Provides Authorized Service for accounts.
  - baseModule
    Parent class of all account modules.
  - ddns
    Manages DDNS entries.
  - dhcp_settings
    Manages DHCP entries.
  - eduPerson
    Manages the eduPerson extension for user accounts.
  - fixed_ip
    Manages DHCP host entries.
  - freeRadius
    Manages FreeRadius accounts.
  - generalInformation
    Shows general information like the creation time of an account.
  - hostObject
    Manages the hosts to which a user may login.
  - ieee802device
    Provides MAC addresses for hosts.
  - imapAccess
    Manages mailboxes on an IMAP server.
  - inetLocalMailRecipient
    Provides mail routing for users.
  - inetOrgPerson
    This module manages LDAP attributes of the object class inetOrgPerson (e.g. name and address).
  - kolabGroup
    Manages Kolab group accounts.
  - kolabUser
    Manages Kolab user accounts.
  - ldapPublicKey
    Manages SSH public keys.
  - nisMailAlias
    Provides NIS mail alias management.
  - nisnetgroup
    Manages entries based on the object class nisNetgroup.
  - passwordService
    This interface needs to be implemented by all account modules which manage passwords.
  - posixAccount
    Manages the object class "posixAccount" for users and hosts.
  - posixGroup
    Manages the object class "posixGroup" for groups.
  - puppetClient
    Manages Puppet configuration options.
  - quota
    Manages quotas for users and groups.
  - range
    Manages DHCP ranges for DHCP server.
  - samba3domain
    Represents a Samba 3 domain entry
  - sambaDomain
    Manages Samba 3 domain entries.
  - sambaGroupMapping
    Manages the object class "sambaGroupMapping" for groups.
  - sambaMungedDial
    Manages terminal server settings for Samba 3.
  - sambaSamAccount
    Manages the object class "sambaSamAccount" for users and hosts.
  - shadowAccount
    Manages the object class "shadowAccount" for users.
  - smbHash
    Calculates NT and LM hashes.
  - systemQuotas
    Manages user quotas with the object class systemQuotas.
  - windowsGroup
    Manages Windows AD (e.g. Samba 4) groups.
  - windowsHost
    Manages Windows AD (e.g. Samba 4) hosts.
  - windowsPosixGroup
    Manages Unix groups in Windows LDAP schema.
  - windowsUser
    Manages Windows AD (e.g. Samba 4) users.
- phpLDAPadmin
- profiles
- selfService
  - selfServiceProfile
    Includes all settings of a self service profile.
- tools
  - LAMSubTool
    Represents a subtool.
  - LAMTool
    Represents a tool.
  - toolFileUpload
    File upload
  - toolOUEditor
    OU editor
  - toolPDFEditor
    PDF editor
  - toolProfileEditor
    Profile editor
  - toolSchemaBrowser
    Schema browser
  - toolServerInformation
    Server information
  - toolTests
    Tests page
- types
  - asteriskExt
    The account type for Asterisk extensions.
  - baseType
    This is the parent class of all account types.
  - dhcp
    The account type for DHCP
  - group
    The account type for group accounts (e.g. Unix and Samba).
  - host
    The account type for host accounts (e.g. Samba).
  - mailAlias
    The account type for mail aliases.
  - netgroup
    The account type for NIS netgroups.
  - smbDomain
    The account type for Samba domains.
  - user
    The account type for user accounts (e.g. Unix, Samba and Kolab).