summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-11 16:05:45 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-11 16:06:52 +0100
commit40956adf14080053250465dede49436dad13e5ce (patch)
tree5023688a8cf537f3b5996f36e05c93f29afd4dae /pykolab
parent68c91575fca88dbb198ec2c32ef1dc7974c51014 (diff)
downloadpykolab-40956adf14080053250465dede49436dad13e5ce.tar.gz
Initialize Auth() after the configuration has been finalized.
Fix the kolab smtp access policy using legacy API calls
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/auth/__init__.py19
-rw-r--r--pykolab/auth/ldap/__init__.py8
2 files changed, 21 insertions, 6 deletions
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index 47f2322..6eaee64 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -149,11 +149,19 @@ class Auth(pykolab.base.Base):
self._auth._disconnect()
- def find_recipient(self, address):
+ def find_recipient(self, address, domain=None):
"""
Find one or more entries corresponding to the recipient address.
"""
- return self._auth.find_recipient(address)
+ if not domain == None:
+ self.connect(domain=domain)
+
+ result = self._auth.find_recipient(address)
+
+ if isinstance(result, list) and len(result) == 1:
+ return result[0]
+ else:
+ return result
def find_user(self, attr, value, **kw):
return self._auth._find_user(attr, value, domain=domain, **kw)
@@ -197,11 +205,14 @@ class Auth(pykolab.base.Base):
def domain_default_quota(self, domain):
return self._auth._domain_default_quota(domain)
+ def get_entry_attribute(self, domain, entry, attribute):
+ return self._auth.get_entry_attribute(entry, attribute)
+
def get_user_attribute(self, domain, user, attribute):
- return self._auth._get_user_attribute(user, attribute)
+ return self._auth.get_entry_attribute(user, attribute)
def get_user_attributes(self, domain, user, attributes):
- return self._auth._get_user_attributes(user, attributes)
+ return self._auth.get_entry_attributes(user, attributes)
def search_mail_address(self, domain, mail_address):
return self._auth._search_mail_address(domain, mail_address)
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 3d5b699..6bf9f01 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -277,13 +277,15 @@ class LDAP(pykolab.base.Base):
Get multiple attributes for an entry.
"""
+ print entry_id
entry_dn = self.entry_dn(entry_id)
+ print entry_dn
_search = self.ldap.search_ext(
entry_dn,
ldap.SCOPE_BASE,
- '(objectclass=*)',
- [ 'dn' ] + attributes
+ filterstr='(objectclass=*)',
+ attrlist=[ 'dn' ] + attributes
)
(
@@ -312,6 +314,8 @@ class LDAP(pykolab.base.Base):
the current entry.
"""
+ self._bind()
+
if not exclude_entry_id == None:
__filter_prefix = "(&"
__filter_suffix = "(!(%s=%s)))" % (