summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-12 15:38:03 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-12 15:38:03 +0100
commita07c9bbf99eaf8f6337101cafa559af0e11b8671 (patch)
tree839939a6d3cd5a6ce37149a4b02e4554d2743ba8
parent78bbd216e3b7c2d2338450a4cc332f79fc751deb (diff)
downloadpykolab-a07c9bbf99eaf8f6337101cafa559af0e11b8671.tar.gz
Make sure a shared folder with an inbound address can be delivered mail to
-rw-r--r--pykolab/auth/ldap/__init__.py22
-rw-r--r--pykolab/imap/__init__.py30
2 files changed, 43 insertions, 9 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index e7c4dd2..ec7e9fe 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1265,10 +1265,6 @@ class LDAP(pykolab.base.Base):
entry['kolabfoldertype']
)
- if entry.has_key(delivery_address_attribute) and \
- not entry[delivery_address_attribute] == None:
- self.imap.set_acl(folder_path, 'anyone', 'p')
-
if entry.has_key('kolabmailfolderaclentry') and \
not entry['kolabmailfolderaclentry'] == None:
@@ -1276,6 +1272,10 @@ class LDAP(pykolab.base.Base):
entry['kolabmailfolderaclentry']
)
+ if entry.has_key(delivery_address_attribute) and \
+ not entry[delivery_address_attribute] == None:
+ self.imap.set_acl(folder_path, 'anyone', '+p')
+
#if server == None:
#self.entry_set_attribute(mailserver_attribute, server)
@@ -1782,12 +1782,16 @@ class LDAP(pykolab.base.Base):
entry['kolabfoldertype']
)
- #if entry.has_key('kolabmailfolderaclentry') and \
- #not entry['kolabmailfolderaclentry'] == None:
+ if entry.has_key('kolabmailfolderaclentry') and \
+ not entry['kolabmailfolderaclentry'] == None:
+
+ self.imap._set_kolab_mailfolder_acls(
+ entry['kolabmailfolderaclentry']
+ )
- #self.imap._set_kolab_mailfolder_acls(
- #entry['kolabmailfolderaclentry']
- #)
+ if entry.has_key(delivery_address_attribute) and \
+ not entry[delivery_address_attribute] == None:
+ self.imap.set_acl(folder_path, 'anyone', '+p')
#if server == None:
#self.entry_set_attribute(mailserver_attribute, server)
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 9995292..fbe515d 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -328,6 +328,36 @@ class IMAP(object):
if short_rights.has_key(acl):
acl = short_rights[acl]
+ # Special treatment for '-' and '+' characters
+ if '+' in acl or '-' in acl:
+ acl_map = {
+ 'set': '',
+ 'subtract': '',
+ 'add': ''
+ }
+
+ mode = 'set'
+ for char in acl:
+ if char == '-':
+ mode = 'subtract'
+ continue
+ if char == '+':
+ continue
+ mode = 'add'
+
+ acl_map[mode] += char
+
+ current_acls = self.imap.lam(self.folder_utf7(folder))
+ for current_acl in current_acls.keys():
+ if current_acl == identifier:
+ _acl = current_acls[current_acl]
+ break
+
+ _acl = _acl + acl_map['set'] + acl_map['add']
+
+ _acl = [x for x in _acl.split() if x not in acl_map['subtract'].split()]
+ acl = ''.join(list(set(_acl)))
+
self.imap.sam(self.folder_utf7(folder), identifier, acl)
def set_metadata(self, folder, metadata_path, metadata_value, shared=True):