JLDAP
Extends \JObjectLDAP 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)
since |
11.1 |
---|
Arguments
- $properties
mixed
Either 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
since |
11.1 |
---|---|
deprecated |
12.3 Classes should provide their own __toString() implementation. |
Response
string
The classname.
add
Add an attribute to the given DN Note: DN has to exist already
add(string $dn, array $entry) : boolean
Arguments
- $dn
string
The DN of the entry to add the attribute- $entry
array
An array of arrays with attributes to add
Response
boolean
Result 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
string
The username- $password
string
The 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
string
The DN which contains the attribute you want to compare- $attribute
string
The attribute whose value you want to compare- $value
string
The value you want to check against the LDAP attribute
Response
mixed
result of comparison (true, false, -1 on error)
connect
Connect to server
connect() : boolean
since |
11.1 |
---|
Response
boolean
True if successful
create
Create a new DN
create(string $dn, array $entries) : boolean
Arguments
- $dn
string
The DN where you want to put the object- $entries
array
An array of arrays describing the object to add
Response
boolean
Result of operation
def
Sets a default value if not alreay assigned
def(string $property, mixed $default = null) : mixed
since |
11.1 |
---|
Arguments
- $property
string
The name of the property.- $default
mixed
The default value.
Response
mixed
delete
Deletes a given DN from the tree
delete(string $dn) : boolean
Arguments
- $dn
string
The DN of the object you want to delete
Response
boolean
Result of operation
generatePassword
Generates a LDAP compatible password
generatePassword(string $password, string $type = 'md5') : string
since |
11.1 |
---|
Arguments
- $password
string
Clear text password to encrypt- $type
string
Type of password hash, either md5 or SHA
Response
string
Encrypted 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
since |
11.1 |
---|---|
see | \JObject::getProperties() |
Arguments
- $property
string
The name of the property.- $default
mixed
The default value.
Response
mixed
The value of the property.
getDN
Get the DN
getDN() : string
since |
11.1 |
---|
Response
string
The current dn
getError
Get the most recent error message.
getError(integer $i = null, boolean $toString = true) : string
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Arguments
- $i
integer
Option error index.- $toString
boolean
Indicates if JError objects should return their error message.
Response
string
Error message
getErrorMsg
Returns the error message
getErrorMsg() : string
since |
11.1 |
---|
Response
string
error message
getErrors
Return all errors, if any.
getErrors() : array
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Response
array
Array of error messages or JErrors.
getProperties
Returns an associative array of object properties.
getProperties(boolean $public = true) : array
since |
11.1 |
---|---|
see | \JObject::get() |
Arguments
- $public
boolean
If 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
string
IP Address (e.g. xxx.xxx.xxx.xxx)
Response
string
Net 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
string
The 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
string
The DN which contains the attribute you want to modify- $attribute
string
The attribute values you want to modify
Response
mixed
result 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
string
The DN of the object you want to read- $attribute
string
The attribute values you want to read (Optional)
Response
mixed
array 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
string
The DN which contains the attribute you want to remove- $attribute
string
The attribute values you want to remove
Response
mixed
result 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
string
The DN of the entry at the moment- $newdn
string
The DN of the entry should be (only cn=newvalue)- $newparent
string
The full DN of the parent (null by default)- $deleteolddn
boolean
Delete the old values (default)
Response
boolean
Result of operation
replace
Replace an entry and return a true or false result
replace(string $dn, string $attribute) : mixed
since |
11.1 |
---|
Arguments
- $dn
string
The DN which contains the attribute you want to replace- $attribute
string
The attribute values you want to replace
Response
mixed
result of comparison (true, false, -1 on error)
search
Perform an LDAP search
search(array $filters, string $dnoverride = null) : array
since |
11.1 |
---|
Arguments
- $filters
array
Search Filters (array of strings)- $dnoverride
string
DN Override
Response
array
Multidimensional array of results
set
Modifies a property of the object, creating it if it does not already exist.
set(string $property, mixed $value = null) : mixed
since |
11.1 |
---|
Arguments
- $property
string
The name of the property.- $value
mixed
The value of the property to set.
Response
mixed
Previous value of the property.
setDN
Sets the DN with some template replacements
setDN(string $username, string $nosub) : void
since |
11.1 |
---|
Arguments
- $username
string
The username- $nosub
string
...
setError
Add an error message.
setError(string $error) : void
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Arguments
- $error
string
Error message.
setProperties
Set the object properties based on a named array/hash.
setProperties(mixed $properties) : boolean
since |
11.1 |
---|---|
see | \JObject::set() |
Arguments
- $properties
mixed
Either an associative array or another object.
Response
boolean
simple_search
Perform an LDAP search using comma separated search strings
simple_search(string $search) : array
since |
11.1 |
---|
Arguments
- $search
string
search string of search values
Response
array
Search results
toString
Converts the object to a string (the class name).
toString() : 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.