User Guide

Table Of Contents
Updating an LDAP directory 535
Reviewing the code
The following table describes the code:
Updating a directory entry
The
cfldap tag lets you change the values of entry attributes. To do so, you specify the entry DN
in the
dn attribute, and list the attributes to change and their new values in the attributes
attribute.
The following example builds on the code that adds and deletes an entry. It can update one or
more of an entrys attributes. Because the UID is part of the DN, you cannot change it.
Code Description
<cfelseif Form.action is "Retrieve">
<cfldap name="GetEntry"
server=#myServer#
action="query"
attributes="cn,sn,mail,
telephonenumber,uid"
scope="subtree"
filter="uid=#Trim(Form.UID)#"
start="o=Airius.com">
<cfset fullNameValue=
GetEntry.cn[1]>
<cfset surnameValue=GetEntry.sn[1]>
<cfset emailValue=GetEntry.mail[1]>
<cfset phoneValue=
GetEntry.telephonenumber[1]>
<cfset uidValue=GetEntry.uid[1]>
If the user clicks Retrieve, queries the directory
and gets the information for the specified User ID.
Sets the form field’s
Value attribute to the
corresponding query column.
This example uses the array index [1] to identify
the first row of the GetEntry query object.
Because the query always returns only one row,
the index can be omitted.
<cfelseif Form.action is "Delete">
<cfldap action="delete"
dn="uid=#Trim(Form.UID)#,
ou=People, o=Airius.com"
server=#myServer#
username=#myUserName#
password="password">
<cfoutput><h3>Entry for User
ID #Form.UID# has been
deleted</h3></cfoutput>
The user clicks delete, deletes the entry with the
specified User ID and informs the user that the
entry was deleted.
&nbsp
<input type="Submit"
name="action"
value="Retrieve"
tabindex="7">
&nbsp
<input type="Submit"
name="action"
value="Delete"
tabindex="8"></td>
Displays submit buttons for the Retrieve and
Delete actions.