Prev | Current Page 507 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

This feat is accomplished with the function
ldap_mod_del(), introduced next.
Deleting Entry Attributes
The ldap_mod_del() function removes the value of an entity instead of an entire
object. Its prototype follows:
boolean ldap_mod_del(resource link_id, string dn, array entry)
This limitation means it is used more often than ldap_delete() because it is much
more likely that attributes will require removal rather than entire objects. In the
following example, user John Wayne??™s company attribute is deleted:
$dn = "cn=John Wayne,ou=People,dc=OpenLDAP,dc=org";
ldap_mod_delete($connection, $dn, array("company"));
In the following example, all entries of the multivalued attribute mail are removed:
$dn = "cn=John Wayne,ou=People,dc=OpenLDAP,dc=org ";
$attrs["mail"] = array();
ldap_mod_delete($connection, $dn, $attrs);
To remove just a single value from a multivalued attribute, you must specifically
designate that value, like so:
$dn = "cn=John Wayne,ou=People,dc=OpenLDAP,dc=org ";
$attrs["mail"] = "pilgrim@example.com";
ldap_mod_delete($connection, $dn, $attrs);
440 CHAPTER 17 ?–  PHP AND LDAP
Working with the Distinguished Name
It??™s sometimes useful to learn more about the DN of the object you??™re working with.
Several functions are available for doing just this, each of which is introduced in
this section.
Converting the DN to a Readable Format
The ldap_dn2ufn() function converts a DN to a more readable format.


Pages:
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519