#ifndef ACL_API_H
#define ACL_API_H
struct mailbox_list;
struct mail_storage;
struct mailbox;
struct acl_object;
/* Show mailbox in mailbox list. Allow subscribing to it. */
/* Allow opening mailbox for reading */
/* Allow permanent seen-flag changes */
/* Allow permanent deleted-flag changes */
/* Allow saving and copying mails into the mailbox */
/* Allow posting mails to the mailbox (e.g. Sieve fileinto) */
/* Allow expunging mails */
/* Allow creating child mailboxes */
/* Allow deleting this mailbox */
/* Allow changing ACL state in this mailbox */
#define MAILBOX_ATTRIBUTE_PREFIX_ACL \
/* ACL identifiers in override order */
enum acl_id_type {
/* Anyone's rights, including anonymous's.
identifier name is ignored. */
/* Authenticate users' rights. identifier name is ignored. */
/* Group's rights */
/* Owner's rights, used when user is the storage's owner.
identifier name is ignored. */
/* User's rights */
/* Same as group's rights, but also overrides user's rights */
};
enum acl_modify_mode {
/* Remove rights from existing ACL */
/* Add rights to existing ACL (or create a new one) */
/* Replace existing ACL with given rights */
/* Clear all the rights from an existing ACL */
};
struct acl_rights {
/* Identifier, eg. username / group name */
const char *identifier;
/* Rights assigned. NULL entry can be ignored, but { NULL } means user
has no rights. */
const char *const *rights;
/* Negative rights assigned */
const char *const *neg_rights;
/* These rights are global for all users */
};
struct acl_rights_update {
/* These changes' "last changed" timestamp */
};
/* data contains the information needed to initialize ACL backend. If username
is NULL, it means the user is anonymous. Username and groups are matched
case-sensitively. */
struct acl_backend *
const char *acl_username, const char *const *groups,
bool owner);
/* Returns the acl_username passed to acl_backend_init(). Note that with
anonymous users NULL is returned. */
/* Returns TRUE if user isn't anonymous. */
/* Returns TRUE if user owns the storage. */
/* Returns TRUE if given name matches the ACL user name. */
const char *username);
/* Returns TRUE if ACL user is in given group. */
const char *group_name);
/* Returns index for the right name. If it doesn't exist, it's created. */
const char *right);
/* Returns TRUE if acl_rights matches backend user. */
const struct acl_rights *rights);
/* List mailboxes that have lookup right to some non-owners. */
struct acl_mailbox_list_context *
const char **name_r);
int
/* Force a rebuild for nonowner lookups index */
const char *name);
const char *child_name);
/* Returns 1 if we have the requested rights, 0 if not, or -1 if internal
error occurred. */
/* Returns 0 = ok, -1 = internal error */
const char *const **rights_r);
/* Returns the default rights for the object. */
/* Returns timestamp of when the ACLs were last changed for this object,
or 0 = never. */
/* Update ACL of given object. */
const struct acl_rights_update *update);
/* List all identifiers. */
struct acl_rights *rights_r);
/* Returns the canonical ID for the right. */
#endif