summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 16:24:46 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 16:24:46 +0100
commitb11ef43b54a16e731d5e4ea7e546e1a17cac5665 (patch)
tree193200749344c7cc42136dd420787ef549fc0f30 /pykolab
parent7a2de6e118b1b88a34efa87cbd27f398a690c717 (diff)
downloadpykolab-b11ef43b54a16e731d5e4ea7e546e1a17cac5665.tar.gz
Take in to account a _change_none_user can still require a mailbox rename
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/auth/ldap/__init__.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index c538083..9198219 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1453,10 +1453,34 @@ class LDAP(pykolab.base.Base):
"""
result_attribute = conf.get('cyrus-sasl', 'result_attribute')
- rcpt_addrs = self.recipient_policy(entry)
+ old_canon_attr = None
- for key in rcpt_addrs.keys():
- entry[key] = rcpt_addrs[key]
+ _entry = cache.get_entry(self.domain, entry, update=False)
+
+ if not _entry == None and _entry.__dict__.has_key('result_attribute') and not _entry.result_attribute == '':
+ old_canon_attr = _entry.result_attribute
+
+ entry_changes = self.recipient_policy(entry)
+
+ if entry.has_key(result_attribute) and entry_changes.has_key(result_attribute):
+ if not entry[result_attribute] == entry_changes[result_attribute]:
+ old_canon_attr = entry[result_attribute]
+
+ log.debug(
+ _("Result from recipient policy: %r") % (entry_changes),
+ level=8
+ )
+
+ if entry_changes.has_key(result_attribute) and not old_canon_attr == None:
+ if not entry_changes[result_attribute] == old_canon_attr:
+ self.imap.user_mailbox_rename(
+ old_canon_attr,
+ entry_changes[result_attribute]
+ )
+
+ for key in entry_changes.keys():
+ entry[key] = entry_changes[key]
+ self.set_entry_attribute(entry, key, entry[key])
cache.get_entry(self.domain, entry)