summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2022-06-17 22:09:49 +0200
committerChristoph Erhardt <kolab@sicherha.de>2022-06-17 22:10:02 +0200
commitbdfb5bfca3e98deed3bcb7e3480b8602b1d9644d (patch)
treecad320d5ad140ba216e1e902f76d8b8a94baa1a3
parent015ece8de4369b40fe74d1f000999842f460f86c (diff)
downloadpykolab-bdfb5bfca3e98deed3bcb7e3480b8602b1d9644d.tar.gz
cli - direct dam implementation
Summary: This is an extended imaplib def deleteacl function def deleteacl(self, mailbox, who): """Delete the ACLs (remove any rights) set for who on mailbox. (typ, [data]) = <instance>.deleteacl(mailbox, who) """ return self._simple_command('DELETEACL', mailbox, who) This is more direct without sam workaround Reviewers: #pykolab_developers, sicherha Reviewed By: #pykolab_developers, sicherha Subscribers: sicherha Differential Revision: https://git.kolab.org/D3572
-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