Documentation

ConnectionLDAP Uses LdapUtils

Description of ConnectionLDAP

Tags
author

Hakuryo

Table of Contents

MOD_ADD  = 0
MOD_DEL  = 2
MOD_REPLACE  = 1
$connection  : mixed
$search_options  : mixed
__construct()  : mixed
Create a instance of ConnectionLDAP
add()  : bool
Create an LDAP entry
clear_ldap_result()  : array<string|int, mixed>
create_groupOfNames()  : mixed
delete()  : bool
Delete the ldap entry specified by $entry_dn
disconect()  : mixed
Close the ldap connection
format_password()  : mixed
fromFile()  : ConnectionLDAP
Create a instance of ConnectionLDAP from a ini file.
get_entry()  : stdclass
Retourne l'entree corespondant a $filter avec les attributs specifie dans $returnedAttrs.
get_root_dn()  : mixed
get_search_options()  : LdapSearchOptions
getLastError()  : mixed
modify()  : bool
Modify a LDAP entry
search()  : array<string|int, mixed>
Retourne le resultat de $filter avec les attribut specifie dans $returnedAttrs.

Constants

Properties

Methods

__construct()

Create a instance of ConnectionLDAP

public __construct(string $host, string $login, string $password[, LdapSearchOptions $search_options = null ]) : mixed
Parameters
$host : string

The LDAP server fqdn

$login : string

The user's distinguished name

$password : string

The user's password

$search_options : LdapSearchOptions = null

an instance of LdapSearchOptions

Tags
throws
Exception

if LDAP server can't be conntacted or if the connection using user's credentials fail.

Return values
mixed —

add()

Create an LDAP entry

public add(string $entry_dn, array<string|int, mixed> $ldap_entry_attr) : bool
Parameters
$entry_dn : string

The distinguished name of the entry

$ldap_entry_attr : array<string|int, mixed>

the attributes of the entry

Tags
throws
Exception

throw an exception on fail.

Return values
bool —

Return True on success.

clear_ldap_result()

public clear_ldap_result(mixed $entrys) : array<string|int, mixed>
Parameters
$entrys : mixed
Return values
array<string|int, mixed> —

create_groupOfNames()

public create_groupOfNames(string $name, string $target_ou, array<string|int, mixed> $members) : mixed
Parameters
$name : string
$target_ou : string
$members : array<string|int, mixed>
Return values
mixed —

delete()

Delete the ldap entry specified by $entry_dn

public delete(string $entry_dn) : bool
Parameters
$entry_dn : string

The distinguished name of the entry

Tags
throws
Exception

throw an exception on fail.

Return values
bool —

Return True on success.

disconect()

Close the ldap connection

public disconect() : mixed
Return values
mixed —

format_password()

public format_password(mixed $pass) : mixed
Parameters
$pass : mixed
Return values
mixed —

fromFile()

Create a instance of ConnectionLDAP from a ini file.

public static fromFile(string $path[, string $section = null ]) : ConnectionLDAP

The ini file must have HOST,USER,PWD keys

Parameters
$path : string

Path of the ini file

$section : string = null

Section to use on the ini file.

Return values
ConnectionLDAP —

get_entry()

Retourne l'entree corespondant a $filter avec les attributs specifie dans $returnedAttrs.

public get_entry(string $filter[, array<string|int, mixed> $returnedAttrs = ['*'] ]) : stdclass
Parameters
$filter : string

le filtre LDAP

$returnedAttrs : array<string|int, mixed> = ['*']

[Optionnel] Tableau d'attribut a retourner. Defaut = ['*']

Return values
stdclass —

retourne un stdClass vide si aucun resultat ne correspond a $filter

get_root_dn()

public get_root_dn() : mixed
Return values
mixed —

getLastError()

public getLastError() : mixed
Return values
mixed —

modify()

Modify a LDAP entry

public modify(string $entry_dn, array<string|int, mixed> $target_entry_attr, int $modify_type) : bool
Parameters
$entry_dn : string

The distinguished name of the entry

$target_entry_attr : array<string|int, mixed>

The attributes to modify and there values

$modify_type : int

can be one of the constant MOD_ADD,MOD_DEL,MOD_REPLACE of ConnectionLDAP

Tags
throws
Exception

throw an exception on fail.

Return values
bool —

Return True on success.

Retourne le resultat de $filter avec les attribut specifie dans $returnedAttrs.

public search(string $filter[, array<string|int, mixed> $returnedAttrs = ['*'] ]) : array<string|int, mixed>
Parameters
$filter : string

Filtre ldap

$returnedAttrs : array<string|int, mixed> = ['*']

[Optionnel] Tableau d'attribut a retourner. Defaut = ['*']

Tags
see
ldap_search
Return values
array<string|int, mixed> —

Tableau associatif avec les noms d'attributs ldap en tant que clef.

Search results