The CFlDAPtag is the route through which Cold Fusion can interact with LDAP servers. Using the CFLDAPtag, several types of actions are possible. These actions are specified by using values of the ACTIONattribute, including the following:
Query Searches a directory for information, This is the default action.
Add Adds entries to a directory.
Modify Modifies entries in a directory.
Modifydn Modifies the distinguished name of entries in the directory.
Delete Deletes entries from the directory.
To use any action except the Query action requires access to an LDAP server where you have permission to make modifications. For this reason, you will only work through a concrete example of the Query action after you finish covering the basics of the CfLDAPtag
Querying LDAP Servers with FLDAP
Now that you have reviewed the basics of the CFLDAPtag, let’s build a siIttple application to allow searches of the Bigfoot directory by name. For all matches, the name, state, country, organization, and e-mail address should be displayed . A First, you need a form in which users can specify the name they are searching for:
<FORM METHOD-POST ACTION·’submit.cfm’>
Name to search for:
<INPUT TYPE·’TEXT’ NAME·’~ame’>
Next, you need to build a simple template that queries the Bigfoot server based on the information provided by the user:
What happens here is really quite simple. The CFLDAP tag is built to specify the Four11 server and the Que ry action. The START attribute indicates that you are searching for any country. You select the attributesyou want from the directory with the ATIRIBUTES attribute. Finally, the FILTER attribute specifies that you are looking for a name that matches the name specified by the user in the form.
The CFOUTPUTblock displays the name of the person, the state if it is available, the country and, finally, the organization where available. For instance, if you search for entries that match the name Danesh, you get results like those in Figure 25.3.
Where Do We Go from Here’?
This chapter.wraps up our look at the use of ColdFusion to interact with Internet services including mail, HTTP, FfP, and LDAP.
The next section of the book looks at a variety of advanced subjects including dynamic expressions, ColdFusion scripting, scheduling events, creating a search engine, security, and Cold Fusion administration. We start this section with a look at evaluating dynamic expressions. Dynamic expression evaluation is a technique that enables expressions to be built dynamically by using string values, expressions, and operations. In this way, the exact nature of an expression can be created programmatically as a template is being processed.