diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2011-07-06 17:18:18 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2011-07-06 17:18:18 +0100 |
commit | a538ca41792679ca44f6abbb0e44d848b5c3f5e3 (patch) | |
tree | c7786cce1b24208e7c84df731c4593d170931545 /pykolab/auth/__init__.py | |
parent | 6c6eb002a30c386ab8ca4629b8e88656dd9a7a7c (diff) | |
download | pykolab-a538ca41792679ca44f6abbb0e44d848b5c3f5e3.tar.gz |
Allow the mapping of secondary domain names back onto the primary domain name space authentication library
Diffstat (limited to 'pykolab/auth/__init__.py')
-rw-r--r-- | pykolab/auth/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py index b33c0be..be10efa 100644 --- a/pykolab/auth/__init__.py +++ b/pykolab/auth/__init__.py @@ -41,6 +41,9 @@ class Auth(object): """ self._auth = {} + # Placeholder mapping back to the primary domain name space + self.secondary_domains = {} + def authenticate(self, login): """ Verify login credentials supplied in login against the appropriate @@ -90,6 +93,10 @@ class Auth(object): else: section = domain + if self.secondary_domains.has_key(domain): + section = self.secondary_domains[domain] + domain = self.secondary_domains[domain] + if self._auth.has_key(domain) and not self._auth[domain] == None: return @@ -155,6 +162,10 @@ class Auth(object): # If no domains are found, the primary domain is used. if len(domains) < 1: domains = [(kolab_primary_domain, [])] + else: + for primary, secondaries in domains: + for secondary in secondaries: + self.secondary_domains[secondary] = primary return domains |