In our LDAP server not all attributes have been created in the =
objectclass I need to update.   For example:

homeInfo objectclass exists for the user, but attribute mobile may not.  =
You can't update an attribute if it doe not exist.  So you have to =
create it first.  I may also need to create the objectclass.  To do that =
I first query the CN (user record) pull back the objectclass attribute.  =
>From there I treat that as list and look for the ojectclass that I need =
in the list.  If it does not exists then I create the objectclass.  I =
would like to do the same thing with the attributes that I need to =
create.  I would like to query the CN record and pull back all of the =
attributes for one objectclass and then evaulate what attributes I need =
to the list.  If one does not exists then create it before I try to =
update it.

Here is the code I have so for.  It will query the LDAP sever pull back =
the objectclass list for a CN record then loop over the two =
objectclasses I need to exists.  If not then create objectclass.  If the =
objectclass did not exists then of course I need to loop over all of the =
attributes and create each one.

The problem lies if the objectclass already exists, but dome of the =
attributes does not.  They will vary form CN to CN.

<!--- Include file with all query and modify attributes --->
<cfinclude template=3D"/rootpha/include/cfm/inc_LdapQryAttributes.cfm">

<cfset Request.DN =3D GetLDAPName.dn>
=20
<cfldap action=3D"QUERY"
 name=3D"GetObjects"
 scope=3D"SUBTREE"=20
 attributes=3D"objectClass,dn"
 filter=3D"(cn=3D#Request.NTUserName#)"
 sort=3D"sn ASC"
 start=3D"ou=3DUSERS,o=3DPMH"
 server=3D"meta01"
 timeout=3D"2"
 username=3D""
   password=3D"">
=20
<cfset VerifyObjectClass =3D "homeInfo,phweb">
<cfloop index=3D"CreateObjectClass" list=3D"#VerifyObjectClass#">
 <cfif ListContainsNoCase(GetObjects.objectclass,CreateObjectClass) EQ 0>
  <cfldap action=3D"MODIFY"
       DN=3D"#GetObjects.DN#"
       attributes=3D"objectClass=3D#CreateObjectClass#"
   modifytype=3D"add"
   delimiter=3D"," =20
   server=3D"meta01"
   username=3D""
   password=3D"">
  =20
  <cfloop index=3D"Attribute" list=3D"#LdapQryAttributes#">
   <cfldap action=3D"MODIFY"
          DN=3D"#GetObjects.DN#"
          attributes=3D"#Attribute#=3D0"
          modifytype=3D"ADD"=20
          server=3D"meta01"
          username=3D""
          password=3D"">
  </cfloop>
 </cfif>    =20
</cfloop>=20

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192019
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to