LDAP Account Manager

Exporter
in package

Creates LDAP accounts for file upload.

Tags
author

Roland Gruber

Table of Contents

DATA  = 'data'
FILE  = 'file'
OUTPUT  = 'output'
STATUS  = 'status'
$attributes  : mixed
$baseDn  : mixed
$ending  : mixed
$filter  : mixed
$format  : mixed
$includeSystem  : mixed
$saveAsFile  : mixed
$searchScope  : mixed
__construct()  : mixed
Constructor.
doExport()  : string
Starts the export process.
formatMessage()  : string
Returns the HTML for an error message.
checkParameters()  : mixed
Checks the input parameters for validity.
escapeCsvAndAddQuotes()  : string
Escapes a CSV value and adds quotes around it.
getCsvOutput()  : mixed
Converts the given LDAP entries to CSV format.
getLDAPData()  : array<string|int, array<string|int, mixed>>
Returns the LDAP entries
getLdifOutput()  : mixed
Converts the given LDAP entries to LDIF format.
isPlainAscii()  : bool
Checks if the value is plain ASCII.
wrapLdif()  : mixed
Splits the LDIF line if needed.
writeDataAndReturnJson()  : mixed
Writes the entries to file/response and prints JSON.

Constants

OUTPUT

public mixed OUTPUT = 'output'

STATUS

public mixed STATUS = 'status'

Properties

$attributes

private mixed $attributes = null

$baseDn

private mixed $baseDn = null

$ending

private mixed $ending = null

$filter

private mixed $filter = null

$format

private mixed $format = null

$includeSystem

private mixed $includeSystem = false

$saveAsFile

private mixed $saveAsFile = false

$searchScope

private mixed $searchScope = null

Methods

__construct()

Constructor.

public __construct(string $baseDn, string $searchScope, string $filter, string $attributes, bool $includeSystem, bool $saveAsFile, string $format, string $ending) : mixed
Parameters
$baseDn : string

base DN

$searchScope : string

search scope (base, one, sub)

$filter : string

search filter

$attributes : string

attributes to return

$includeSystem : bool

include system attributes

$saveAsFile : bool

return as file

$format : string

output format (LDIF, CSV)

$ending : string

line endings (windows, unix)

Return values
mixed

doExport()

Starts the export process.

public doExport() : string
Return values
string

JSON result

formatMessage()

Returns the HTML for an error message.

public static formatMessage(string $type, string $title, string $message) : string
Parameters
$type : string

message type (e.g. INFO)

$title : string

title

$message : string

message

Return values
string

HTML

checkParameters()

Checks the input parameters for validity.

private checkParameters() : mixed
Tags
throws
LAMException

in case of errors

Return values
mixed

escapeCsvAndAddQuotes()

Escapes a CSV value and adds quotes around it.

private escapeCsvAndAddQuotes(string $value) : string
Parameters
$value : string

CSV value

Return values
string

escaped and quoted value

getCsvOutput()

Converts the given LDAP entries to CSV format.

private getCsvOutput(string &$entries, string $lineEnding) : mixed
Parameters
$entries : string

entries

$lineEnding : string

line ending

Return values
mixed

getLDAPData()

Returns the LDAP entries

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

LDAP entries

getLdifOutput()

Converts the given LDAP entries to LDIF format.

private getLdifOutput(string &$entries, string $lineEnding) : mixed
Parameters
$entries : string

entries

$lineEnding : string

line ending

Return values
mixed

isPlainAscii()

Checks if the value is plain ASCII.

private isPlainAscii(string $content) : bool
Parameters
$content : string

content to check

Return values
bool

is plain ASCII

wrapLdif()

Splits the LDIF line if needed.

private wrapLdif(string $content, string $lineEnding) : mixed
Parameters
$content : string

line content

$lineEnding : string

line ending

Return values
mixed

writeDataAndReturnJson()

Writes the entries to file/response and prints JSON.

private writeDataAndReturnJson(array<string|int, mixed> &$entries) : mixed
Parameters
$entries : array<string|int, mixed>

LDAP entries

Return values
mixed

Search results