KIMAP2

acl.h
1/*
2 Copyright (c) 2009 Andras Mantia <amantia@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef KIMAP2_ACL_H
21#define KIMAP2_ACL_H
22
23#include "kimap2_export.h"
24
25#include <qglobal.h>
26
27namespace KIMAP2
28{
29
30/**
31 * Operations for dealing with mailbox permissions.
32 */
33namespace Acl
34{
35
36/**
37 * Possible rights that can be held on a mailbox
38 */
39enum Right {
40 None = 0x000000,
41 /** Mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox */
42 Lookup = 0x000001,
43 /** SELECT the mailbox, perform STATUS */
44 Read = 0x000002,
45 /** Set or clear the \Seen flag on messages in the mailbox, and keep it across sessions */
46 KeepSeen = 0x000004,
47 /** Set or clear flags other than \Seen and \Deleted on messages in the mailbox */
48 Write = 0x000008,
49 /** Perform APPEND and COPY with the mailbox as the target */
50 Insert = 0x000010,
51 /** Send mail to the submission address for the mailbox
52 *
53 * Note: this is not enforced by IMAP4, but is purely advisory.
54 */
55 Post = 0x000020,
56 /** Obsolete as of RFC 4314, replaced by CreateMailbox and DeleteMailbox */
57 Create = 0x000040,
58 /** Create new child mailboxes, or move a mailbox with this mailbox as the new parent
59 *
60 * Note that what constitutes a "child" mailbox is implementation-defined, but
61 * . or / are usually used as separaters.
62 */
63 CreateMailbox = 0x000080,
64 /** Delete or move the mailbox */
65 DeleteMailbox = 0x000100,
66 /** Set or clear the \Deleted flag on messages in the mailbox */
67 DeleteMessage = 0x000200,
68 /** Obsolete as of RFC 4314, replaced by DeleteMessage and Expunge*/
69 Delete = 0x000400,
70 /** View and modify the access control list for the mailbox */
71 Admin = 0x000800,
72 /** Expunge the messages in this mailbox
73 *
74 * Note that if this right is not held on a mailbox, closing the mailbox
75 * (see CloseJob) will succeed, but will not expunge the messages.
76 */
77 Expunge = 0x001000,
78 /** Write shared annotations
79 *
80 * See <a href="http://www.apps.ietf.org/rfc/rfc5257.html" title="IMAP ANNOTATE extension">RFC
81 * 5257</a>. Only supported by servers that implement the ANNOTATE extension.
82 */
83 WriteShared = 0x002000,
84 Custom0 = 0x004000, /**< Server-specific right 0 */
85 Custom1 = 0x008000, /**< Server-specific right 1 */
86 Custom2 = 0x010000, /**< Server-specific right 2 */
87 Custom3 = 0x020000, /**< Server-specific right 3 */
88 Custom4 = 0x040000, /**< Server-specific right 4 */
89 Custom5 = 0x080000, /**< Server-specific right 5 */
90 Custom6 = 0x100000, /**< Server-specific right 6 */
91 Custom7 = 0x200000, /**< Server-specific right 7 */
92 Custom8 = 0x400000, /**< Server-specific right 8 */
93 Custom9 = 0x800000 /**< Server-specific right 9 */
94};
95
96Q_DECLARE_FLAGS(Rights, Right)
97
98/**
99 * Returns a rights mask that has no obsolete members anymore, i.e. obsolete flags are removed and
100 * replaced by their successors.
101 * @param rights set of #Rights flags to normalize
102 * @since 4.6
103 */
104KIMAP2_EXPORT Rights normalizedRights(Rights rights);
105
106/**
107 * Returns a rights mask that contains both obsolete and new flags if one of them is set.
108 * @param rights set of #Rights flags to augment
109 * @since 4.6
110 */
111KIMAP2_EXPORT Rights denormalizedRights(Rights rights);
112
113/**
114 * Convert a set of rights into text format
115 *
116 * No modifier flag ('+' or '-') will be included.
117 */
118KIMAP2_EXPORT QByteArray rightsToString(Rights rights);
119/**
120 * Convert the text form of a set of rights into a Rights bitflag
121 *
122 * Modifier flags ('+' and '-') are ignored, as are any unknown
123 * characters. This method will not complain if you give it
124 * something that is not a list of rights.
125 */
126KIMAP2_EXPORT Rights rightsFromString(const QByteArray &string);
127
128}
129}
130
131Q_DECLARE_OPERATORS_FOR_FLAGS(KIMAP2::Acl::Rights)
132
133#endif
Right
Possible rights that can be held on a mailbox.
Definition acl.h:39
@ CreateMailbox
Create new child mailboxes, or move a mailbox with this mailbox as the new parent.
Definition acl.h:63
@ Custom9
Server-specific right 9.
Definition acl.h:93
@ Write
Set or clear flags other than \Seen and \Deleted on messages in the mailbox.
Definition acl.h:48
@ Post
Send mail to the submission address for the mailbox.
Definition acl.h:55
@ Insert
Perform APPEND and COPY with the mailbox as the target.
Definition acl.h:50
@ Expunge
Expunge the messages in this mailbox.
Definition acl.h:77
@ Custom0
Server-specific right 0.
Definition acl.h:84
@ Custom6
Server-specific right 6.
Definition acl.h:90
@ Custom4
Server-specific right 4.
Definition acl.h:88
@ DeleteMailbox
Delete or move the mailbox.
Definition acl.h:65
@ Custom3
Server-specific right 3.
Definition acl.h:87
@ Read
SELECT the mailbox, perform STATUS.
Definition acl.h:44
@ Custom8
Server-specific right 8.
Definition acl.h:92
@ Create
Obsolete as of RFC 4314, replaced by CreateMailbox and DeleteMailbox.
Definition acl.h:57
@ Admin
View and modify the access control list for the mailbox.
Definition acl.h:71
@ DeleteMessage
Set or clear the \Deleted flag on messages in the mailbox.
Definition acl.h:67
@ Custom7
Server-specific right 7.
Definition acl.h:91
@ WriteShared
Write shared annotations.
Definition acl.h:83
@ Custom5
Server-specific right 5.
Definition acl.h:89
@ Custom1
Server-specific right 1.
Definition acl.h:85
@ Delete
Obsolete as of RFC 4314, replaced by DeleteMessage and Expunge.
Definition acl.h:69
@ Lookup
Mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox.
Definition acl.h:42
@ Custom2
Server-specific right 2.
Definition acl.h:86
@ KeepSeen
Set or clear the \Seen flag on messages in the mailbox, and keep it across sessions.
Definition acl.h:46
KIMAP2_EXPORT Rights rightsFromString(const QByteArray &string)
Convert the text form of a set of rights into a Rights bitflag.
Definition acl.cpp:69
KIMAP2_EXPORT QByteArray rightsToString(Rights rights)
Convert a set of rights into text format.
Definition acl.cpp:91
KIMAP2_EXPORT Rights normalizedRights(Rights rights)
Returns a rights mask that has no obsolete members anymore, i.e.
Definition acl.cpp:104
KIMAP2_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:118
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 19 2024 11:59:52 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.