User Guide

Integrating Breeze with a directory service 31
8.
For each user listed in the directory service but not in Breeze, add the user to Breeze, as follows:
a
Obtain the user’s first name, last name, and login name from the directory service.
The Breeze login name is usually the users e-mail address.
b
Call the principal-update action, setting the type parameter equal to user.
Dont specify a
principal-id parameter; leaving out principal-id indicates that you are
adding a new user rather than updating an existing user.
c
Check the returned XML to ensure that the status code returned is "ok".
The following code demonstrates how to add a user to Breeze. It uses variables set up in
previous steps of this procedure, such as
baseurl. To keep the example clear and simple, this
code specifies the users information in the first few lines, rather than acquiring that
information from a directory service.
<cfset newlogin= "jake2@example.com">
<cfset newpass= "abcdefg">
<cfset newfirst= "Jake">
<cfset newlast= "Doe">
<cfhttp url="#baseurl#api/xml?
action=principal-update&accesskey=#accesskey#&first-name=#newfirst#
&last-name=#newlast#&has-children=0&login=#newlogin#
&type=user" method="post">
<cfhttpparam type="Cookie" name="BREEZESESSION" value="#loginCookie#">
</cfhttp>
<!--- Check for an okay status result. --->
<cfset xml= XmlParse(cfhttp.FileContent)>
<cfset resultsElement= XmlSearch(xml, "//status[@code='ok']")>
<cfif ArrayLen(resultsElement) ne 1>
<!--- No status code "ok" found. Check for other status codes and handle
errors. --->
</cfif>
9.
For each user listed in Breeze but not in the directory service, delete the user from Breeze by
calling the
principals-delete action and specifying the user’s ID. Check the returned XML
to ensure that the status code returned is
"ok".
The following code demonstrates how to delete a specified user:
<cfset userID= "503123">
<cfhttp url="#baseurl#api/xml?
action=principals-delete&accesskey=#accesskey#
&principal-id=#userID#" method="post">
<cfhttpparam type="Cookie" name="BREEZESESSION" value="#loginCookie#">
</cfhttp>
<!--- Check for an "ok" status code. --->
<cfset xml= XmlParse(cfhttp.FileContent)>
<cfset resultsElement= XmlSearch(xml, "//status[@code='ok']")>
<cfif ArrayLen(resultsElement) ne 1>
<!--- No status code "ok" found. Check for other status codes and handle
errors. --->
</cfif>