Exporter
in package
Creates LDAP accounts for file upload.
Tags
Table of Contents
- DATA = 'data'
- FILE = 'file'
- OUTPUT = 'output'
- STATUS = 'status'
- $attributes : string
- $baseDn : string
- $ending : string
- $filter : string
- $format : string
- $includeSystem : bool
- $saveAsFile : bool
- $searchScope : string
- __construct() : mixed
- Constructor.
- doExport() : string
- Starts the export process.
- formatMessage() : string
- Returns the HTML for an error message.
- checkParameters() : void
- Checks the input parameters for validity.
- escapeCsvAndAddQuotes() : string
- Escapes a CSV value and adds quotes around it.
- getCsvOutput() : string
- Converts the given LDAP entries to CSV format.
- getLDAPData() : array<string|int, array<string, string[]|string>>
- Returns the LDAP entries
- getLdifOutput() : string
- Converts the given LDAP entries to LDIF format.
- isPlainAscii() : bool
- Checks if the value is plain ASCII.
- wrapLdif() : string
- Splits the LDIF line if needed.
- writeDataAndReturnJson() : string
- Writes the entries to file/response and prints JSON.
Constants
DATA
private
mixed
DATA
= 'data'
FILE
private
mixed
FILE
= 'file'
OUTPUT
private
mixed
OUTPUT
= 'output'
STATUS
private
mixed
STATUS
= 'status'
Properties
$attributes
private
string
$attributes
$baseDn
private
string
$baseDn
$ending
private
string
$ending
$filter
private
string
$filter
$format
private
string
$format
$includeSystem
private
bool
$includeSystem
$saveAsFile
private
bool
$saveAsFile
$searchScope
private
string
$searchScope
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|null $title, string|null $message) : string
Parameters
- $type : string
-
message type (e.g. INFO)
- $title : string|null
-
title
- $message : string|null
-
message
Return values
string —HTML
checkParameters()
Checks the input parameters for validity.
private
checkParameters() : void
Tags
Return values
void —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(array<string|int, array<string, string[]|string>> &$entries, string $lineEnding) : string
Parameters
- $entries : array<string|int, array<string, string[]|string>>
-
entries
- $lineEnding : string
-
line ending
Return values
string —CSV
getLDAPData()
Returns the LDAP entries
private
getLDAPData() : array<string|int, array<string, string[]|string>>
Tags
Return values
array<string|int, array<string, string[]|string>> —LDAP entries
getLdifOutput()
Converts the given LDAP entries to LDIF format.
private
getLdifOutput(array<string|int, array<string, string[]|string>> &$entries, string $lineEnding) : string
Parameters
- $entries : array<string|int, array<string, string[]|string>>
-
entries
- $lineEnding : string
-
line ending
Return values
string —LDIF
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) : string
Parameters
- $content : string
-
line content
- $lineEnding : string
-
line ending
Return values
string —wrapped string
writeDataAndReturnJson()
Writes the entries to file/response and prints JSON.
private
writeDataAndReturnJson(array<string|int, array<string, string[]|string>> &$entries) : string
Parameters
- $entries : array<string|int, array<string, string[]|string>>
-
LDAP entries
Tags
Return values
string —JSON