summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cyruslib.py6
-rw-r--r--pykolab/cli/cmd_delete_mailbox_acl.py2
-rw-r--r--pykolab/imap/__init__.py12
3 files changed, 19 insertions, 1 deletions
diff --git a/cyruslib.py b/cyruslib.py
index 169d5f9..b2a7dcc 100644
--- a/cyruslib.py
+++ b/cyruslib.py
@@ -590,6 +590,12 @@ class CYRUS:
res, msg = self.__docommand("setacl", self.decode(mailbox), userid, rights)
self.__verbose( '[SETACL %s %s %s] %s: %s' % (mailbox, userid, rights, res, msg[0]) )
+ def dam(self, mailbox, userid):
+ """Delete ACL (remove any rights) set for userid on mailbox"""
+ self.__prepare('DELETEACL', mailbox)
+ res, msg = self.__docommand("deleteacl", self.decode(mailbox), userid)
+ self.__verbose( '[DELETEACL %s %s] %s: %s' % (mailbox, userid, res, msg[0]) )
+
def lq(self, mailbox):
"""List Quota"""
self.__prepare('GETQUOTA', mailbox)
diff --git a/pykolab/cli/cmd_delete_mailbox_acl.py b/pykolab/cli/cmd_delete_mailbox_acl.py
index 2a70115..e4c1d62 100644
--- a/pykolab/cli/cmd_delete_mailbox_acl.py
+++ b/pykolab/cli/cmd_delete_mailbox_acl.py
@@ -65,7 +65,7 @@ def execute(*args, **kw):
folders = imap.list_folders(folder)
for folder in folders:
try:
- imap.set_acl(folder, identifier, '')
+ imap.del_acl(folder, identifier)
except:
# Mailbox no longer exists?
pass
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 171e4e5..a773bfc 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -435,6 +435,18 @@ class IMAP(object):
)
)
+ def del_acl(self, folder, identifier):
+ try:
+ self.imap.dam(self.folder_utf7(folder), identifier)
+ except Exception as errmsg:
+ log.error(
+ _("Could not delete ACL for %s on folder %s: %r") % (
+ identifier,
+ folder,
+ errmsg
+ )
+ )
+
def set_metadata(self, folder, metadata_path, metadata_value, shared=True):
"""
Set a metadata entry on a folder