LDAP Account Manager

lamDHCPList extends lamList
in package

Generates the list view.

Tags
author

Thomas Manninger

Table of Contents

ACCOUNT_STATUS_OPTION_NAME  = "LU_AS"
ID for config option to show account status
ATTR_ACCOUNT_STATUS  = 'lam_virtual_account_status'
virtual attribute name for account status column
FILTER_EXPIRED  = 1
filter value for expired accounts
FILTER_LOCKED  = 2
filter value for locked accounts
FILTER_SEMILOCKED  = 3
filter value for partially locked accounts
FILTER_UNLOCKED  = 4
filter value for unlocked accounts
LIST_SIZE_OPTION_NAME  = "L_SIZE"
ID for list size config option
VIRTUAL_ATTRIBUTE_PREFIX  = 'lam_virtual_'
prefix for virtual (non-LDAP) attributes
$accountStatusFilter  : mixed
filter value for account status
$attrArray  : mixed
list of LDAP attributes
$descArray  : mixed
list of attribute descriptions
$entries  : mixed
entries to show
$filters  : mixed
list of filters (attribute name => filter input)
$labels  : mixed
list of account specific labels
$ldapEntries  : mixed
entries from LDAP
$maxPageEntries  : mixed
maximum count of entries per page
$page  : mixed
current page number
$possibleSuffixes  : mixed
list of possible LDAP suffixes(organizational units)
$refresh  : mixed
refresh page switch
$serverSideFilterAttributes  : array<string|int, string>
List of attributes to filter on server side.
$serverSideFilterChanged  : mixed
defines if the server side filter changed
$showAccountStatus  : mixed
Controls if the account status is shown
$sortColumn  : mixed
sort column name
$sortDirection  : mixed
sort direction: 1 for ascending, -1 for descending
$sortMapping  : mixed
sort mapping for entries array(original index => sorted index)
$suffix  : mixed
LDAP suffix
$type  : mixed
Account type
$configOptions  : mixed
configuration options
$supportsPasswordQuickChange  : bool
__construct()  : lamList
Constructor
listDoPost()  : htmlElement|null
Manages all POST actions (e.g. button pressed) for the account lists.
showPage()  : mixed
Prints the HTML code to display the list view.
addExtraInputElementsToTopArea()  : mixed
Add DCP main settings button.
applyLocalFilters()  : mixed
Applies any local filters for attributes that cannot be filtered server side.
buildLDAPAttributeFilter()  : string
Builds the LDAP filter based on the filter entries in the GUI.
canBeFiltered()  : bool
Returns if the given attribute can be filtered.
forceRefresh()  : mixed
Forces a refresh of the LDAP data.
getAccountStatusFilterArea()  : htmlElement
Returns the filter for account status.
getAdditionalLDAPAttributesToRead()  : array<string|int, mixed>
Returns a list of additional LDAP attributes that should be read.
getAdditionalTools()  : array<string|int, lamListTool>
Returns a list of lamListTool objects to display next to the edit/delete buttons.
getFilterArea()  : htmlElement
Prints the content of a single attribute filter area.
getFilterAsTextForURL()  : string
Returns the filter as text to be used as URL parameter.
getTableCellContent()  : htmlElement
Returns the content of a cell in the account list for a given LDAP entry and attribute.
isAttributeFilteredByServer()  : bool
Specifies if the given attribute name is used for server side filtering (LDAP filter string).
isFilterMatching()  : mixed
Checks if the given LDAP data matches the filter.
listBuildFilter()  : mixed
Builds the regular expressions from the filter values.
listConfigurationChanged()  : mixed
Called when the configuration options changed.
listCreateSortMapping()  : mixed
Determines the sort mapping and stores it in $this->sortMapping.
listDrawNavigationBar()  : mixed
Draws a navigation bar to switch between pages
listGetAllConfigOptions()  : array<string|int, mixed>
Returns a list of possible configuration options.
listGetAttributeDescriptionList()  : array<string|int, mixed>
Returns an hash array containing with all attributes to be shown and their descriptions.
listGetConfigOptionByID()  : mixed
Returns the configuration option with the given ID.
listGetParams()  : mixed
Sets some internal parameters.
listPrintButtons()  : mixed
Prints the create and delete buttons.
listPrintConfigurationPage()  : mixed
Prints the list configuration page.
listPrintRedirectMessages()  : mixed
Prints messages when another page (e.g. delete/upload) redirects to the list view.
listRefreshData()  : mixed
Rereads the entries from LDAP.
listShowOUSelection()  : htmlGroup
Prints a combobox with possible sub-DNs.
printFooterContent()  : mixed
Prints any extra HTML for the footer part.
printHeaderContent()  : mixed
Prints any extra HTML for the header part.
addDataElements()  : mixed
Adds the LDAP data elements to the given array.
addToolLinks()  : mixed
Adds the tool image links (e.g. edit and delete) for each account.
getAccountStatus()  : htmlElement
Returns the account status.
getFilterElements()  : array<string|int, htmlElement>
Returns the elements to show in filter row.
getSortingElements()  : array<string|int, htmlElement>
Returns the elements to show in sorting row.
injectAccountStatusAttribute()  : mixed
Injects values for the virtual account status attribute to make it sortable.
isSupportingAccountStatus()  : bool
Returns if this account supports the account status column.
isSupportingPasswordQuickChange()  : bool
Returns if this account supports the password quick change page.
listReadOptionsFromCookie()  : mixed
Reads the list options from the cookie value.
printAccountTable()  : mixed
Prints the entry list
printFooter()  : mixed
Prints the footer area of the page.
printHeader()  : mixed
Prints the header part of the page.
showPDFPage()  : mixed
Shows the page where the user may select the PDF options.

Constants

ACCOUNT_STATUS_OPTION_NAME

ID for config option to show account status

public mixed ACCOUNT_STATUS_OPTION_NAME = "LU_AS"

ATTR_ACCOUNT_STATUS

virtual attribute name for account status column

public mixed ATTR_ACCOUNT_STATUS = 'lam_virtual_account_status'

FILTER_EXPIRED

filter value for expired accounts

public mixed FILTER_EXPIRED = 1

FILTER_LOCKED

filter value for locked accounts

public mixed FILTER_LOCKED = 2

FILTER_SEMILOCKED

filter value for partially locked accounts

public mixed FILTER_SEMILOCKED = 3

FILTER_UNLOCKED

filter value for unlocked accounts

public mixed FILTER_UNLOCKED = 4

LIST_SIZE_OPTION_NAME

ID for list size config option

public mixed LIST_SIZE_OPTION_NAME = "L_SIZE"

VIRTUAL_ATTRIBUTE_PREFIX

prefix for virtual (non-LDAP) attributes

public mixed VIRTUAL_ATTRIBUTE_PREFIX = 'lam_virtual_'

Properties

$accountStatusFilter

filter value for account status

protected mixed $accountStatusFilter

$attrArray

list of LDAP attributes

protected mixed $attrArray = []

$descArray

list of attribute descriptions

protected mixed $descArray = []

$entries

entries to show

protected mixed $entries

$filters

list of filters (attribute name => filter input)

protected mixed $filters = []

$labels

list of account specific labels

protected mixed $labels

$ldapEntries

entries from LDAP

protected mixed $ldapEntries

$maxPageEntries

maximum count of entries per page

protected mixed $maxPageEntries = 30

$page

current page number

protected mixed $page = 1

$possibleSuffixes

list of possible LDAP suffixes(organizational units)

protected mixed $possibleSuffixes

$refresh

refresh page switch

protected mixed $refresh = \true

$serverSideFilterAttributes

List of attributes to filter on server side.

protected array<string|int, string> $serverSideFilterAttributes = array('cn', 'commonname', 'uid', 'description', 'sn', 'surname', 'gn', 'givenname', 'company', 'mail')

$serverSideFilterChanged

defines if the server side filter changed

protected mixed $serverSideFilterChanged

$showAccountStatus

Controls if the account status is shown

protected mixed $showAccountStatus = \false

$sortColumn

sort column name

protected mixed $sortColumn

$sortDirection

sort direction: 1 for ascending, -1 for descending

protected mixed $sortDirection = 1

$sortMapping

sort mapping for entries array(original index => sorted index)

protected mixed $sortMapping

$suffix

LDAP suffix

protected mixed $suffix

$type

Account type

protected mixed $type

$configOptions

configuration options

private mixed $configOptions

$supportsPasswordQuickChange

private bool $supportsPasswordQuickChange

Methods

__construct()

Constructor

public __construct(string $type) : lamList
Parameters
$type : string

account type

Return values
lamList

list object

listDoPost()

Manages all POST actions (e.g. button pressed) for the account lists.

public listDoPost() : htmlElement|null
Return values
htmlElement|null

HTML fragment to insert into beginning of account list

showPage()

Prints the HTML code to display the list view.

public showPage() : mixed
Return values
mixed

addExtraInputElementsToTopArea()

Add DCP main settings button.

protected addExtraInputElementsToTopArea(htmlGroup &$left, htmlGroup &$right) : mixed
Parameters
$left : htmlGroup

left part

$right : htmlGroup

right part

Return values
mixed

applyLocalFilters()

Applies any local filters for attributes that cannot be filtered server side.

protected applyLocalFilters() : mixed
Return values
mixed

buildLDAPAttributeFilter()

Builds the LDAP filter based on the filter entries in the GUI.

protected buildLDAPAttributeFilter() : string
Return values
string

LDAP filter

canBeFiltered()

Returns if the given attribute can be filtered.

protected canBeFiltered(string $attr) : bool

If filtering is not possible then no filter box will be displayed. By default all attributes can be filtered.

Parameters
$attr : string

attribute name

Return values
bool

filtering possible

forceRefresh()

Forces a refresh of the LDAP data.

protected forceRefresh() : mixed

Function must be called before $this->refresh option is checked to load new LDAP data (e.g. in listGetParams).

Return values
mixed

getAccountStatusFilterArea()

Returns the filter for account status.

protected getAccountStatusFilterArea(bool $clearFilter) : htmlElement
Parameters
$clearFilter : bool

filter should be cleared

Return values
htmlElement

getAdditionalLDAPAttributesToRead()

Returns a list of additional LDAP attributes that should be read.

protected getAdditionalLDAPAttributesToRead() : array<string|int, mixed>

This can be used to show additional data even if the user selected other attributes to show in the list.

Return values
array<string|int, mixed>

additional attribute names

getAdditionalTools()

Returns a list of lamListTool objects to display next to the edit/delete buttons.

protected getAdditionalTools() : array<string|int, lamListTool>
Return values
array<string|int, lamListTool>

tools

getFilterArea()

Prints the content of a single attribute filter area.

protected getFilterArea(string $attrName, bool $clearFilter) : htmlElement
Parameters
$attrName : string

attribute name

$clearFilter : bool

true if filter value should be cleared

Return values
htmlElement

element to show

getFilterAsTextForURL()

Returns the filter as text to be used as URL parameter.

protected getFilterAsTextForURL() : string
Return values
string

filter text

getTableCellContent()

Returns the content of a cell in the account list for a given LDAP entry and attribute.

protected getTableCellContent(array<string|int, mixed> &$entry, string &$attribute) : htmlElement
Parameters
$entry : array<string|int, mixed>

LDAP attributes

$attribute : string

attribute name

Return values
htmlElement

content

isAttributeFilteredByServer()

Specifies if the given attribute name is used for server side filtering (LDAP filter string).

protected isAttributeFilteredByServer(string $attrName) : bool
Parameters
$attrName : string

attribute name

Return values
bool

filter server side

isFilterMatching()

Checks if the given LDAP data matches the filter.

protected isFilterMatching(mixed &$data, mixed $filterAttribute, mixed $regex) : mixed
Parameters
$data : mixed

LDAP attributes

$filterAttribute : mixed

filter attribute name

$regex : mixed

filter attribute regex

Tags
see
lamList::isFilterMatching()
Return values
mixed

listBuildFilter()

Builds the regular expressions from the filter values.

protected listBuildFilter() : mixed
Return values
mixed

listConfigurationChanged()

Called when the configuration options changed.

protected listConfigurationChanged() : mixed
Return values
mixed

listCreateSortMapping()

Determines the sort mapping and stores it in $this->sortMapping.

protected listCreateSortMapping(array<string|int, mixed> &$info) : mixed

The sort mapping is used to display the right rows when the account table is created.

Parameters
$info : array<string|int, mixed>

the account list

Return values
mixed

listDrawNavigationBar()

Draws a navigation bar to switch between pages

protected listDrawNavigationBar(int $count) : mixed
Parameters
$count : int

number of account entries

Return values
mixed

listGetAllConfigOptions()

Returns a list of possible configuration options.

protected listGetAllConfigOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

list of lamListOption objects

listGetAttributeDescriptionList()

Returns an hash array containing with all attributes to be shown and their descriptions.

protected listGetAttributeDescriptionList() : array<string|int, mixed>

Format: array(attribute => description)

Return values
array<string|int, mixed>

attribute list

listGetConfigOptionByID()

Returns the configuration option with the given ID.

protected listGetConfigOptionByID(string $ID) : mixed
Parameters
$ID : string

ID

Return values
mixed

listGetParams()

Sets some internal parameters.

protected listGetParams() : mixed
Return values
mixed

listPrintButtons()

Prints the create and delete buttons.

protected listPrintButtons(bool $createOnly) : mixed
Parameters
$createOnly : bool

true if only the create button should be displayed

Return values
mixed

listPrintConfigurationPage()

Prints the list configuration page.

protected listPrintConfigurationPage() : mixed
Return values
mixed

listPrintRedirectMessages()

Prints messages when another page (e.g. delete/upload) redirects to the list view.

protected listPrintRedirectMessages() : mixed
Return values
mixed

listRefreshData()

Rereads the entries from LDAP.

protected listRefreshData() : mixed
Return values
mixed

listShowOUSelection()

Prints a combobox with possible sub-DNs.

protected listShowOUSelection() : htmlGroup
Return values
htmlGroup

OU selection (may be empty)

printFooterContent()

Prints any extra HTML for the footer part.

protected printFooterContent() : mixed
Return values
mixed

printHeaderContent()

Prints any extra HTML for the header part.

protected printHeaderContent() : mixed
Return values
mixed

addDataElements()

Adds the LDAP data elements to the given array.

private addDataElements(array<string|int, mixed> &$data, array<string|int, mixed> &$info, array<string|int, mixed> &$onClickEvents, array<string|int, mixed> &$onDoubleClickEvents) : mixed
Parameters
$data : array<string|int, mixed>

data for responsible table

$info : array<string|int, mixed>

entries

$onClickEvents : array<string|int, mixed>

row number => code

$onDoubleClickEvents : array<string|int, mixed>

row number => code

Return values
mixed

Adds the tool image links (e.g. edit and delete) for each account.

private addToolLinks(array<string|int, mixed> $account, string $id, htmlGroup &$element) : mixed
Parameters
$account : array<string|int, mixed>

LDAP attributes

$id : string

account ID

$element : htmlGroup

location where to add tools

Return values
mixed

getAccountStatus()

Returns the account status.

private getAccountStatus(array<string|int, mixed> &$attrs) : htmlElement
Parameters
$attrs : array<string|int, mixed>

LDAP attributes

Return values
htmlElement

content

getFilterElements()

Returns the elements to show in filter row.

private getFilterElements() : array<string|int, htmlElement>
Return values
array<string|int, htmlElement>

elements

getSortingElements()

Returns the elements to show in sorting row.

private getSortingElements() : array<string|int, htmlElement>
Return values
array<string|int, htmlElement>

elements

injectAccountStatusAttribute()

Injects values for the virtual account status attribute to make it sortable.

private injectAccountStatusAttribute() : mixed
Return values
mixed

isSupportingAccountStatus()

Returns if this account supports the account status column.

private isSupportingAccountStatus() : bool
Return values
bool

quick change supported

isSupportingPasswordQuickChange()

Returns if this account supports the password quick change page.

private isSupportingPasswordQuickChange() : bool
Return values
bool

quick change supported

listReadOptionsFromCookie()

Reads the list options from the cookie value.

private listReadOptionsFromCookie() : mixed
Return values
mixed

printAccountTable()

Prints the entry list

private printAccountTable(array<string|int, mixed> &$info) : mixed
Parameters
$info : array<string|int, mixed>

entries

Return values
mixed

printFooter()

Prints the footer area of the page.

private printFooter() : mixed
Return values
mixed

printHeader()

Prints the header part of the page.

private printHeader() : mixed
Return values
mixed

showPDFPage()

Shows the page where the user may select the PDF options.

private showPDFPage(string $id) : mixed
Parameters
$id : string

account ID

Return values
mixed

Search results