LDAP Account Manager

accountContainer
in package

This class includes all modules and attributes of an account.

Table of Contents

$attributes  : mixed
Array of all used attributes Syntax is attribute => array ( objectClass => MUST or MAY, ...)
$attributes_orig  : mixed
original LDAP attributes when account was loaded from LDAP
$dn_orig  : mixed
DN of account when it was loaded
$dnSuffix  : mixed
DN suffix of the account
$finalDN  : mixed
DN of saved account
$isNewAccount  : mixed
True if this is a newly created account
$rdn  : mixed
RDN attribute of this account
$base  : mixed
Name of accountContainer variable in session
$cachedOUs  : mixed
cache for existing OUs
$current_page  : mixed
This variable stores the page number of the currently displayed page
$extraInfoAttributes  : array<string|int, mixed>
$lastLoadedProfile  : mixed
name of last loaded account profile
$module  : mixed
This is an array with all module objects
$order  : mixed
Module order
$postSaveErrorsOccurred  : bool
$sendPasswordViaMail  : mixed
send password via mail
$sendPasswordViaMailAlternateAddress  : mixed
send password via mail to this alternate address
$subpage  : mixed
This variable is set to the pagename of a subpage if it should be displayed
$titleBarIcon  : mixed
icon in title bar
$titleBarSubtitle  : mixed
subtitle in title bar
$titleBarTitle  : mixed
main title in title bar
$type  : mixed
This variable stores the account type.
__construct()  : mixed
Constructor
__sleep()  : array<string|int, mixed>
Encrypts sensitive data before storing in session.
__wakeup()  : mixed
Decrypts sensitive data after accountContainer was loaded from session.
continue_main()  : mixed
This function is called when the user clicks on any button on the account pages.
copyFromExistingAccount()  : void
Copies the data from the given account to this one.
fixLDAPAttributes()  : array<string|int, mixed>
Fixes spelling errors in the attribute names.
get_pdfEntries()  : array<string|int, PDFEntry>
Returns a list of possible PDF entries for this account.
get_type()  : ConfiguredType
Returns the account type of this object (e.g. user, group, host).
getAccountModule()  : baseModule
Returns the account module with the given class name
getAccountModules()  : array<string|int, baseModule>
Returns the included account modules.
getAccountStatus()  : AccountStatus
Returns the account status.
getEditKey()  : string
Returns the session edit key for this container.
getOUs()  : array<string|int, mixed>
Returns a list of OUs that exist for this account type.
getParentDN()  : string
Returns the parent DN of a given DN.
getRDN()  : string
Returns the RDN part of a given DN.
hasOnlyVirtualChildren()  : bool
Defines if the LDAP entry has only virtual child entries. This is the case for e.g. LDAP views.
initModules()  : mixed
Creates the account modules and initializes them.
load_account()  : array<string|int, mixed>
Loads an LDAP account with the given DN.
new_account()  : mixed
This function will prepare the object for a new account.
replaceWildcardsInArray()  : mixed
Replaces data with wildcard values from modules.
replaceWildcardsInPOST()  : mixed
Replaces POST data with wildcard values from modules.
save_module_attributes()  : array<string|int, mixed>
This function checks which LDAP attributes have changed while the account was edited.
setNewPassword()  : mixed
Sets the new password in all selected account modules.
sortModules()  : mixed
Sorts the module buttons for the account page.
anyModuleManagesMail()  : bool
Returns if any module manages the mail attribute.
doReplace()  : bool
Replaces wildcards in a value.
loadProfileIfRequested()  : bool
Checks if the user requested to load a profile.
printCommonControls()  : void
Prints common controls like the save button and the ou selection.
printModuleContent()  : mixed
Prints the content part provided by the current module.
printModuleTabs()  : mixed
Prints the HTML code of the module tabs.
printPageFooter()  : mixed
Prints the footer of the account pages.
printPageHeader()  : mixed
Prints the header of the account pages.
printPasswordPromt()  : mixed
Prints the input fields of the central password service.
printSuccessPage()  : mixed
Prints the HTML code to notify the user about the successful saving.
replaceWildcards()  : bool
Replaces wildcards in an array.
save_account()  : array<string|int, mixed>
This function will save an account to the LDAP database.
showSetPasswordButton()  : bool
Returns if the page should show a button to set the password.

Properties

$attributes

Array of all used attributes Syntax is attribute => array ( objectClass => MUST or MAY, ...)

public mixed $attributes

$attributes_orig

original LDAP attributes when account was loaded from LDAP

public mixed $attributes_orig

$dn_orig

DN of account when it was loaded

public mixed $dn_orig

$dnSuffix

DN suffix of the account

public mixed $dnSuffix

$finalDN

DN of saved account

public mixed $finalDN

$isNewAccount

True if this is a newly created account

public mixed $isNewAccount

$rdn

RDN attribute of this account

public mixed $rdn

$base

Name of accountContainer variable in session

private mixed $base

$cachedOUs

cache for existing OUs

private mixed $cachedOUs

$current_page

This variable stores the page number of the currently displayed page

private mixed $current_page = 0

$extraInfoAttributes

private array<string|int, mixed> $extraInfoAttributes = []

additional attributes for pre/post actions

$lastLoadedProfile

name of last loaded account profile

private mixed $lastLoadedProfile = ''

$module

This is an array with all module objects

private mixed $module

@var baseModule[] modules

$order

Module order

private mixed $order

$postSaveErrorsOccurred

private bool $postSaveErrorsOccurred = \false

errors occurred after saving LDAP data (postModify scripts)

$sendPasswordViaMail

send password via mail

private mixed $sendPasswordViaMail

$sendPasswordViaMailAlternateAddress

send password via mail to this alternate address

private mixed $sendPasswordViaMailAlternateAddress

$subpage

This variable is set to the pagename of a subpage if it should be displayed

private mixed $subpage

$titleBarIcon

icon in title bar

private mixed $titleBarIcon

$titleBarSubtitle

subtitle in title bar

private mixed $titleBarSubtitle

$titleBarTitle

main title in title bar

private mixed $titleBarTitle

$type

This variable stores the account type.

private mixed $type

Methods

__construct()

Constructor

public __construct(ConfiguredType $type, string $base) : mixed
Parameters
$type : ConfiguredType

account type

$base : string

key in $_SESSION where this object is saved

Return values
mixed

__sleep()

Encrypts sensitive data before storing in session.

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

list of attributes which are serialized

__wakeup()

Decrypts sensitive data after accountContainer was loaded from session.

public __wakeup() : mixed
Return values
mixed

continue_main()

This function is called when the user clicks on any button on the account pages.

public continue_main() : mixed

It prints the HTML code of each account page.

Return values
mixed

copyFromExistingAccount()

Copies the data from the given account to this one.

public copyFromExistingAccount(string $copyDn) : void
Parameters
$copyDn : string

DN to copy from

Return values
void

fixLDAPAttributes()

Fixes spelling errors in the attribute names.

public fixLDAPAttributes(array<string|int, mixed> $attributes, array<string|int, mixed> $modules) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>

LDAP attributes

$modules : array<string|int, mixed>

list of active modules

Return values
array<string|int, mixed>

fixed attributes

get_pdfEntries()

Returns a list of possible PDF entries for this account.

public get_pdfEntries(array<string|int, mixed> $pdfKeys, string $typeId) : array<string|int, PDFEntry>
Parameters
$pdfKeys : array<string|int, mixed>

list of PDF keys that are included in document

$typeId : string

type id (user, group, host)

Return values
array<string|int, PDFEntry>

list of key => PDFEntry

get_type()

Returns the account type of this object (e.g. user, group, host).

public get_type() : ConfiguredType
Return values
ConfiguredType

account type

getAccountModule()

Returns the account module with the given class name

public getAccountModule(string $name) : baseModule
Parameters
$name : string

class name (e.g. posixAccount)

Return values
baseModule

account module

getAccountModules()

Returns the included account modules.

public getAccountModules() : array<string|int, baseModule>
Return values
array<string|int, baseModule>

modules

getEditKey()

Returns the session edit key for this container.

public getEditKey() : string
Return values
string

key

getOUs()

Returns a list of OUs that exist for this account type.

public getOUs() : array<string|int, mixed>
Return values
array<string|int, mixed>

OU list

getParentDN()

Returns the parent DN of a given DN.

public getParentDN(string $dn) : string
Parameters
$dn : string

DN

Return values
string

DN

getRDN()

Returns the RDN part of a given DN.

public getRDN(string $dn) : string
Parameters
$dn : string

DN

Return values
string

RDN

hasOnlyVirtualChildren()

Defines if the LDAP entry has only virtual child entries. This is the case for e.g. LDAP views.

public hasOnlyVirtualChildren() : bool
Return values
bool

has only virtual children

initModules()

Creates the account modules and initializes them.

public initModules() : mixed
Return values
mixed

load_account()

Loads an LDAP account with the given DN.

public load_account(string $dn[, array<string|int, mixed> $infoAttributes = [] ]) : array<string|int, mixed>
Parameters
$dn : string

the DN of the account

$infoAttributes : array<string|int, mixed> = []

list of additional informational attributes that are added to the LDAP attributes E.g. this is used to inject the clear text password in the file upload. Informational attribute names must start with "INFO.".

Return values
array<string|int, mixed>

error messages

new_account()

This function will prepare the object for a new account.

public new_account() : mixed
Return values
mixed

replaceWildcardsInArray()

Replaces data with wildcard values from modules.

public replaceWildcardsInArray(array<string|int, mixed> $keyPrefixes, array<string|int, mixed> &$data) : mixed
Parameters
$keyPrefixes : array<string|int, mixed>

POST keys as full name or prefix (e.g. "key" matches "key1")

$data : array<string|int, mixed>

list of values that need replacement

Return values
mixed

replaceWildcardsInPOST()

Replaces POST data with wildcard values from modules.

public replaceWildcardsInPOST(array<string|int, mixed> $keyPrefixes) : mixed
Parameters
$keyPrefixes : array<string|int, mixed>

POST keys as full name or prefix (e.g. "key" matches "key1")

Return values
mixed

save_module_attributes()

This function checks which LDAP attributes have changed while the account was edited.

public save_module_attributes(array<string|int, mixed> $attributes, array<string|int, mixed> $orig) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>

list of current LDAP attributes

$orig : array<string|int, mixed>

list of old attributes when account was loaded

Return values
array<string|int, mixed>

an array which can be passed to $this->saveAccount()

setNewPassword()

Sets the new password in all selected account modules.

public setNewPassword(array<string|int, mixed> $input) : mixed
Parameters
$input : array<string|int, mixed>

input parameters

Return values
mixed

sortModules()

Sorts the module buttons for the account page.

public sortModules() : mixed
Return values
mixed

anyModuleManagesMail()

Returns if any module manages the mail attribute.

private anyModuleManagesMail() : bool
Return values
bool

mail is managed

doReplace()

Replaces wildcards in a value.

private doReplace(array<string|int, mixed> $replacements, string &$value) : bool
Parameters
$replacements : array<string|int, mixed>

replacements (key => value)

$value : string

value to perform replacements

Return values
bool

replacement done

loadProfileIfRequested()

Checks if the user requested to load a profile.

private loadProfileIfRequested() : bool
Return values
bool

true, if profile was loaded

printCommonControls()

Prints common controls like the save button and the ou selection.

private printCommonControls() : void
Return values
void

printModuleContent()

Prints the content part provided by the current module.

private printModuleContent(array<string|int, mixed> $result) : mixed
Parameters
$result : array<string|int, mixed>

list of messages

Return values
mixed

printModuleTabs()

Prints the HTML code of the module tabs.

private printModuleTabs() : mixed
Return values
mixed

printPageFooter()

Prints the footer of the account pages.

private printPageFooter() : mixed
Return values
mixed

printPageHeader()

Prints the header of the account pages.

private printPageHeader() : mixed
Return values
mixed

printPasswordPromt()

Prints the input fields of the central password service.

private printPasswordPromt() : mixed
Return values
mixed

printSuccessPage()

Prints the HTML code to notify the user about the successful saving.

private printSuccessPage(array<string|int, mixed> $messages) : mixed
Parameters
$messages : array<string|int, mixed>

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

Return values
mixed

replaceWildcards()

Replaces wildcards in an array.

private replaceWildcards(array<string|int, mixed> $replacements, array<string|int, mixed> $keyPrefixes, array<string|int, mixed> &$data) : bool
Parameters
$replacements : array<string|int, mixed>

replacements (key => value)

$keyPrefixes : array<string|int, mixed>

prefixes of $data array keys that should be replaced

$data : array<string|int, mixed>

data array

Return values
bool

replacement done

save_account()

This function will save an account to the LDAP database.

private save_account() : array<string|int, mixed>
Return values
array<string|int, mixed>

list of status messages

showSetPasswordButton()

Returns if the page should show a button to set the password.

private showSetPasswordButton() : bool
Return values
bool

show or hide button

Search results