# LDAP Account Manager

# templates/3rdParty/pla/lib/Template.php

# Properties

author
package

## Description

Classes and functions for the template engine.
Templates are either: + Creating or Editing, (a Container or DN passed to the object) + A predefined template, or a default template (template ID passed to the object) The template object will know which attributes are mandatory (MUST attributes) and which attributes are optional (MAY attributes). It will also contain a list of optional attributes. These are attributes that the schema will allow data for (they are MAY attributes), but the template has not included a definition for them. The template object will be invalidated if it does contain the necessary items (objectClass, MUST attributes, etc) to make a successful LDAP update.

## Classes

### Template

# Properties

Extends
Implements
package
phpLDAPadmin
subpackage
Templates
todo
RDN attributes should be treated as MUST attributes even though the schema marks them as MAY
todo
RDN attributes need to be checked that are included in the schema, otherwise mark it is invalid
todo
askcontainer is no longer used?
Abstract
No
Final
No

#### Description

Template Class

#### Methods

OnChangeAdd, __clone, __construct, accept, copy, getAttrbyLdapType, getAttributes, getAttributesInternal, getAttributesShown, getAvailAttrs, getContainer, getContainerEncode, getContext, getDN, getDNEncode, getDescription, getForceDeleteAttrs, getIcon, getLDAPadd, getLDAPmodify, getObjectClasses, getRDN, getRDNAttributeName, getRDNAttrs, getRDNObjects, getRegExp, hasDefaultTemplate, isAdminDisabled, isAttrType, isInValid, isNoLeaf, isReadOnly, isVisible, readTemplates, rebuildTemplateAttrs, setAttrLDAPtype, setContainer, setDN, setInvalid, setInvisible, setMinValueCount, setRDNAttributes, setVisible, storeTemplate,

### OnChangeAdd( $origin, $value, ) : n/a

#### Description

OnChangeAdd javascript processing

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$origin | n/a |  |
$value | n/a |  |

#### Return value

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

### __clone( ) : n/a

#### Return value

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

### __construct( $server_id, $name = null, $filename = null, $type = null, $id = null, ) : n/a

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$server_id | n/a |  |
$name | n/a |  | null
$filename | n/a |  | null
$type | n/a |  | null
$id | n/a |  | null

#### Return value

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

### accept( $makeVisible = false, ) : n/a

#### Description

This function will perform the following intialisation steps: + If a DN is set, query the ldap and load the object + Read our $_REQUEST variable and set the values After this action, the template should self describe as to whether it is an update, create or delete.
(OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$makeVisible | n/a |  | false

#### Return value

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

### copy( $template, $rdn, $asnew = false, ) : n/a

#### Description

Copy a DN

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$template | n/a |  |
$rdn | n/a |  |
$asnew | n/a |  | false

#### Return value

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

### getAttrbyLdapType( $type, ) : array

#### Description

Get Attributes by LDAP type This function will return a list of attributes by LDAP type (MUST,MAY).

#### Arguments

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

#### Return value

Type | Description
--- | ---
array | Array of attributes.

### getAttributes( $optional = false, ) : array

#### Description

Get the attribute entries

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$optional | n/a |  | false

#### Return value

Type | Description
--- | ---
array | Array of attributes

### getAttributesInternal( ) : n/a

#### Description

Return a list of the internal attributes

#### Return value

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

### getAttributesShown( ) : n/a

#### Description

Return a list of attributes that should be shown

#### Return value

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

### getAvailAttrs( ) : n/a

#### Description

Get available attributes

#### Return value

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

### getContainer( ) : \dn

#### Description

Get the DN of the container for this entry

#### Return value

Type | Description
--- | ---
\dn | DN of the container

### getContainerEncode( $url = true, ) : n/a

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$url | n/a |  | true

#### Return value

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

### getContext( ) : n/a

#### Description

Determine the type of template this is

#### Return value

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

### getDN( ) : \dn

#### Description

Display the DN for this template entry. If the DN is not set (creating a new entry), then a generated DN will be produced, taken from the RDN and the CONTAINER details.

#### Return value

Type | Description
--- | ---
\dn |

### getDNEncode( $url = true, ) : n/a

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$url | n/a |  | true

#### Return value

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

### getDescription( ) : string

#### Description

Return the template description

#### Return value

Type | Description
--- | ---
string | Description

### getForceDeleteAttrs( ) : n/a

#### Description

Get the attributes that are marked as force delete We'll cache this result in the event of multiple calls.

#### Return value

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

### getIcon( ) : n/a

#### Description

Get template icon

#### Return value

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

### getLDAPadd( $attrsOnly = false, ) : n/a

#### Description

Return an array, that can be passed to ldap_add().
Attributes with empty values will be excluded.

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$attrsOnly | n/a |  | false

#### Return value

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

### getLDAPmodify( $attrsOnly = false, $index = 0, ) : n/a

#### Description

Return an array, that can be passed to ldap_mod_replace().
Only attributes that have changed their value will be returned. This function will cache its results, so that it can be called with count() to see if there are changes, and if they are, the 2nd call will just return the results

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$attrsOnly | n/a |  | false
$index | n/a |  | 0

#### Return value

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

### getObjectClasses( ) : array

#### Description

Return the objectclasses defined in this template

#### Return value

Type | Description
--- | ---
array | Array of Objects

### getRDN( ) : \rdn

#### Description

Return the RDN for this template. If the DN is already defined, then the RDN will be calculated from it.
If the DN is not set, then the RDN will be calcuated from the template attribute definitions

#### Return value

Type | Description
--- | ---
\rdn | RDN for this template

### getRDNAttributeName( ) : n/a

#### Description

Return the attribute name part of the RDN

#### Return value

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

### getRDNAttrs( ) : array

#### Description

Get all the RDNs for this template, in RDN order.

#### Return value

Type | Description
--- | ---
array | RDNs in order.

### getRDNObjects( ) : array

#### Description

Return the attributes that comprise the RDN.

#### Return value

Type | Description
--- | ---
array | Array of RDN objects

### getRegExp( ) : n/a

#### Return value

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

### hasDefaultTemplate( ) : boolean

#### Description

Is default templates enabled? This will disable the default template from the engine.

#### Return value

Type | Description
--- | ---
boolean |

### isAdminDisabled( ) : n/a

#### Return value

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

### isAttrType( $attr, $type, ) : n/a

#### Description

Return true if this is a MUST,MAY attribute

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$attr | n/a |  |
$type | n/a |  |

#### Return value

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

### isInValid( ) : string

#### Description

Get the template validity or the reason it is invalid

#### Return value

Type | Description
--- | ---
string | Invalid reason, or false if not invalid

### isNoLeaf( ) : n/a

#### Return value

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

### isReadOnly( ) : n/a

#### Description

Test if this template has been marked as a read-only template

#### Return value

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

### isVisible( ) : boolean

#### Description

Test if the template is visible

#### Return value

Type | Description
--- | ---
boolean |

### readTemplates( $type, ) : array

#### Description

Return the templates of type (creation/modification)

#### Arguments

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

#### Return value

Type | Description
--- | ---
array | - Array of templates of that type

### rebuildTemplateAttrs( ) : n/a

#### Description

This functions main purpose is to discover our MUST attributes based on objectclass definitions in the template file and to discover which of the objectclasses are STRUCTURAL - without one, creating an entry will just product an LDAP error.

#### Return value

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

### setAttrLDAPtype( $attr, $value, ) : n/a

#### Description

Set the LDAP type property for an attribute

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$attr | n/a |  |
$value | n/a |  |

#### Return value

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

### setContainer( $container, ) : n/a

#### Description

Set the container for this template, if we are creating entries

#### Arguments

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

#### Return value

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

#### Tags

Name | Description
--- | ---
todo | Trigger a query to the LDAP server and generate an error if the container doesnt exist

### setDN( $dn, ) : n/a

#### Description

Set the DN for this template, if we are editing entries

#### Arguments

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

#### Return value

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

### setInvalid( $msg, $admin = false, ) : n/a

#### Description

Set a template as invalid

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$msg | n/a |  |
$admin | n/a |  | false

#### Return value

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

### setInvisible( ) : n/a

#### Return value

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

### setMinValueCount( $attr, $value, ) : n/a

#### Description

Set the minimum number of values for an attribute

#### Arguments

Name | Type | Description | Default
--- | --- | --- | ---
$attr | n/a |  |
$value | n/a |  |

#### Return value

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

### setRDNAttributes( $rdn, ) : \RDN

#### Description

Set the RDN attributes Given an RDN, mark the attributes as RDN attributes. If there is no defined attribute, then the remaining RDNs will be returned.

#### Arguments

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

#### Return value

Type | Description
--- | ---
\RDN | attributes not processed

### setVisible( ) : n/a

#### Return value

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

### storeTemplate( $xmldata, ) : n/a

#### Description

Main processing to store the template.

#### Arguments

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

#### Return value

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

#### Properties

$container, $description, $dn, $icon, $invalid, $invalid_admin, $invalid_reason, $noleaf, $rdn, $readonly, $regexp, $structural_oclass, $title, $visible,

### protected $container =

### protected $description = ''

### private $dn =

### private $icon =

### private $invalid = false

### private $invalid_admin = false

### private $invalid_reason =

### private $noleaf = false

### private $rdn =

### private $readonly = false

### private $regexp =

### protected $structural_oclass = array()

### public $title =

### private $visible = true

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).