Ldap manages connection to LDAP and includes several helper functions.

package LDAP

 Methods

Creates a new LDAP object.

__construct(object $config) 

Parameters

$config

object

an object of class Config

Closes connection to LDAP server before serialization

__sleep() 

Reconnects to LDAP server when deserialized

__wakeup() 

Closes connection to server

close() 

Connects to the server using the given username and password

connect(string $user, string $passwd, boolean $allowAnonymous) : mixed

Parameters

$user

string

user name

$passwd

string

password

$allowAnonymous

boolean

specifies if anonymous binds are allowed

Returns

mixedif connect succeeds the server handle is returned, else false

Decrypts a string

decrypt(object $data, string $prefix) : string

Parameters

$data

object

string to decrypt

$prefix

string

prefix for cookie names

Returns

stringdecrypted string

Closes connection to LDAP server and deletes encrypted username/password

destroy() 

Encrypts a string

encrypt(string $data, string $prefix) : object

Parameters

$data

string

string to encrypt

$prefix

string

prefix for cookie names

Returns

objectencrypted string

Calculates a new value for rand

new_rand() : int

Returns

intNew random value

Returns the LDAP connection handle

server() : object

Returns

objectconnection handle

 Properties

 

Object of Config to access preferences

$conf 

 

LDAP connection established

$is_connected 

 

LDAP password used for bind

$password 

 

Random number (changes on every page request)

$rand 

 

Server handle

$server 

 

LDAP username used for bind

$username