LDAP Account Manager

TreeView
in package

Tree view functions.

Table of Contents

$schemaAttributes  : array<string|int, mixed>
$schemaObjectClasses  : array<string|int, mixed>
answerAjaxCall()  : string
Returns the JSON to answer an AJAX request.
addAttributeContent()  : void
Adds the content part for one attribute.
addExtraAttributeContent()  : htmlElement
Adds any entry content to the element.
applyPasswordHash()  : array<string|int, mixed>
Applies password hashing on the provided values.
createNewNode()  : string
Displays the content to create a new subnode.
createNewNodeCheckAttributesStep()  : string
Returns the content for the check attributes step of node creation.
createNewNodeCheckObjectClassesStep()  : string
Returns the content to select the object classes.
createNewNodeGetObjectClassesStep()  : string
Returns the content to select the object classes.
createNodeData()  : array<string|int, mixed>
Creates the node data for the tree view.
decodeBinaryAttributeValues()  : array<string|int, string>
Base 64 decodes attribute values.
deleteNode()  : string
Deletes a node in LDAP.
ensureWriteAccess()  : void
Stops processing if no write access is allowed.
getAttributeContentField()  : htmlElement
Returns the input fields for the attribute.
getAttributeInputField()  : htmlElement
Returns an input field for an LDAP attribute.
getAttributeJpegInputField()  : htmlElement
Returns an input field for a JPG image attribute.
getAttributePasswordInputField()  : htmlElement
Returns an input field for a password attribute.
getInternalAttributesContent()  : string
Returns the internal attributes.
getMayAttributeNamesRecursive()  : array<string|int, mixed>
Gets a recursive list of may attribute names.
getMustAttributeNamesRecursive()  : array<string|int, mixed>
Gets a recursive list of must attribute names.
getNodeContent()  : string
Returns the node content with the attribute listing.
getNodeIcon()  : string
Returns the node's icon.
getNodes()  : string
Lists LDAP nodes.
getPossibleNewAttributeNameOptions()  : array<string|int, mixed>
Returns the options for the drop-down to add a new attribute.
getPossibleNewAttributeNameOptionsJson()  : mixed
Returns the JSON for the possible new attributes select.
getProperAttributeName()  : string
Returns the proper spelling of the attribute name.
getRootNodes()  : string
Returns a list of root nodes for the tree view.
getSchemaAttributes()  : array<string|int, AttributeType>
Returns the schema attributes.
getSchemaObjectClasses()  : array<string|int, ObjectClass>
Returns the schema object classes.
getSubNodes()  : string
Returns the subnodes of the given DN.
handleSpecialAttributes()  : void
Handles attributes that require specific operations.
isAttributeRequired()  : bool
Returns if the attribute is required for the given list of object classes.
isJpegAttribute()  : bool
Returns if the given attribute is a JPG image.
isMultiLineAttribute()  : bool
Returns if the given attribute is multi-line.
isMultiValueAttribute()  : bool
Returns if the given attribute is a multi-value one.
isOrderedAttribute()  : bool
Returns if the attribute has ordered values.
isPasswordAttribute()  : bool
Returns if the given attribute is a (hashable) password.
paste()  : string
Performs paste operations.
saveAttributes()  : string
Returns the node content with the attribute listing.
search()  : string
Renders the search mask.
searchResults()  : string
Renders the search results.
searchResultsAsList()  : string
Returns the search results as list.
searchResultsAsTable()  : string
Returns the search results as table.
searchResultsHeader()  : htmlResponsiveRow
Creates the header part of the search results.
sortNodes()  : void
Sorts the given node array by DN.
validateDn()  : void
Stops processing if DN is invalid.

Properties

$schemaAttributes

private array<string|int, mixed> $schemaAttributes

schema attributes

$schemaObjectClasses

private array<string|int, mixed> $schemaObjectClasses

schema object classes

Methods

answerAjaxCall()

Returns the JSON to answer an AJAX request.

public answerAjaxCall() : string
Return values
string

JSON data

addAttributeContent()

Adds the content part for one attribute.

private addAttributeContent(htmlResponsiveRow $row, string $attributeName, array<string|int, mixed> $values, AttributeType|null $schemaAttribute, array<string|int, string> $objectClasses, string|null $dn, array<string|int, mixed> $highlighted) : void
Parameters
$row : htmlResponsiveRow

container where to add content

$attributeName : string

attribute name

$values : array<string|int, mixed>

values

$schemaAttribute : AttributeType|null

schema attribute

$objectClasses : array<string|int, string>

object classes

$dn : string|null

DN

$highlighted : array<string|int, mixed>

list of highlighted attribute names

Return values
void

addExtraAttributeContent()

Adds any entry content to the element.

private addExtraAttributeContent(htmlElement $element, string $attributeName, AttributeType|null $schemaAttribute) : htmlElement
Parameters
$element : htmlElement

original element

$attributeName : string

attribute name

$schemaAttribute : AttributeType|null

schema attribute

Return values
htmlElement

enhanced element

applyPasswordHash()

Applies password hashing on the provided values.

private applyPasswordHash(array<string|int, mixed> $values, array<string|int, mixed> $hash) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>

values

$hash : array<string|int, mixed>

hash types

Return values
array<string|int, mixed>

hashed values

createNewNode()

Displays the content to create a new subnode.

private createNewNode(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON data

createNewNodeCheckAttributesStep()

Returns the content for the check attributes step of node creation.

private createNewNodeCheckAttributesStep(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON data

createNewNodeCheckObjectClassesStep()

Returns the content to select the object classes.

private createNewNodeCheckObjectClassesStep(string $dn[, string|null $errorMessage = null ][, string|null $rdnAttribute = null ][, array<string|int, mixed>|null $attributes = null ]) : string
Parameters
$dn : string

DN

$errorMessage : string|null = null

error if any

$rdnAttribute : string|null = null

RDN attribute name

$attributes : array<string|int, mixed>|null = null

attribute values

Return values
string

JSON data

createNewNodeGetObjectClassesStep()

Returns the content to select the object classes.

private createNewNodeGetObjectClassesStep(string $dn[, string|null $errorMessage = null ]) : string
Parameters
$dn : string

DN

$errorMessage : string|null = null

error if any

Return values
string

JSON data

createNodeData()

Creates the node data for the tree view.

private createNodeData(array<string|int, mixed> $attributes[, bool $open = false ][, mixed $noShortenFirst = false ][, array<string|int, mixed> $children = [] ]) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>

LDAP data

$open : bool = false

open node

$noShortenFirst : mixed = false
$children : array<string|int, mixed> = []

child LDAP data

Return values
array<string|int, mixed>

nodes

decodeBinaryAttributeValues()

Base 64 decodes attribute values.

private decodeBinaryAttributeValues(array<string|int, string> $encoded) : array<string|int, string>
Parameters
$encoded : array<string|int, string>

encoded data

Return values
array<string|int, string>

binary data

deleteNode()

Deletes a node in LDAP.

private deleteNode(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON

ensureWriteAccess()

Stops processing if no write access is allowed.

private ensureWriteAccess() : void
Return values
void

getAttributeContentField()

Returns the input fields for the attribute.

private getAttributeContentField(string $attributeName, array<string|int, mixed> $values, bool $required, bool $isMultiValue, bool $isMultiLine, AttributeType|null $schemaAttribute) : htmlElement
Parameters
$attributeName : string

attribute name

$values : array<string|int, mixed>

values

$required : bool

is required

$isMultiValue : bool

multi-value attribute

$isMultiLine : bool

textarea attribute

$schemaAttribute : AttributeType|null

schema attribute

Return values
htmlElement

content

getAttributeInputField()

Returns an input field for an LDAP attribute.

private getAttributeInputField(string $attributeName, string $value, bool $required, bool $isMultiLine, bool $isSingleValue, AttributeType|null $schemaAttribute, int $index) : htmlElement
Parameters
$attributeName : string

attribute name

$value : string

value

$required : bool

required

$isMultiLine : bool

is multi-line attribute

$isSingleValue : bool

is single value attribute

$schemaAttribute : AttributeType|null

schema attribute

$index : int

value position

Tags
throws
LAMException

error generating field

Return values
htmlElement

input field

getAttributeJpegInputField()

Returns an input field for a JPG image attribute.

private getAttributeJpegInputField(string $attributeName, string $value, int $index) : htmlElement
Parameters
$attributeName : string

attribute name

$value : string

value

$index : int

index

Tags
throws
LAMException

error writing image file

Return values
htmlElement

input field

getAttributePasswordInputField()

Returns an input field for a password attribute.

private getAttributePasswordInputField(string $attributeName, string $value, bool $required, bool $isSingleValue) : htmlElement
Parameters
$attributeName : string

attribute name

$value : string

value

$required : bool

required

$isSingleValue : bool

is single value attribute

Return values
htmlElement

input field

getInternalAttributesContent()

Returns the internal attributes.

private getInternalAttributesContent(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON

getMayAttributeNamesRecursive()

Gets a recursive list of may attribute names.

private getMayAttributeNamesRecursive(array<string|int, ObjectClass$objectClasses, string $objectClass) : array<string|int, mixed>
Parameters
$objectClasses : array<string|int, ObjectClass>

schema object classes

$objectClass : string

object class

Return values
array<string|int, mixed>

attribute names

getMustAttributeNamesRecursive()

Gets a recursive list of must attribute names.

private getMustAttributeNamesRecursive(array<string|int, ObjectClass$objectClasses, string $objectClass) : array<string|int, mixed>
Parameters
$objectClasses : array<string|int, ObjectClass>

schema object classes

$objectClass : string

object class

Return values
array<string|int, mixed>

attribute names

getNodeContent()

Returns the node content with the attribute listing.

private getNodeContent(string $dn[, htmlStatusMessage|null $message = null ]) : string
Parameters
$dn : string
$message : htmlStatusMessage|null = null

message to display

Return values
string

JSON

getNodeIcon()

Returns the node's icon.

private getNodeIcon(array<string|int, mixed> $attributes) : string
Parameters
$attributes : array<string|int, mixed>

LDAP data

Return values
string

icon

getNodes()

Lists LDAP nodes.

private getNodes(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON data

getPossibleNewAttributeNameOptions()

Returns the options for the drop-down to add a new attribute.

private getPossibleNewAttributeNameOptions(array<string|int, mixed> $objectClasses[, bool $includeMustAttributes = false ]) : array<string|int, mixed>
Parameters
$objectClasses : array<string|int, mixed>

object classes

$includeMustAttributes : bool = false

include required attributes

Return values
array<string|int, mixed>

list of options

getPossibleNewAttributeNameOptionsJson()

Returns the JSON for the possible new attributes select.

private getPossibleNewAttributeNameOptionsJson() : mixed
Return values
mixed

getProperAttributeName()

Returns the proper spelling of the attribute name.

private getProperAttributeName(string $attributeName) : string
Parameters
$attributeName : string

attribute name in lower-case

Return values
string

proper attribute name

getRootNodes()

Returns a list of root nodes for the tree view.

private getRootNodes() : string
Return values
string

JSON data

getSchemaAttributes()

Returns the schema attributes.

private getSchemaAttributes() : array<string|int, AttributeType>
Return values
array<string|int, AttributeType>

attributes

getSchemaObjectClasses()

Returns the schema object classes.

private getSchemaObjectClasses() : array<string|int, ObjectClass>
Return values
array<string|int, ObjectClass>

object classes

getSubNodes()

Returns the subnodes of the given DN.

private getSubNodes(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON data

handleSpecialAttributes()

Handles attributes that require specific operations.

private handleSpecialAttributes(string $dn, array<string|int, mixed> &$ldapChanges, array<string|int, mixed> $attributes, array<string|int, mixed> $schemaAttributes) : void
Parameters
$dn : string

DN

$ldapChanges : array<string|int, mixed>

changes

$attributes : array<string|int, mixed>

original attributes

$schemaAttributes : array<string|int, mixed>

schema definition for attributes

Return values
void

isAttributeRequired()

Returns if the attribute is required for the given list of object classes.

private isAttributeRequired(array<string|int, ObjectClass$schemaObjectClasses, AttributeType $schemaAttribute, array<string|int, mixed> $objectClasses) : bool
Parameters
$schemaObjectClasses : array<string|int, ObjectClass>

object class definitions

$schemaAttribute : AttributeType

schema attribute

$objectClasses : array<string|int, mixed>

list of object classes

Return values
bool

is required

isJpegAttribute()

Returns if the given attribute is a JPG image.

private isJpegAttribute(string $attributeName, AttributeType|null $schemaAttribute) : bool
Parameters
$attributeName : string

attribute name

$schemaAttribute : AttributeType|null

schema attribute

Return values
bool

is password

isMultiLineAttribute()

Returns if the given attribute is multi-line.

private isMultiLineAttribute(string $attributeName, AttributeType|null $schemaAttribute) : bool
Parameters
$attributeName : string

attribute name

$schemaAttribute : AttributeType|null

schema attribute

Return values
bool

is multi-line

isMultiValueAttribute()

Returns if the given attribute is a multi-value one.

private isMultiValueAttribute(array<string|int, mixed>|null $values, AttributeType|null $schemaAttribute) : bool
Parameters
$values : array<string|int, mixed>|null

attribute values

$schemaAttribute : AttributeType|null

schema attribute

Return values
bool

is multi-value

isOrderedAttribute()

Returns if the attribute has ordered values.

private isOrderedAttribute(array<string|int, mixed> $values) : bool
Parameters
$values : array<string|int, mixed>

values

Return values
bool

is ordered

isPasswordAttribute()

Returns if the given attribute is a (hashable) password.

private isPasswordAttribute(string $attributeName) : bool
Parameters
$attributeName : string

attribute name

Return values
bool

is password

paste()

Performs paste operations.

private paste(string $dn) : string
Parameters
$dn : string

DN to paste

Return values
string

JSON data

saveAttributes()

Returns the node content with the attribute listing.

private saveAttributes(string $dn) : string
Parameters
$dn : string
Return values
string

JSON

Renders the search mask.

private search(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON

searchResults()

Renders the search results.

private searchResults(string $dn) : string
Parameters
$dn : string

DN

Return values
string

JSON

searchResultsAsList()

Returns the search results as list.

private searchResultsAsList(array<string|int, mixed> $results, array<string|int, mixed> $attributes, htmlResponsiveRow $row) : string
Parameters
$results : array<string|int, mixed>

results

$attributes : array<string|int, mixed>

attribute list to show

$row : htmlResponsiveRow

content

Return values
string

JSON

searchResultsAsTable()

Returns the search results as table.

private searchResultsAsTable(array<string|int, mixed> $results, array<string|int, mixed> $attributes, htmlResponsiveRow $row) : string
Parameters
$results : array<string|int, mixed>

results

$attributes : array<string|int, mixed>

attribute list to show

$row : htmlResponsiveRow

content

Return values
string

JSON

searchResultsHeader()

Creates the header part of the search results.

private searchResultsHeader(string $dn, string $filter) : htmlResponsiveRow
Parameters
$dn : string

search base

$filter : string

LDAP filter

Return values
htmlResponsiveRow

content

sortNodes()

Sorts the given node array by DN.

private sortNodes(array<string|int, mixed> &$nodes) : void
Parameters
$nodes : array<string|int, mixed>

nodes

Return values
void

validateDn()

Stops processing if DN is invalid.

private validateDn(string $dn) : void
Parameters
$dn : string

DN

Return values
void

Search results