File indexing completed on 2024-05-12 05:17:21
0001 /* 0002 Copyright (c) 2009 Andras Mantia <amantia@kde.org> 0003 0004 This library is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to the 0016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0017 02110-1301, USA. 0018 */ 0019 0020 #ifndef KIMAP2_ACL_H 0021 #define KIMAP2_ACL_H 0022 0023 #include "kimap2_export.h" 0024 0025 #include <qglobal.h> 0026 0027 namespace KIMAP2 0028 { 0029 0030 /** 0031 * Operations for dealing with mailbox permissions. 0032 */ 0033 namespace Acl 0034 { 0035 0036 /** 0037 * Possible rights that can be held on a mailbox 0038 */ 0039 enum Right { 0040 None = 0x000000, 0041 /** Mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox */ 0042 Lookup = 0x000001, 0043 /** SELECT the mailbox, perform STATUS */ 0044 Read = 0x000002, 0045 /** Set or clear the \Seen flag on messages in the mailbox, and keep it across sessions */ 0046 KeepSeen = 0x000004, 0047 /** Set or clear flags other than \Seen and \Deleted on messages in the mailbox */ 0048 Write = 0x000008, 0049 /** Perform APPEND and COPY with the mailbox as the target */ 0050 Insert = 0x000010, 0051 /** Send mail to the submission address for the mailbox 0052 * 0053 * Note: this is not enforced by IMAP4, but is purely advisory. 0054 */ 0055 Post = 0x000020, 0056 /** Obsolete as of RFC 4314, replaced by CreateMailbox and DeleteMailbox */ 0057 Create = 0x000040, 0058 /** Create new child mailboxes, or move a mailbox with this mailbox as the new parent 0059 * 0060 * Note that what constitutes a "child" mailbox is implementation-defined, but 0061 * . or / are usually used as separaters. 0062 */ 0063 CreateMailbox = 0x000080, 0064 /** Delete or move the mailbox */ 0065 DeleteMailbox = 0x000100, 0066 /** Set or clear the \Deleted flag on messages in the mailbox */ 0067 DeleteMessage = 0x000200, 0068 /** Obsolete as of RFC 4314, replaced by DeleteMessage and Expunge*/ 0069 Delete = 0x000400, 0070 /** View and modify the access control list for the mailbox */ 0071 Admin = 0x000800, 0072 /** Expunge the messages in this mailbox 0073 * 0074 * Note that if this right is not held on a mailbox, closing the mailbox 0075 * (see CloseJob) will succeed, but will not expunge the messages. 0076 */ 0077 Expunge = 0x001000, 0078 /** Write shared annotations 0079 * 0080 * See <a href="http://www.apps.ietf.org/rfc/rfc5257.html" title="IMAP ANNOTATE extension">RFC 0081 * 5257</a>. Only supported by servers that implement the ANNOTATE extension. 0082 */ 0083 WriteShared = 0x002000, 0084 Custom0 = 0x004000, /**< Server-specific right 0 */ 0085 Custom1 = 0x008000, /**< Server-specific right 1 */ 0086 Custom2 = 0x010000, /**< Server-specific right 2 */ 0087 Custom3 = 0x020000, /**< Server-specific right 3 */ 0088 Custom4 = 0x040000, /**< Server-specific right 4 */ 0089 Custom5 = 0x080000, /**< Server-specific right 5 */ 0090 Custom6 = 0x100000, /**< Server-specific right 6 */ 0091 Custom7 = 0x200000, /**< Server-specific right 7 */ 0092 Custom8 = 0x400000, /**< Server-specific right 8 */ 0093 Custom9 = 0x800000 /**< Server-specific right 9 */ 0094 }; 0095 0096 Q_DECLARE_FLAGS(Rights, Right) 0097 0098 /** 0099 * Returns a rights mask that has no obsolete members anymore, i.e. obsolete flags are removed and 0100 * replaced by their successors. 0101 * @param rights set of #Rights flags to normalize 0102 * @since 4.6 0103 */ 0104 KIMAP2_EXPORT Rights normalizedRights(Rights rights); 0105 0106 /** 0107 * Returns a rights mask that contains both obsolete and new flags if one of them is set. 0108 * @param rights set of #Rights flags to augment 0109 * @since 4.6 0110 */ 0111 KIMAP2_EXPORT Rights denormalizedRights(Rights rights); 0112 0113 /** 0114 * Convert a set of rights into text format 0115 * 0116 * No modifier flag ('+' or '-') will be included. 0117 */ 0118 KIMAP2_EXPORT QByteArray rightsToString(Rights rights); 0119 /** 0120 * Convert the text form of a set of rights into a Rights bitflag 0121 * 0122 * Modifier flags ('+' and '-') are ignored, as are any unknown 0123 * characters. This method will not complain if you give it 0124 * something that is not a list of rights. 0125 */ 0126 KIMAP2_EXPORT Rights rightsFromString(const QByteArray &string); 0127 0128 } 0129 } 0130 0131 Q_DECLARE_OPERATORS_FOR_FLAGS(KIMAP2::Acl::Rights) 0132 0133 #endif