summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-09-21 12:17:41 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-09-21 12:17:41 +0100
commit8552c02a92f75813a299ce77dab69233926f2d7f (patch)
treeab6114892bcaf879b55954106daf3a2ca79123fd
parent2733017d432ea32a0a7f42d164a70232364e8f60 (diff)
downloadpykolab-8552c02a92f75813a299ce77dab69233926f2d7f.tar.gz
Make sure we have a list of domains before attempting to search for anything
Add auth.get_user_attributes() for more then one attribute.
-rw-r--r--pykolab/auth/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index aa6e7ba..82e2f4a 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -91,6 +91,7 @@ class Auth(object):
section = 'kolab'
domain = conf.get('kolab', 'primary_domain')
else:
+ self.list_domains()
section = domain
if self.secondary_domains.has_key(domain):
@@ -140,6 +141,15 @@ class Auth(object):
self.connect(domain)
if self.secondary_domains.has_key(domain):
+ log.debug(
+ _("Using primary domain %s instead of secondary domain %s")
+ %(
+ self.secondary_domains[domain],
+ domain
+ ),
+ level=9
+ )
+
domain = self.secondary_domains[domain]
return self._auth[domain]._find_user(attr, value, domain=domain, **kw)
@@ -210,6 +220,14 @@ class Auth(object):
return self._auth[domain]._get_user_attribute(user, attribute)
+ def get_user_attributes(self, domain, user, attributes):
+ self.connect(domain=domain)
+
+ if self.secondary_domains.has_key(domain):
+ domain = self.secondary_domains[domain]
+
+ return self._auth[domain]._get_user_attributes(user, attributes)
+
def set_user_attribute(self, domain, user, attribute, value):
self.connect(domain=domain)