summaryrefslogtreecommitdiffstats
path: root/pykolab/auth/ldap/__init__.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2020-01-15 18:05:19 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2020-02-23 11:03:35 +0100
commit49629e963e2f34ee0d414983768a51063206b6e0 (patch)
treece53af174ac1ed15f100b314ea8a622c1e42e255 /pykolab/auth/ldap/__init__.py
parentb587a7640f10738cb884434296a0377fe73540a9 (diff)
downloadpykolab-49629e963e2f34ee0d414983768a51063206b6e0.tar.gz
Fix moddn on shared folder entries (Bifrost TT324146)
Diffstat (limited to 'pykolab/auth/ldap/__init__.py')
-rw-r--r--pykolab/auth/ldap/__init__.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 67e9487..f76f684 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1936,7 +1936,39 @@ class LDAP(Base):
cache.get_entry(self.domain, entry)
def _change_moddn_sharedfolder(self, entry, change):
- pass
+ result_attribute = 'cn'
+
+ old_cn = explode_dn(change['previous_dn'], True)[0]
+
+ if 'kolabtargetfolder' in entry and entry['kolabtargetfolder'] is not None:
+ new_folder_path = entry['kolabtargetfolder']
+ old_folder_path = old_cn
+
+ if '@' in entry['kolabtargetfolder']:
+ old_folder_path = "%s@%s" % (
+ old_folder_path,
+ entry['kolabtargetfolder'].split('@')[1]
+ )
+
+ else:
+ result_attribute = conf.get('cyrus-sasl', 'result_attribute')
+ if result_attribute in ['mail']:
+ new_folder_path = "%s@%s" % (entry['cn'], self.domain)
+ old_folder_path = "%s@%s" % (old_cn, self.domain)
+ else:
+ new_folder_path = "%s" % (entry['cn'])
+ old_folder_path = old_cn
+
+ if not new_folder_path.startswith('shared/'):
+ new_folder_path = "shared/%s" % (new_folder_path)
+
+ if not old_folder_path.startswith('shared/'):
+ old_folder_path = "shared/%s" % (old_folder_path)
+
+ log.debug("old folder path: %r" % (old_folder_path))
+ log.debug("new folder path: %r" % (new_folder_path))
+
+ self.imap.shared_folder_rename(old_folder_path, new_folder_path)
def _change_modify_None(self, entry, change):
pass