summaryrefslogtreecommitdiffstats
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 17:22:04 +0100
commit8c726c54842e69426eb6d689ea6317eef91af61c (patch)
treef7c8abfa991be41444be865316921431ffc61142
parent7404e83d8c639db6948321dafaf5341972c476af (diff)
downloadpykolab-8c726c54842e69426eb6d689ea6317eef91af61c.tar.gz
Take in to account a _change_none_user can still require a mailbox rename
-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 5213bca..f6fcb77 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1355,10 +1355,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)