[Zope-CVS] SVN: ldapadapter/trunk/ Added bindDN and bindPassword
Roger Ineichen
roger at projekt01.ch
Sat Oct 9 11:17:35 EDT 2004
Log message for revision 27840:
Added bindDN and bindPassword
Changed:
U ldapadapter/trunk/interfaces.py
U ldapadapter/trunk/utility.py
-=-
Modified: ldapadapter/trunk/interfaces.py
===================================================================
--- ldapadapter/trunk/interfaces.py 2004-10-09 15:13:25 UTC (rev 27839)
+++ ldapadapter/trunk/interfaces.py 2004-10-09 15:17:34 UTC (rev 27840)
@@ -36,6 +36,14 @@
default=389,
required=True,
)
+ bindDN = TextLine(
+ title=_("Bind DN"),
+ default=u'',
+ )
+ bindPassword = TextLine(
+ title=_("Bind password"),
+ default=u'',
+ )
useSSL = Bool(
title=_("Use SSL"),
default=False,
Modified: ldapadapter/trunk/utility.py
===================================================================
--- ldapadapter/trunk/utility.py 2004-10-09 15:13:25 UTC (rev 27839)
+++ ldapadapter/trunk/utility.py 2004-10-09 15:17:34 UTC (rev 27840)
@@ -50,9 +50,11 @@
class LDAPAdapter(object):
implements(ILDAPAdapter)
- def __init__(self, host='localhost', port=389, useSSL=False):
+ def __init__(self, host='localhost', port=389, bindDN='', bindPassword='', useSSL=False):
self.host = host
self.port = port
+ self.bindDN = bindDN
+ self.bindPassword = bindPassword
self.useSSL = useSSL
def connect(self, dn, password=None):
@@ -68,6 +70,8 @@
# TODO: conn.set_option(OPT_REFERRALS, 1)
# Bind the connection to the dn
+ if not dn:
+ dn = self.bindDN
conn.simple_bind_s(dn, password)
# May raise INVALID_CREDENTIALS, SERVER_DOWN, ...
More information about the Zope-CVS
mailing list