Does anyone have any suggestions?
-----Original Message-----
From: David Brown [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 27, 2005 4:02 PM
To: CF-Talk
Subject: List Attributes in an objectclass in LDAP
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192064
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54