summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-21 14:38:45 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-21 14:38:45 +0100
commit90379b582f5ae828af3ee915c7bcf89bb3af6545 (patch)
tree402d47f6639319ad21d5f9834f72354ae56eee49
parent18e7a55b4c030b23d502d73b7bffa91be3b80f2a (diff)
downloadpykolab-90379b582f5ae828af3ee915c7bcf89bb3af6545.tar.gz
Add function find_resource()
-rw-r--r--pykolab/auth/__init__.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index 3441394..e05ea80 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -191,11 +191,19 @@ class Auth(pykolab.base.Base):
else:
return result
- def find_user(self, attr, value, **kw):
- return self._auth._find_user(attr, value, domain=domain, **kw)
+ def find_resource(self, address):
+ """
+ Find one or more resources corresponding to the recipient address.
+ """
+ result = self._auth.find_resource(address)
- def search_users(self, attr, value, **kw):
- return self._auth._search_users(attr, value, domain=domain, **kw)
+ 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, **kw)
def list_domains(self):
"""
@@ -248,6 +256,9 @@ class Auth(pykolab.base.Base):
def search_mail_address(self, domain, mail_address):
return self._auth._search_mail_address(domain, mail_address)
+ def search_users(self, attr, value, **kw):
+ return self._auth._search_users(attr, value, **kw)
+
def set_entry_attribute(self, domain, entry, attribute):
return self._auth.set_entry_attribute(entry, attribute)