dovecot-2.1: doveadm acl: Added "recalc" command to rebuild acl_...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 14 13:01:38 EET 2013


details:   http://hg.dovecot.org/dovecot-2.1/rev/6bee6d0c611f
changeset: 14881:6bee6d0c611f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jan 14 13:01:33 2013 +0200
description:
doveadm acl: Added "recalc" command to rebuild acl_lookup_dict for the user.

diffstat:

 src/plugins/acl/doveadm-acl.c |  29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diffs (46 lines):

diff -r 1ab8e0e699f7 -r 6bee6d0c611f src/plugins/acl/doveadm-acl.c
--- a/src/plugins/acl/doveadm-acl.c	Wed Jan 09 07:01:41 2013 +0200
+++ b/src/plugins/acl/doveadm-acl.c	Mon Jan 14 13:01:33 2013 +0200
@@ -399,6 +399,34 @@
 }
 
 static int
+cmd_acl_recalc_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user)
+{
+	struct acl_user *auser = ACL_USER_CONTEXT(user);
+
+	if (auser == NULL) {
+		i_error("ACL not enabled for %s", user->username);
+		doveadm_mail_failed_error(ctx, MAIL_ERROR_NOTFOUND);
+		return -1;
+	}
+	if (acl_lookup_dict_rebuild(auser->acl_lookup_dict) < 0) {
+		i_error("Failed to recalculate ACL dicts");
+		doveadm_mail_failed_error(ctx, MAIL_ERROR_TEMP);
+		return -1;
+	}
+	return 0;
+}
+
+static struct doveadm_mail_cmd_context *
+cmd_acl_recalc_alloc(void)
+{
+	struct doveadm_mail_cmd_context *ctx;
+
+	ctx = doveadm_mail_cmd_alloc(struct doveadm_mail_cmd_context);
+	ctx->v.run = cmd_acl_recalc_run;
+	return ctx;
+}
+
+static int
 cmd_acl_debug_mailbox_open(struct doveadm_mail_cmd_context *ctx,
 			   struct mail_user *user, const char *mailbox,
 			   struct mailbox **box_r)
@@ -591,6 +619,7 @@
 	{ cmd_acl_add_alloc, "acl add", "<mailbox> <id> <right> [<right> ...]" },
 	{ cmd_acl_remove_alloc, "acl remove", "<mailbox> <id> <right> [<right> ...]" },
 	{ cmd_acl_delete_alloc, "acl delete", "<mailbox> <id>" },
+	{ cmd_acl_recalc_alloc, "acl recalc", "" },
 	{ cmd_acl_debug_alloc, "acl debug", "<mailbox>" }
 };
 


More information about the dovecot-cvs mailing list