dovecot-2.1: acl: Optionally get default ACL's for private/share...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 6 14:36:23 EEST 2013
details: http://hg.dovecot.org/dovecot-2.1/rev/23f7cabad194
changeset: 14961:23f7cabad194
user: Timo Sirainen <tss at iki.fi>
date: Mon May 06 14:33:05 2013 +0300
description:
acl: Optionally get default ACL's for private/shared namespaces from user's INBOX.
This probably should be the default always, but better not break anyone's
existing setup until v2.3.0. So for now there's a setting for this:
plugin { acl_defaults_from_inbox = yes }
diffstat:
src/plugins/acl/acl-backend-vfile.c | 2 +-
src/plugins/acl/acl-backend.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diffs (58 lines):
diff -r 0fa68f3a8f6c -r 23f7cabad194 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c Fri May 03 17:17:15 2013 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c Mon May 06 14:33:05 2013 +0300
@@ -274,7 +274,7 @@
}
if (parent == NULL) {
/* use the root */
- parent = "";
+ parent = backend->default_aclobj->name;
}
return acl_backend_vfile_object_init(backend, parent);
}
diff -r 0fa68f3a8f6c -r 23f7cabad194 src/plugins/acl/acl-backend.c
--- a/src/plugins/acl/acl-backend.c Fri May 03 17:17:15 2013 +0300
+++ b/src/plugins/acl/acl-backend.c Mon May 06 14:33:05 2013 +0300
@@ -4,6 +4,7 @@
#include "hash.h"
#include "mail-storage-settings.h"
#include "mailbox-list.h"
+#include "mail-namespace.h"
#include "mail-user.h"
#include "acl-cache.h"
#include "acl-api-private.h"
@@ -36,7 +37,9 @@
bool owner)
{
struct mail_user *user = mailbox_list_get_user(list);
+ struct mail_namespace *ns = mailbox_list_get_namespace(list);
struct acl_backend *backend;
+ const char *default_name = "";
unsigned int i, group_count;
if (user->mail_debug) {
@@ -83,7 +86,14 @@
acl_cache_mask_init(backend->cache, backend->pool,
backend->default_rights);
- backend->default_aclobj = acl_object_init_from_name(backend, "");
+ /* FIXME: this should probably be made default in v2.3 */
+ if (mail_user_plugin_getenv(user, "acl_defaults_from_inbox") != NULL) {
+ if (ns->type == NAMESPACE_PRIVATE ||
+ ns->type == NAMESPACE_SHARED)
+ default_name = "INBOX";
+ }
+ backend->default_aclobj =
+ acl_object_init_from_name(backend, default_name);
return backend;
}
@@ -164,7 +174,7 @@
if (backend->v.object_refresh_cache(backend->default_aclobj) < 0)
return -1;
- *mask_r = acl_cache_get_my_rights(backend->cache, "");
+ *mask_r = acl_cache_get_my_rights(backend->cache, backend->default_aclobj->name);
if (*mask_r == NULL)
*mask_r = backend->default_aclmask;
return 0;
More information about the dovecot-cvs
mailing list