02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen#ifndef ACL_STORAGE_H
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen#define ACL_STORAGE_H
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen#include "mail-storage.h"
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainenstruct acl_rights_update;
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainenenum acl_storage_rights {
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_LOOKUP,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_READ,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_WRITE,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_WRITE_SEEN,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_WRITE_DELETED,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_INSERT,
04870054863757edf048c81dcce3c5e7dec453cdTimo Sirainen ACL_STORAGE_RIGHT_POST,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_EXPUNGE,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_CREATE,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_DELETE,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_ADMIN,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen ACL_STORAGE_RIGHT_COUNT
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen};
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen/* Returns acl_object for the given mailbox. */
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainenstruct acl_object *acl_mailbox_get_aclobj(struct mailbox *box);
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen/* Returns 1 if we have the requested right. If not, returns 0 and sets storage
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen error to MAIL_ERROR_PERM. Returns -1 if internal error occurred and also
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen sets storage error. */
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainenint acl_mailbox_right_lookup(struct mailbox *box, unsigned int right_idx);
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainenint acl_mailbox_update_acl(struct mailbox_transaction_context *t,
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen const struct acl_rights_update *update);
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainenint acl_attribute_set(struct mailbox_transaction_context *t,
6cc4cce2078aca138fbce19305e69e77edcee614Timo Sirainen enum mail_attribute_type type, const char *key,
bd6a8056771b6150685dea319ab5a94e021d17f1Josef 'Jeff' Sipek const struct mail_attribute_value *value);
66c87722e0fd2a85cd59797326bad3d1c409dc3aAki Tuomiint acl_attribute_get(struct mailbox *box,
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen enum mail_attribute_type type, const char *key,
bd6a8056771b6150685dea319ab5a94e021d17f1Josef 'Jeff' Sipek struct mail_attribute_value *value_r);
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainenstruct mailbox_attribute_iter *
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainenacl_attribute_iter_init(struct mailbox *box, enum mail_attribute_type type,
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen const char *prefix);
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainenconst char *acl_attribute_iter_next(struct mailbox_attribute_iter *iter);
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainenint acl_attribute_iter_deinit(struct mailbox_attribute_iter *iter);
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen#endif