[Zope] Zope and LDAP

John Adams jadams@inktomi.com
Thu, 9 May 2002 19:01:41 -0700 (PDT)


One more question for everyone.

How do I access data in an LDAP database from Zope without using LDAP
UserFolder? I don't want people to have to log in to view our LDAP server
(it's a phonebook app), but adding LDAPUserFolder to a folder seems to
force people into authenticating.

I'd like to just do:

import ldap

l = ldap.initialize("ldap://ldap.inktomi.com:389")
l.simple_bind_s("","")
res = l.search_s("ou=People, dc=inktomi, dc=com", ldap.SCOPE_ONELEVEL,
"uid=%s" % requestor_uid);

print res[1]["userpassword"][0]

...in a python script, after a form is posted, based on whateveer
requestor_uid is (filled out in a previous form), but it's strange, I get
a popup for an authentication box (even when the script has full proxy
rights as manager) when this attempts to initalize.

The error I get after I abort the login popup is:

Error Type: Unauthorized
Error Value: You are not allowed to access initialize in this context

(everything works in command-line python, btw.)

Thanks again.
--john