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');
Chapter 10
[ 291 ]
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 True
TLS negotiate_tls False
No Referrals no_referrals True
Base DN base_dn dc=example,dc=org
User DN users_dn cn=[username],dc=example,dc=org
When we create a new JLDAP object we have the option to pass an object to it with
the necessary settings.
Pages:
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400