summaryrefslogtreecommitdiffstats
path: root/pykolab/auth/ldap/__init__.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-12-23 10:51:38 +0100
committerThomas Bruederli <bruederli@kolabsys.com>2014-12-23 10:51:38 +0100
commite99f7c72196969fdda36c801c953662b84bd10b1 (patch)
treee7dac1f4320306ba792bfdfed3a86e86ef61e491 /pykolab/auth/ldap/__init__.py
parent856a2aa11f6d1d661eacbf9e4f34c92d23a2f4ce (diff)
downloadpykolab-e99f7c72196969fdda36c801c953662b84bd10b1.tar.gz
Consider all valid recipient email addresses, including aliases, when identifying attendees in iTip messages (#4074)
Diffstat (limited to 'pykolab/auth/ldap/__init__.py')
-rw-r--r--pykolab/auth/ldap/__init__.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 33f3f8e..0b51a74 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -402,6 +402,34 @@ class LDAP(pykolab.base.Base):
return utils.normalize(_entry_attrs)
+ def list_recipient_addresses(self, entry_id):
+ """
+ Give a list of all valid recipient addresses for an LDAP entry
+ identified by its ID.
+ """
+ mail_attributes = conf.get_list('ldap', 'mail_attributes')
+ entry = self.get_entry_attributes(entry_id, mail_attributes)
+
+ return self.extract_recipient_addresses(entry) if entry is not None else []
+
+ def extract_recipient_addresses(self, entry):
+ """
+ Extact a list of all valid recipient addresses for the given LDAP entry.
+ This includes all attributes configured for ldap.mail_attributes
+ """
+ recipient_addresses = []
+ mail_attributes = conf.get_list('ldap', 'mail_attributes')
+
+ for attr in mail_attributes:
+ if entry.has_key(attr):
+ if isinstance(entry[attr], list):
+ recipient_addresses.extend(entry[attr])
+ elif isinstance(entry[attr], basestring):
+ recipient_addresses.append(entry[attr])
+
+ return recipient_addresses
+
+
def find_recipient(self, address="*", exclude_entry_id=None):
"""
Given an address string or list of addresses, find one or more valid