From 8552c02a92f75813a299ce77dab69233926f2d7f Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" Date: Wed, 21 Sep 2011 12:17:41 +0100 Subject: Make sure we have a list of domains before attempting to search for anything Add auth.get_user_attributes() for more then one attribute. --- pykolab/auth/__init__.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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) -- cgit v1.1