JLDAP

Extends \JObject

LDAP client class

This class allows for simple but smart objects with get and set methods and an internal error handler.

package

Joomla.Platform

subpackage

Client

since

11.1

Methods

__construct

Class constructor, overridden in descendant classes.

__construct(mixed $properties = null) 
inherited
since

11.1

Arguments

$properties

mixedEither and associative array or another object to set the initial properties of the object.

__toString

Magic method to convert the object to a string gracefully.

__toString() : string
inherited deprecated
since

11.1

deprecated

12.3 Classes should provide their own __toString() implementation.

Response

stringThe classname.

add

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

add(string $dn, array $entry) : boolean

Arguments

$dn

stringThe DN of the entry to add the attribute

$entry

arrayAn array of arrays with attributes to add

Response

booleanResult of operation

anonymous_bind

Anonymously binds to LDAP directory

anonymous_bind() : array
since

11.1

Response

array

bind

Binds to the LDAP directory

bind(string $username = null, string $password = null, string $nosub) : boolean
since

11.1

Arguments

$username

stringThe username

$password

stringThe password

$nosub

string...

Response

boolean

close

Close the connection

close() : void
since

11.1

compare

Compare an entry and return a true or false result

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

11.1

Arguments

$dn

stringThe DN which contains the attribute you want to compare

$attribute

stringThe attribute whose value you want to compare

$value

stringThe value you want to check against the LDAP attribute

Response

mixedresult of comparison (true, false, -1 on error)

connect

Connect to server

connect() : boolean
since

11.1

Response

booleanTrue if successful

create

Create a new DN

create(string $dn, array $entries) : boolean

Arguments

$dn

stringThe DN where you want to put the object

$entries

arrayAn array of arrays describing the object to add

Response

booleanResult of operation

def

Sets a default value if not alreay assigned

def(string $property, mixed $default = null) : mixed
inherited
since

11.1

Arguments

$property

stringThe name of the property.

$default

mixedThe default value.

Response

mixed

delete

Deletes a given DN from the tree

delete(string $dn) : boolean

Arguments

$dn

stringThe DN of the object you want to delete

Response

booleanResult of operation

generatePassword

Generates a LDAP compatible password

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

11.1

Arguments

$password

stringClear text password to encrypt

$type

stringType of password hash, either md5 or SHA

Response

stringEncrypted password

get

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

get(string $property, mixed $default = null) : mixed
inherited
since

11.1

see \JObject::getProperties()

Arguments

$property

stringThe name of the property.

$default

mixedThe default value.

Response

mixedThe value of the property.

getDN

Get the DN

getDN() : string
since

11.1

Response

stringThe current dn

getError

Get the most recent error message.

getError(integer $i = null, boolean $toString = true) : string
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Arguments

$i

integerOption error index.

$toString

booleanIndicates if JError objects should return their error message.

Response

stringError message

getErrorMsg

Returns the error message

getErrorMsg() : string
since

11.1

Response

stringerror message

getErrors

Return all errors, if any.

getErrors() : array
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Response

arrayArray of error messages or JErrors.

getProperties

Returns an associative array of object properties.

getProperties(boolean $public = true) : array
inherited
since

11.1

see \JObject::get()

Arguments

$public

booleanIf true, returns only the public properties.

Response

array

ipToNetAddress

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

ipToNetAddress(string $ip) : string
since

11.1

Arguments

$ip

stringIP Address (e.g. xxx.xxx.xxx.xxx)

Response

stringNet address

LDAPNetAddr

Extract readable network address from the LDAP encoded networkAddress attribute.

LDAPNetAddr(string $networkaddress) : array

Please keep this document block and author attribution in place.

Novell Docs, see: http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5624.html#sdk5624 for Address types: http://developer.novell.com/ndk/doc/ndslib/index.html?page=/ndk/doc/ndslib/schm_enu/data/sdk4170.html LDAP Format, String: taggedData = uint32String "#" octetstring byte 0 = uint32String = Address Type: 0= IPX Address; 1 = IP Address byte 1 = char = "#" - separator byte 2+ = octetstring - the ordinal value of the address Note: with eDirectory 8.6.2, the IP address (type 1) returns correctly, however, an IPX address does not seem to. eDir 8.7 may correct this. Enhancement made by Merijn van de Schoot: If addresstype is 8 (UDP) or 9 (TCP) do some additional parsing like still returning the IP address

author

Jay Burrell, Systems & Networks, Mississippi State University

since

11.1

Arguments

$networkaddress

stringThe network address

Response

array

modify

Modifies an entry and return a true or false result

modify(string $dn, string $attribute) : mixed
since

11.1

Arguments

$dn

stringThe DN which contains the attribute you want to modify

$attribute

stringThe attribute values you want to modify

Response

mixedresult of comparison (true, false, -1 on error)

read

Read all or specified attributes of given dn

read(string $dn, string $attribute = array()) : mixed
since

11.1

Arguments

$dn

stringThe DN of the object you want to read

$attribute

stringThe attribute values you want to read (Optional)

Response

mixedarray of attributes or -1 on error

remove

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

remove(string $dn, string $attribute) : mixed
since

11.1

Arguments

$dn

stringThe DN which contains the attribute you want to remove

$attribute

stringThe attribute values you want to remove

Response

mixedresult of comparison (true, false, -1 on error)

rename

Rename the entry

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

11.1

Arguments

$dn

stringThe DN of the entry at the moment

$newdn

stringThe DN of the entry should be (only cn=newvalue)

$newparent

stringThe full DN of the parent (null by default)

$deleteolddn

booleanDelete the old values (default)

Response

booleanResult of operation

replace

Replace an entry and return a true or false result

replace(string $dn, string $attribute) : mixed
since

11.1

Arguments

$dn

stringThe DN which contains the attribute you want to replace

$attribute

stringThe attribute values you want to replace

Response

mixedresult of comparison (true, false, -1 on error)

set

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

set(string $property, mixed $value = null) : mixed
inherited
since

11.1

Arguments

$property

stringThe name of the property.

$value

mixedThe value of the property to set.

Response

mixedPrevious value of the property.

setDN

Sets the DN with some template replacements

setDN(string $username, string $nosub) : void
since

11.1

Arguments

$username

stringThe username

$nosub

string...

setError

Add an error message.

setError(string $error) : void
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Arguments

$error

stringError message.

setProperties

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

setProperties(mixed $properties) : boolean
inherited
since

11.1

see \JObject::set()

Arguments

$properties

mixedEither an associative array or another object.

Response

boolean

toString

Converts the object to a string (the class name).

toString() : string
inherited deprecated
since

11.1

deprecated

12.1 Use magic method __toString()

see \JObject::__toString()

Response

string

Properties

host

Hostname of LDAP server

since

11.1

Type(s)

string

auth_method

Authorization Method to use

since

11.1

Type(s)

boolean

port

Port of LDAP server

since

11.1

Type(s)

integer

base_dn

Base DN (e.g. o=MyDir)

since

11.1

Type(s)

string

users_dn

User DN (e.g. cn=Users,o=MyDir)

since

11.1

Type(s)

string

search_string

Search String

since

11.1

Type(s)

string

use_ldapV3

Use LDAP Version 3

since

11.1

Type(s)

boolean

no_referrals

No referrals (server transfers)

since

11.1

Type(s)

boolean

negotiate_tls

Negotiate TLS (encrypted communications)

since

11.1

Type(s)

boolean

username

Username to connect to server

since

11.1

Type(s)

string

password

Password to connect to server

since

11.1

Type(s)

string

_resource

LDAP Resource Identifier

since

11.1

Type(s)

mixed

_dn

Current DN

since

11.1

Type(s)

string

_errors

An array of error messages or Exception objects.

inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Type(s)

array