Changeset View
Changeset View
Standalone View
Standalone View
pykolab/auth/__init__.py
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | def authenticate(self, login): | ||||
if len(login) == 3: | if len(login) == 3: | ||||
# The realm has not been specified. See if we know whether or not | # The realm has not been specified. See if we know whether or not | ||||
# to use virtual_domains, as this may be a cause for the realm not | # to use virtual_domains, as this may be a cause for the realm not | ||||
# having been specified separately. | # having been specified separately. | ||||
use_virtual_domains = conf.get('imap', 'virtual_domains') | use_virtual_domains = conf.get('imap', 'virtual_domains') | ||||
# TODO: Insert debug statements | # TODO: Insert debug statements | ||||
#if use_virtual_domains == "userid": | #if use_virtual_domains == "userid": | ||||
#print "# Derive domain from login[0]" | #print "# Derive domain from login[0]" | ||||
Lint: PEP8 E116: unexpected indentation (comment) | |||||
#elif not use_virtual_domains: | #elif not use_virtual_domains: | ||||
#print "# Explicitly do not user virtual domains??" | #print "# Explicitly do not user virtual domains??" | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
#else: | #else: | ||||
## Do use virtual domains, derive domain from login[0] | ## Do use virtual domains, derive domain from login[0] | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
Lint: PEP8 E266 too many leading '#' for block comment Lint: PEP8 E266: too many leading '#' for block comment | |||||
#print "# Derive domain from login[0]" | #print "# Derive domain from login[0]" | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
if len(login[0].split('@')) > 1: | if len(login[0].split('@')) > 1: | ||||
domain = login[0].split('@')[1] | domain = login[0].split('@')[1] | ||||
elif len(login) >= 4: | elif len(login) >= 4: | ||||
domain = login[3] | domain = login[3] | ||||
else: | else: | ||||
domain = conf.get("kolab", "primary_domain") | domain = conf.get("kolab", "primary_domain") | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | def find_folder_resource(self, folder): | ||||
result = self._auth.find_folder_resource(folder) | result = self._auth.find_folder_resource(folder) | ||||
if isinstance(result, list) and len(result) == 1: | if isinstance(result, list) and len(result) == 1: | ||||
return result[0] | return result[0] | ||||
else: | else: | ||||
return result | return result | ||||
def find_recipient(self, address, domain=None): | def find_recipient(self, address, domain=None, search_attrs=None): | ||||
""" | """ | ||||
Find one or more entries corresponding to the recipient address. | Find one or more entries corresponding to the recipient address. | ||||
""" | """ | ||||
if not domain == None and not self.domain == domain: | if not domain == None and not self.domain == domain: | ||||
self.connect(domain=domain) | self.connect(domain=domain) | ||||
if not self._auth or self._auth == None: | if not self._auth or self._auth == None: | ||||
self.connect(domain=domain) | self.connect(domain=domain) | ||||
result = self._auth.find_recipient(address) | result = self._auth.find_recipient(address, search_attrs=search_attrs) | ||||
if isinstance(result, list) and len(result) == 1: | if isinstance(result, list) and len(result) == 1: | ||||
return result[0] | return result[0] | ||||
else: | else: | ||||
return result | return result | ||||
def find_resource(self, address): | def find_resource(self, address): | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |
unexpected indentation (comment)