annotate src/plugins/acl/acl-mailbox.c @ 5540:1216c0ebe492 HEAD

acl_backend is now tied to mailbox_list instead of mail_storage.
author Timo Sirainen <tss@iki.fi>
date Wed, 11 Apr 2007 14:02:31 +0300
parents 7a6db5ec047d
children f717fb4b31c0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
1 /* Copyright (C) 2006 Timo Sirainen */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
2
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
3 /* FIXME: If we don't have permission to change flags/keywords, the changes
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
4 should still be stored temporarily for this session. However most clients
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
5 don't care and it's a huge job, so I currently this isn't done. The same
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
6 problem actually exists when opening read-only mailboxes. */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
7 #include "lib.h"
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
8 #include "array.h"
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
9 #include "istream.h"
5448
beabd433cdae Moved delete/rename operations to mailbox_list API. Fixed mbox/maildir to
Timo Sirainen <tss@iki.fi>
parents: 4451
diff changeset
10 #include "mailbox-list-private.h"
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
11 #include "acl-api-private.h"
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
12 #include "acl-plugin.h"
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
13
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
14 #include <sys/stat.h>
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
15
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
16 #define ACL_MAIL_CONTEXT(obj) \
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
17 MODULE_CONTEXT(obj, acl_mail_module)
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
18
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
19 struct acl_mailbox {
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
20 union mailbox_module_context module_ctx;
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
21 struct acl_object *aclobj;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
22
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
23 unsigned int save_hack:1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
24 };
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
25
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
26 static int acl_mailbox_close(struct mailbox *box)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
27 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
28 struct acl_mailbox *abox = ACL_CONTEXT(box);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
29
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
30 acl_object_deinit(&abox->aclobj);
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
31 return abox->module_ctx.super.close(box);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
32 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
33
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
34 static MODULE_CONTEXT_DEFINE_INIT(acl_mail_module, &mail_module_register);
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
35
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
36 static int mailbox_acl_right_lookup(struct mailbox *box, unsigned int right_idx)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
37 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
38 struct acl_mailbox *abox = ACL_CONTEXT(box);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
39 struct acl_mail_storage *astorage = ACL_CONTEXT(box->storage);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
40 int ret;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
41
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
42 ret = acl_object_have_right(abox->aclobj,
5540
1216c0ebe492 acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
43 astorage->rights.acl_storage_right_idx[right_idx]);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
44 if (ret > 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
45 return 1;
5540
1216c0ebe492 acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
46 if (ret < 0) {
1216c0ebe492 acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
47 mail_storage_set_internal_error(box->storage);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
48 return -1;
5540
1216c0ebe492 acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
49 }
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
50
5448
beabd433cdae Moved delete/rename operations to mailbox_list API. Fixed mbox/maildir to
Timo Sirainen <tss@iki.fi>
parents: 4451
diff changeset
51 mail_storage_set_error(box->storage, MAILBOX_LIST_ERR_NO_PERMISSION);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
52 return 0;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
53 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
54
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
55 static int
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
56 acl_get_write_rights(struct mailbox *box,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
57 bool *flags_r, bool *flag_seen_r, bool *flag_del_r)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
58 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
59 int ret;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
60
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
61 ret = mailbox_acl_right_lookup(box, ACL_STORAGE_RIGHT_WRITE);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
62 if (ret < 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
63 return -1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
64 *flags_r = ret > 0;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
65
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
66 ret = mailbox_acl_right_lookup(box, ACL_STORAGE_RIGHT_WRITE_SEEN);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
67 if (ret < 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
68 return -1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
69 *flag_seen_r = ret > 0;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
70
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
71 ret = mailbox_acl_right_lookup(box, ACL_STORAGE_RIGHT_WRITE_DELETED);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
72 if (ret < 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
73 return -1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
74 *flag_del_r = ret > 0;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
75 return 1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
76 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
77
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
78 static int
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
79 acl_mail_update_flags(struct mail *_mail, enum modify_type modify_type,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
80 enum mail_flags flags)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
81 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
82 struct mail_private *mail = (struct mail_private *)_mail;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
83 union mail_module_context *amail = ACL_MAIL_CONTEXT(mail);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
84 bool acl_flags, acl_flag_seen, acl_flag_del;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
85 int ret;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
86
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
87 ret = acl_get_write_rights(_mail->box, &acl_flags, &acl_flag_seen,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
88 &acl_flag_del);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
89 if (ret < 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
90 return -1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
91
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
92 if (modify_type != MODIFY_REPLACE) {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
93 /* adding/removing flags. just remove the disallowed
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
94 flags from the mask. */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
95 if (!acl_flags)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
96 flags &= MAIL_SEEN | MAIL_DELETED;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
97 if (!acl_flag_seen)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
98 flags &= ~MAIL_SEEN;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
99 if (!acl_flag_del)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
100 flags &= ~MAIL_DELETED;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
101 } else if (!acl_flags || acl_flag_seen || !acl_flag_del) {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
102 /* we don't have permission to replace all the flags. */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
103 if (!acl_flags && !acl_flag_seen && !acl_flag_del) {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
104 /* no flag changes allowed. ignore silently. */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
105 return 0;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
106 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
107
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
108 /* handle this by first removing the allowed flags and
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
109 then adding the allowed flags */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
110 if (acl_mail_update_flags(_mail, MODIFY_REMOVE,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
111 ~flags) < 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
112 return -1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
113 return acl_mail_update_flags(_mail, MODIFY_ADD, flags);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
114 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
115
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
116 return amail->super.update_flags(_mail, modify_type, flags);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
117 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
118
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
119 static int
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
120 acl_mail_update_keywords(struct mail *_mail, enum modify_type modify_type,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
121 struct mail_keywords *keywords)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
122 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
123 struct mail_private *mail = (struct mail_private *)_mail;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
124 union mail_module_context *amail = ACL_MAIL_CONTEXT(mail);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
125 int ret;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
126
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
127 ret = mailbox_acl_right_lookup(_mail->box, ACL_STORAGE_RIGHT_WRITE);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
128 if (ret <= 0) {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
129 /* if we don't have permission, just silently return success. */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
130 return ret;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
131 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
132
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
133 return amail->super.update_keywords(_mail, modify_type, keywords);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
134 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
135
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
136 static int acl_mail_expunge(struct mail *_mail)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
137 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
138 struct mail_private *mail = (struct mail_private *)_mail;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
139 union mail_module_context *amail = ACL_MAIL_CONTEXT(mail);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
140 int ret;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
141
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
142 ret = mailbox_acl_right_lookup(_mail->box, ACL_STORAGE_RIGHT_EXPUNGE);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
143 if (ret <= 0) {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
144 /* if we don't have permission, silently return success so
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
145 users won't see annoying error messages in case their
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
146 clients try automatic expunging. */
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
147 return ret;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
148 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
149
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
150 return amail->super.expunge(_mail);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
151 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
152
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
153 static struct mail *
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
154 acl_mail_alloc(struct mailbox_transaction_context *t,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
155 enum mail_fetch_field wanted_fields,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
156 struct mailbox_header_lookup_ctx *wanted_headers)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
157 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
158 struct acl_mailbox *abox = ACL_CONTEXT(t->box);
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
159 union mail_module_context *amail;
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
160 struct mail *_mail;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
161 struct mail_private *mail;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
162
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
163 _mail = abox->module_ctx.super.
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
164 mail_alloc(t, wanted_fields, wanted_headers);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
165 mail = (struct mail_private *)_mail;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
166
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
167 amail = p_new(mail->pool, union mail_module_context, 1);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
168 amail->super = mail->v;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
169
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
170 mail->v.update_flags = acl_mail_update_flags;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
171 mail->v.update_keywords = acl_mail_update_keywords;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
172 mail->v.expunge = acl_mail_expunge;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
173 MODULE_CONTEXT_SET_SELF(mail, acl_mail_module, amail);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
174 return _mail;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
175 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
176
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
177 static int
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
178 acl_save_init(struct mailbox_transaction_context *t,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
179 enum mail_flags flags, struct mail_keywords *keywords,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
180 time_t received_date, int timezone_offset,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
181 const char *from_envelope, struct istream *input,
4268
7112aad504ae Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4077
diff changeset
182 struct mail *dest_mail, struct mail_save_context **ctx_r)
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
183 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
184 struct acl_mailbox *abox = ACL_CONTEXT(t->box);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
185
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
186 if (mailbox_acl_right_lookup(t->box, ACL_STORAGE_RIGHT_INSERT) <= 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
187 return -1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
188
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
189 return abox->module_ctx.super.
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
190 save_init(t, flags, keywords, received_date,
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
191 timezone_offset, from_envelope,
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
192 input, dest_mail, ctx_r);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
193 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
194
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
195 static int
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
196 acl_copy(struct mailbox_transaction_context *t, struct mail *mail,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
197 enum mail_flags flags, struct mail_keywords *keywords,
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
198 struct mail *dest_mail)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
199 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
200 struct acl_mailbox *abox = ACL_CONTEXT(t->box);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
201
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
202 if (mailbox_acl_right_lookup(t->box, ACL_STORAGE_RIGHT_INSERT) <= 0)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
203 return -1;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
204
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
205 return abox->module_ctx.super.copy(t, mail, flags, keywords, dest_mail);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
206 }
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
207
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
208 struct mailbox *acl_mailbox_open_box(struct mailbox *box)
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
209 {
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
210 struct acl_mail_storage *astorage = ACL_CONTEXT(box->storage);
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
211 struct acl_mailbox *abox;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
212
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
213 abox = p_new(box->pool, struct acl_mailbox, 1);
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
214 abox->module_ctx.super = box->v;
5540
1216c0ebe492 acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
215 abox->aclobj = acl_object_init_from_name(astorage->rights.backend,
1216c0ebe492 acl_backend is now tied to mailbox_list instead of mail_storage.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
216 box->storage,
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
217 mailbox_get_name(box));
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
218
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
219 box->v.close = acl_mailbox_close;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
220 box->v.mail_alloc = acl_mail_alloc;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
221 box->v.save_init = acl_save_init;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
222 box->v.copy = acl_copy;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
223 MODULE_CONTEXT_SET(box, acl_storage_module, abox);
4077
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
224 return box;
73573b9ecb00 Added initial support for ACLs. Currently supports reading the ACLs from files. Since no proper support for shared folders exist yet, this is mostly intended to be used only for preventing users from fully accessing the mailboxes they'd otherwise have full access to. It anyway does support "master user" having different ACLs to mailboxes.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
diff changeset
225 }