Modifying LDAP Entries

The best way to illustrate adding, updating, and deleting LDAP entries is to build an example administrative interface that can perform all the aforementioned 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="o=airius.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>#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="Add" TYPE="Submit" VALUE="Add"> <INPUT NAME="Update" TYPE="Submit" VALUE="Update"> <INPUT NAME="Delete" TYPE="Submit" ...

Get Programming ColdFusion now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.