LDAP Functionality
| From: | Jeffrey Clowser | Date: | Thu, 01 Jun 2000 22:47:00 +0000 |
| Subject: | LDAP Functionality | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-877@lists.php.net to get a copy of this message | ||
Sorry if this is a rehash, but I didn't see it in the faq or the archives...
I've been playing with the LDAP functionality of PHP, and ran into
some limitations. Namely:
1. ldap_compare is not implemented. Not critical in most cases, but
it would be nice to have.
2. ldap_mod_rdn2/ldap_rename is not implemented. Makes it difficult
to implement a full featured LDAP management app. The only way
to rename an entry is to delete it and recreate it with the new
name, risking loss of the entry of the add fails.
3. Entry updating is somewhat problematic due to the way ldap modifies
are implemented - a typical example of a change someone may
want to make is (with purely made up attribute names):
Add a phone number to the "phone" attribute.
Replace the current value of "fax" with a new value.
Delete the attribute "cellphone".
remove a value in the "member" attribute.
It is reasonable to want the change to be all or nothing - i.e. if I
can't delete the cellphone attribute, don't make any of the changes.
This can be done with the C LDAP api. My options in PHP and the
problems I've run into are:
ldap_modify and ldap_mod_replace are not appropriate, since they will
not delete attributes/values.
If I use ldap_mod_add and ldap_mod_del, I can do everything, assuming
no errors. The problem is that if I make some modifications involving
both adds and deletes of values, but only want it to succeed as a whole,
I can't do this - i.e. with the example from above, I can
delete the cellphone attribute, but then may get an error making the
other changes.
I would like to see a function (lets call it ldap_mod) that takes
a connection ID, dn, and list of changes similar to the following:
<?
...
// purely fictional update with sample ops
// add a phone #
$changes[0]=("phone","add","555-1212");
// replace fax attrib
$changes[1]=("fax","replace","555-1234");
// remove cellphone attrib
$changes[2]=("cellphone","remove","");
// remove one value from the member attrib
$changes[3]=("member","delete","cn=jdoe,o=mycomp");
$result=ldap_mod($ldconn,$dn,$changes);
?>
What's the best way to make a request for these 3 functions (ldap_compare,
ldap_modrdn/ldap_rename, and ldap_mod) to be added to PHP?
Better yet, are there any references for developers of PHP itself (vs.
developing in the PHP language) so I can write these myself and contribute
them to the PHP project?
Thanks,
Jeff