KIMAP

acl.h
1 /*
2  SPDX-FileCopyrightText: 2009 Andras Mantia <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "kimap_export.h"
10 
11 #include <qglobal.h>
12 
13 namespace KIMAP
14 {
15 /**
16  * Operations for dealing with mailbox permissions.
17  */
18 namespace Acl
19 {
20 /**
21  * Possible rights that can be held on a mailbox
22  */
23 enum Right {
24  None = 0x000000,
25  /** Mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox */
26  Lookup = 0x000001,
27  /** SELECT the mailbox, perform STATUS */
28  Read = 0x000002,
29  /** Set or clear the \Seen flag on messages in the mailbox, and keep it across sessions */
30  KeepSeen = 0x000004,
31  /** Set or clear flags other than \Seen and \Deleted on messages in the mailbox */
32  Write = 0x000008,
33  /** Perform APPEND and COPY with the mailbox as the target */
34  Insert = 0x000010,
35  /** Send mail to the submission address for the mailbox
36  *
37  * Note: this is not enforced by IMAP4, but is purely advisory.
38  */
39  Post = 0x000020,
40  /** Obsolete as of RFC 4314, replaced by CreateMailbox and DeleteMailbox */
41  Create = 0x000040,
42  /** Create new child mailboxes, or move a mailbox with this mailbox as the new parent
43  *
44  * Note that what constitutes a "child" mailbox is implementation-defined, but
45  * . or / are usually used as separaters.
46  */
47  CreateMailbox = 0x000080,
48  /** Delete or move the mailbox */
49  DeleteMailbox = 0x000100,
50  /** Set or clear the \Deleted flag on messages in the mailbox */
51  DeleteMessage = 0x000200,
52  /** Obsolete as of RFC 4314, replaced by DeleteMessage and Expunge*/
53  Delete = 0x000400,
54  /** View and modify the access control list for the mailbox */
55  Admin = 0x000800,
56  /** Expunge the messages in this mailbox
57  *
58  * Note that if this right is not held on a mailbox, closing the mailbox
59  * (see CloseJob) will succeed, but will not expunge the messages.
60  */
61  Expunge = 0x001000,
62  /** Write shared annotations
63  *
64  * See <a href="https://tools.ietf.org/html/rfc5257" title="IMAP ANNOTATE extension">RFC
65  * 5257</a>. Only supported by servers that implement the ANNOTATE extension.
66  */
67  WriteShared = 0x002000,
68  Custom0 = 0x004000, /**< Server-specific right 0 */
69  Custom1 = 0x008000, /**< Server-specific right 1 */
70  Custom2 = 0x010000, /**< Server-specific right 2 */
71  Custom3 = 0x020000, /**< Server-specific right 3 */
72  Custom4 = 0x040000, /**< Server-specific right 4 */
73  Custom5 = 0x080000, /**< Server-specific right 5 */
74  Custom6 = 0x100000, /**< Server-specific right 6 */
75  Custom7 = 0x200000, /**< Server-specific right 7 */
76  Custom8 = 0x400000, /**< Server-specific right 8 */
77  Custom9 = 0x800000 /**< Server-specific right 9 */
78 };
79 
80 Q_DECLARE_FLAGS(Rights, Right)
81 
82 /**
83  * Returns a rights mask that has no obsolete members anymore, i.e. obsolete flags are removed and
84  * replaced by their successors.
85  * @param rights set of #Rights flags to normalize
86  * @since 4.6
87  */
88 KIMAP_EXPORT Rights normalizedRights(Rights rights);
89 
90 /**
91  * Returns a rights mask that contains both obsolete and new flags if one of them is set.
92  * @param rights set of #Rights flags to augment
93  * @since 4.6
94  */
95 KIMAP_EXPORT Rights denormalizedRights(Rights rights);
96 
97 /**
98  * Convert a set of rights into text format
99  *
100  * No modifier flag ('+' or '-') will be included.
101  */
102 KIMAP_EXPORT QByteArray rightsToString(Rights rights);
103 /**
104  * Convert the text form of a set of rights into a Rights bitflag
105  *
106  * Modifier flags ('+' and '-') are ignored, as are any unknown
107  * characters. This method will not complain if you give it
108  * something that is not a list of rights.
109  */
110 KIMAP_EXPORT Rights rightsFromString(const QByteArray &string);
111 
112 }
113 }
114 
115 Q_DECLARE_OPERATORS_FOR_FLAGS(KIMAP::Acl::Rights)
116 
KIMAP_EXPORT Rights normalizedRights(Rights rights)
Returns a rights mask that has no obsolete members anymore, i.e.
Definition: acl.cpp:90
Set or clear the flag on messages in the mailbox, and keep it across sessions.
Definition: acl.h:30
Create new child mailboxes, or move a mailbox with this mailbox as the new parent.
Definition: acl.h:47
Server-specific right 2.
Definition: acl.h:70
KIMAP_EXPORT QByteArray rightsToString(Rights rights)
Convert a set of rights into text format.
Definition: acl.cpp:77
Server-specific right 4.
Definition: acl.h:72
Server-specific right 1.
Definition: acl.h:69
Send mail to the submission address for the mailbox.
Definition: acl.h:39
Write shared annotations.
Definition: acl.h:67
Obsolete as of RFC 4314, replaced by CreateMailbox and DeleteMailbox.
Definition: acl.h:41
Delete or move the mailbox.
Definition: acl.h:49
SELECT the mailbox, perform STATUS.
Definition: acl.h:28
Mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox.
Definition: acl.h:26
Right
Possible rights that can be held on a mailbox.
Definition: acl.h:23
Server-specific right 0.
Definition: acl.h:68
Obsolete as of RFC 4314, replaced by DeleteMessage and Expunge.
Definition: acl.h:53
Set or clear flags other than and on messages in the mailbox.
Definition: acl.h:32
Server-specific right 8.
Definition: acl.h:76
KIMAP_EXPORT Rights denormalizedRights(Rights rights)
Returns a rights mask that contains both obsolete and new flags if one of them is set...
Definition: acl.cpp:104
Set or clear the flag on messages in the mailbox.
Definition: acl.h:51
KIMAP_EXPORT Rights rightsFromString(const QByteArray &string)
Convert the text form of a set of rights into a Rights bitflag.
Definition: acl.cpp:55
Expunge the messages in this mailbox.
Definition: acl.h:61
Server-specific right 9.
Definition: acl.h:77
View and modify the access control list for the mailbox.
Definition: acl.h:55
Server-specific right 3.
Definition: acl.h:71
Definition: acl.cpp:12
Perform APPEND and COPY with the mailbox as the target.
Definition: acl.h:34
Server-specific right 5.
Definition: acl.h:73
Server-specific right 6.
Definition: acl.h:74
Server-specific right 7.
Definition: acl.h:75
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Oct 24 2021 23:12:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.