Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LDAP access with coldfusion

Status
Not open for further replies.

jdaniels

Technical User
Apr 23, 2002
63
0
0
GB
Hi,

In writing a CF Active Directory client, it seems the only properties I can access are the current 'cn' (in this case, Users), the 'givenname' and the 'sn'. Here's the code:

[cfldap action="QUERY"
name="getUsers"
start="cn=John Smith, cn=users, dc=pdc, dc=mycompany,dc=com"
scope="subtree"
attributes="cn, sn, givenname, c"
username="trusteduser"
password="password"
server="ldapservername"
sort = "cn ASC"
port="389"
timeout="10"]

Then I display the results:

[cfoutput query="getUsers"]
#cn#: Mr.#sn# (#givenname#) from #c# ![/cfoutput]

Which displays only:

John Smith: Mr Smith (John) from !

As you can see, it omits the country property value. I have looked in the active directory schema with ADSI Edit, which states that Country name is represented by 'c' and that it has some data in it for the user John Smith. Yet it doesn't get displayed.

Do I need to set it's accessibility somehow, or some other workaround? I realise this is also a coldfusion query and have posted there also.

Thanks,

Jonathan Daniels
 
Hey, you might want to try adding
filter= "objectClass=*"
Also trying setting attributes to *,
this will cause the LDAP query to bring back a structure of
name,value pairs... you can then loop through the pairs like this:

<cfoutput query=&quot;getUsers&quot;>
#name#, #value#
</cfoutput>

If the country doesn't come out then.. it must be a security issue or, the entry doesn't have a country value... LDAP seems to disregard attributes that are left blank...

Ryan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top