11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 17 • <strong>PHP</strong> AND LDAPwww.it-ebooks.infoThe new_parent parameter specifies the newly renamed entry’s parent object. If the parameterdelete_old_rdn is set to TRUE, the old entry is deleted; otherwise, it will remain in the directory as anondistinguished value of the renamed entry.Deleting LDAP DataAlthough it is rare, data is occasionally removed from the directory. Deletion can take place on twolevels—removal of an entire object, or removal of attributes associated with an object. Two functions areavailable for performing these tasks, ldap_delete() and ldap_mod_del(), respectively.Deleting EntriesThe ldap_delete() function removes an entire entry from the LDAP directory, returning TRUE on successand FALSE on failure. Its prototype follows:Boolean ldap_delete(resource link_id, string dn)An example follows:$dn = "cn=John Wayne,ou=People,dc=WJGilmore,dc=com";ldap_delete($connection, $dn) or die("Could not delete entry!");Completely removing a directory object is rare; you’ll probably want to remove object attributesrather than an entire object. This feat is accomplished with the ldap_mod_del() function.Deleting Entry AttributesThe ldap_mod_del() function removes the value of an entity instead of an entire object. Its prototypefollows: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 thatattributes will require removal rather than entire objects. In the following example, user John Wayne’scompany attribute is deleted:$dn = "cn=John Wayne, ou=People,dc=WJGilmore,dc=com";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=WJGilmore,dc=com ";$attrs["mail"] = array();ldap_mod_delete($connection, $dn, $attrs);To remove just a single value from a multivalued attribute, you must specifically designate thatvalue, like so:362

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!