LDAP (Lightweight Directory Application Protocol) is often associated with user authentication. While it is true that LDAP is used extensively for authentication, it can be used for a wide variety of applications.
We'll stick with the user theme, but instead of authenticating, we'll use an LDAP connection to create a listing of users and their telephone numbers.
Joomla! provides us with the JLDAP
class; this class allows us to connect to an LDAP server and browse the contents. To use the class we must import the corresponding library:
jimport('joomla.client.ldap');
Before we jump in head first, there is one more thing we need to take a look at. For the purpose of the following examples we will use an LDAP test server.
This screenshot depicts the LDAP tree we're interested in:
In order to interrogate the LDAP server we must connect to it. We'll assume the following settings are being used:
Setting |
JLDAP Setting Name |
Value |
---|---|---|
Host |
host |
192.168.0.2 |
Port |
port |
389 |
LDAP v3 |
use_ldapV3... |