class JLDAP extends JObject


Located at : UKNOWVA_ROOT/libraries/joomla/client/ldap.php

LDAP client class

Properties

string $host
bool $auth_method
int $port
string $base_dn
string $users_dn
string $search_string
boolean $use_ldapV3
boolean $no_referrals
boolean $negotiate_tls
string $username
string $password
mixed $_resource
string $_dn
$debug

Methods

__construct(object $configObj = null)

Constructor

string
__toString()

Magic method to convert the object to a string gracefully.

from JObject
mixed
def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

from JObject
mixed
get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

from JObject
array
getProperties(boolean $public = true)

Returns an associative array of object properties.

from JObject
string
getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

from JObject
array
getErrors()

Return all errors, if any.

from JObject
mixed
set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

from JObject
boolean
setProperties(mixed $properties)

Set the object properties based on a named array/hash.

from JObject
void
setError(string $error)

Add an error message.

from JObject
string
toString() deprecated

No description

from JObject
boolean
connect()

Connect to server

close()

Close the connection

setDN(string $username, $nosub)

Sets the DN with some template replacements

string
getDN()

Get the DN

anonymous_bind()

Anonymously binds to LDAP directory

boolean
bind($username = null, $password = null, $nosub)

Binds to the LDAP directory

Search
simple_search(string $search)

Perform an LDAP search using comma seperated search strings

array
search(array $filters, string $dnoverride = null)

Perform an LDAP search

mixed
replace(string $dn, string $attribute)

Replace an entry and return a true or false result

mixed
modify(string $dn, string $attribute)

Modifies an entry and return a true or false result

mixed
remove(string $dn, string $attribute)

Removes attribute value from given dn and return a true or false result

mixed
compare(string $dn, string $attribute, string $value)

Compare an entry and return a true or false result

array
read(string $dn, string $attribute = array())

Read all or specified attributes of given dn

boolean
delete(string $dn)

Deletes a given DN from the tree

boolean
create(string $dn, array $entries)

Create a new DN

boolean
add(string $dn, array $entry)

Add an attribute to the given DN Note: DN has to exist already

boolean
rename(string $dn, string $newdn, string $newparent, boolean $deleteolddn)

Rename the entry

string
getErrorMsg()

Returns the error message

string
ipToNetAddress(string $ip)

Converts a dot notation IP address to net address (e.g. for Netware, etc)

LDAPNetAddr($networkaddress)

Extract readable network address from the LDAP encoded networkAddress attribute.

string
generatePassword(string $password, string $type = 'md5')

Generates a LDAP compatible password

Details

at line 108
JObject __construct(object $configObj = null)

Constructor

Parameters

object $configObj An object of configuration variables

Return Value

JObject

in JObject at line 56
string __toString()

Magic method to convert the object to a string gracefully.

Return Value

string The classname.

in JObject at line 70
mixed def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed

in JObject at line 88
mixed get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed The value of the property.

See also

getProperties()

in JObject at line 107
array getProperties(boolean $public = true)

Returns an associative array of object properties.

Parameters

boolean $public If true, returns only the public properties.

Return Value

array

See also

get()

in JObject at line 133
string getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

Parameters

integer $i Option error index.
boolean $toString Indicates if JError objects should return their error message.

Return Value

string Error message

in JObject at line 165
array getErrors()

Return all errors, if any.

Return Value

array Array of error messages or JErrors.

in JObject at line 180
mixed set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $property The name of the property.
mixed $value The value of the property to set.

Return Value

mixed Previous value of the property.

in JObject at line 198
boolean setProperties(mixed $properties)

Set the object properties based on a named array/hash.

Parameters

mixed $properties Either an associative array or another object.

Return Value

boolean

See also

set()

in JObject at line 222
void setError(string $error)

Add an error message.

Parameters

string $error Error message.

Return Value

void

in JObject at line 235
string toString() deprecated

deprecated 12.1 Use magic method __toString()

Return Value

string

See also

__toString()

at line 130
boolean connect()

Connect to server

Return Value

boolean True if successful

at line 163
close()

Close the connection

at line 176
setDN(string $username, $nosub)

Sets the DN with some template replacements

Parameters

string $username The username
$nosub

at line 193
string getDN()

Get the DN

Return Value

string The current dn

at line 203
anonymous_bind()

Anonymously binds to LDAP directory

at line 217
boolean bind($username = null, $password = null, $nosub)

Binds to the LDAP directory

Parameters

$username
$password
$nosub

Return Value

boolean Result

Perform an LDAP search using comma seperated search strings

Parameters

string $search search string of search values

Return Value

Search results

Perform an LDAP search

Parameters

array $filters Search Filters (array of strings)
string $dnoverride DN Override

Return Value

array Multidimensional array of results

at line 313
mixed replace(string $dn, string $attribute)

Replace an entry and return a true or false result

Parameters

string $dn dn The DN which contains the attribute you want to replace
string $attribute attribute The attribute values you want to replace

Return Value

mixed result of comparison (true, false, -1 on error)

at line 326
mixed modify(string $dn, string $attribute)

Modifies an entry and return a true or false result

Parameters

string $dn dn The DN which contains the attribute you want to modify
string $attribute attribute The attribute values you want to modify

Return Value

mixed result of comparison (true, false, -1 on error)

at line 339
mixed remove(string $dn, string $attribute)

Removes attribute value from given dn and return a true or false result

Parameters

string $dn dn The DN which contains the attribute you want to remove
string $attribute attribute The attribute values you want to remove

Return Value

mixed result of comparison (true, false, -1 on error)

at line 355
mixed compare(string $dn, string $attribute, string $value)

Compare an entry and return a true or false result

Parameters

string $dn dn The DN which contains the attribute you want to compare
string $attribute attribute The attribute whose value you want to compare
string $value value The value you want to check against the LDAP attribute

Return Value

mixed result of comparison (true, false, -1 on error)

at line 367
array read(string $dn, string $attribute = array())

Read all or specified attributes of given dn

Parameters

string $dn dn The DN of the object you want to read
string $attribute attribute The attribute values you want to read (Optional)

Return Value

array of attributes or -1 on error

at line 387
boolean delete(string $dn)

Deletes a given DN from the tree

Parameters

string $dn The DN of the object you want to delete

Return Value

boolean Result of operation

at line 399
boolean create(string $dn, array $entries)

Create a new DN

Parameters

string $dn The DN where you want to put the object
array $entries An array of arrays describing the object to add

Return Value

boolean Result of operation

at line 412
boolean add(string $dn, array $entry)

Add an attribute to the given DN Note: DN has to exist already

Parameters

string $dn The DN of the entry to add the attribute
array $entry An array of arrays with attributes to add

Return Value

boolean Result of operation

at line 427
boolean rename(string $dn, string $newdn, string $newparent, boolean $deleteolddn)

Rename the entry

Parameters

string $dn The DN of the entry at the moment
string $newdn The DN of the entry should be (only cn=newvalue)
string $newparent The full DN of the parent (null by default)
boolean $deleteolddn Delete the old values (default)

Return Value

boolean Result of operation

at line 437
string getErrorMsg()

Returns the error message

Return Value

string error message

at line 449
string ipToNetAddress(string $ip)

Converts a dot notation IP address to net address (e.g. for Netware, etc)

Parameters

string $ip IP Address (e.g. xxx.xxx.xxx.xxx)

Return Value

string Net address

at line 481
LDAPNetAddr($networkaddress)

Extract readable network address from the LDAP encoded networkAddress attribute.

Parameters

$networkaddress

at line 538
string generatePassword(string $password, string $type = 'md5')

Generates a LDAP compatible password

Parameters

string $password Clear text password to encrypt
string $type Type of password hash, either md5 or SHA

Return Value

string Encrypted password