summaryrefslogtreecommitdiffstats
path: root/pykolab/auth/ldap/__init__.py
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-10-06 09:45:20 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-10-06 09:45:20 +0200
commite75b015fa96721968083a10d205187ffe8e335d3 (patch)
treecd7739cc827f19f1b2689036684b185aa31e2ff8 /pykolab/auth/ldap/__init__.py
parentf57e5263ed37d61548e04e0ba7e591cfecf3edc6 (diff)
downloadpykolab-e75b015fa96721968083a10d205187ffe8e335d3.tar.gz
T1417: Fix so sync-mailhost-attr uses result_attribute not mail_attributes
Summary: Fixes T1417 Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Maniphest Tasks: T1417 Differential Revision: https://git.kolab.org/D209
Diffstat (limited to 'pykolab/auth/ldap/__init__.py')
-rw-r--r--pykolab/auth/ldap/__init__.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 62f765a..2d79df6 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -675,7 +675,7 @@ class LDAP(pykolab.base.Base):
return _entry_dns
- def find_recipient(self, address="*", exclude_entry_id=None):
+ def find_recipient(self, address="*", exclude_entry_id=None, search_attrs=None):
"""
Given an address string or list of addresses, find one or more valid
recipients.
@@ -685,6 +685,9 @@ class LDAP(pykolab.base.Base):
Specify an additional entry_id to exclude to exclude matches against
the current entry.
+
+ In search_attrs you can specify list of search attributes. By default
+ mail_attributes are used.
"""
self._bind()
@@ -701,13 +704,13 @@ class LDAP(pykolab.base.Base):
__filter_suffix = ""
kolab_filter = self._kolab_filter()
- recipient_address_attrs = self.config_get_list("mail_attributes")
-
- result_attributes = []
- for recipient_address_attr in recipient_address_attrs:
- result_attributes.append(recipient_address_attr)
+ if search_attrs is not None:
+ recipient_address_attrs = search_attrs
+ else:
+ recipient_address_attrs = self.config_get_list("mail_attributes")
+ result_attributes = recipient_address_attrs
result_attributes.append(self.config_get('unique_attribute'))
_filter = "(|"