LDAP

# Class: Ldap

Source Location: /lib/ldap.inc

### Class Overview

Ldap manages connection to LDAP and includes several helper functions.

### Methods

- __construct
- close
- cmp_array
- connect
- decrypt
- decrypt_login
- destroy
- encrypt
- encrypt_login
- new_rand
- search_units
- server
- __sleep
- __wakeup

### Class Details

[line 52]
Ldap manages connection to LDAP and includes several helper functions.
[ Top ]

### Class Methods

### constructor __construct [line 73]

`Ldap __construct( object $config)`

#### Parameters:

object | $config | an object of class Config

[ Top ]

### method close [line 125]

`void close( )`

Closes connection to server
[ Top ]

### method cmp_array [line 314]

`integer cmp_array( string $a, string $b)`

Helper function to sort the unit DNs

#### Tags:

return: | 0 if equal, 1 if $a is greater, -1 if $b is greater

#### Parameters:

string | $a | first argument to compare
string | $b | second argument to compare

[ Top ]

### method connect [line 90]

`mixed connect( string $user, string $passwd, [boolean $allowAnonymous = false])`

Connects to the server using the given username and password

#### Tags:

return: | if connect succeeds the server handle is returned, else false

#### Parameters:

string | $user | user name
string | $passwd | password
boolean | $allowAnonymous | specifies if anonymous binds are allowed

[ Top ]

### method decrypt [line 252]

`string decrypt( object $data)`

Decrypts a string

#### Tags:

return: | decrypted string

#### Parameters:

object | $data | string to decrypt

[ Top ]

### method decrypt_login [line 291]

`array decrypt_login( )`

Decrypts username and password

#### Tags:

return: | array(user name, password)

[ Top ]

### method destroy [line 300]

`void destroy( )`

Closes connection to LDAP server and deletes encrypted username/password
[ Top ]

### method encrypt [line 226]

`object encrypted encrypt( string $data)`

Encrypts a string

#### Tags:

return: | string

#### Parameters:

string | $data | string to encrypt

[ Top ]

### method encrypt_login [line 280]

`void encrypt_login( string $username, string $password)`

Encrypts username and password

#### Parameters:

string | $username | LDAP user name
string | $password | LDAP password

[ Top ]

### method new_rand [line 212]

`int new_rand( )`

Calculates a new value for rand

#### Tags:

return: | New random value

[ Top ]

### method search_units [line 135]

`array search_units( string $suffix)`

Returns an array with all organizational units under the given suffix

#### Tags:

return: | DNs of organizational units

#### Parameters:

string | $suffix | search suffix

[ Top ]

### method server [line 166]

`object connection server( )`

Returns the LDAP connection handle

#### Tags:

return: | handle

[ Top ]

### method __sleep [line 176]

`void __sleep( )`

Closes connection to LDAP server before serialization
[ Top ]

### method __wakeup [line 183]

`void __wakeup( )`

Reconnects to LDAP server when deserialized
[ Top ]

Documentation generated on Wed, 05 Aug 2009 19:53:00 +0200 by phpDocumentor 1.4.1