O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying LDAP Entries

The best way to illustrate adding, updating, and deleting LDAP entries is to build an example administrative interface that can perform these tasks. The main template of the application is a template named index.cfm, which is shown in Example 15-3. This template contains an HTML form with a single select box control containing the common names (first and last names) of each entry in the LDAP server. Below the select box are three buttons—one for adding a new entry, one for modifying an existing entry, and one for deleting an entry.

Example 15-3. Main LDAP administration template

<!--- Query the ldap server for all entries ---> <cfldap action="Query" name="GetEntries" server="localhost" attributes="dn,cn,sn,givenName" filter="(sn>=A)" start="dc=example,dc=com" scope="subtree" sort="sn, givenname"> <html> <head> <title>LDAP Administration</title> </head> <center> <h2>LDAP Administration</h2> <!--- If a message was passed from the action form, display it ---> <cfif IsDefined('URL.Message')> <cfoutput> <h3 style="color: red;">#Message#</h3> </cfoutput> </cfif> <!--- Display the common name for each entry in a multi-select box. Assign the DN to each option value ---> <form name="MyForm" action="Action.cfm" method="post"> <select name="dn" size="5"> <cfoutput query="GetEntries"> <option name="DN" value="#DN#">#CN#</option> </cfoutput> </select> <br> <input name="submit" type="Submit" value="Add"> <input name="submit" type="Submit" value="Update"> <input name="submit" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required