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 KIMAP_LISTRIGHTSJOB_H |
21 | #define KIMAP_LISTRIGHTSJOB_H |
22 | |
23 | #include "kimap_export.h" |
24 | |
25 | #include "acljobbase.h" |
26 | |
27 | namespace KIMAP { |
28 | |
29 | class Session; |
30 | struct Message; |
31 | class ListRightsJobPrivate; |
32 | |
33 | /** |
34 | * Lists the possible and automatic rights for |
35 | * an identifier on a mailbox |
36 | * |
37 | * This job can only be run when the session is in the |
38 | * authenticated (or selected) state. |
39 | * |
40 | * The user must have the Acl::Admin permission |
41 | * on the mailbox for this job to succeed (see |
42 | * MyRightsJob). |
43 | * |
44 | * This job requires that the server supports the ACL |
45 | * capability, defined in |
46 | * <a href="http://www.apps.ietf.org/rfc/rfc4314.html">RFC 4314</a>. |
47 | */ |
48 | class KIMAP_EXPORT ListRightsJob : public AclJobBase |
49 | { |
50 | Q_OBJECT |
51 | Q_DECLARE_PRIVATE( ListRightsJob ) |
52 | |
53 | friend class SessionPrivate; |
54 | |
55 | public: |
56 | explicit ListRightsJob( Session *session ); |
57 | virtual ~ListRightsJob(); |
58 | |
59 | /** |
60 | * Sets the identifier that should be looked up |
61 | * |
62 | * The meaning of identifiers depends on the server implementation, |
63 | * with the following restrictions: |
64 | * |
65 | * - "anyone" means any authenticated user, including anonymous |
66 | * - an identifier starting with a minus sign ('-') indicates |
67 | * "negative rights": rights that should be taken away from |
68 | * matching users |
69 | * |
70 | * Other than the above restrictions, ACL identifiers are usually |
71 | * IMAP usernames, but could potentially be group names as well. |
72 | * |
73 | * Note that negative rights override positive rights: if |
74 | * "fred" and "-fred" are both assigned the 'w' right, the |
75 | * user "fred" will not have the 'w' right. |
76 | * |
77 | * @param identifier the identifier to list the rights for |
78 | */ |
79 | void setIdentifier( const QByteArray &identifier ); |
80 | /** |
81 | * The identifier that will be looked up |
82 | */ |
83 | QByteArray identifier(); |
84 | |
85 | /** |
86 | * The rights that will always be assigned to the identifier, |
87 | * regardless of the access control list. |
88 | * |
89 | * For example, under the UNIX permission model, the owner |
90 | * of a mailbox will always have the Acl::Admin right. |
91 | */ |
92 | Acl::Rights defaultRights(); |
93 | |
94 | /** |
95 | * The rights it is possible to assign to the identifier. |
96 | * |
97 | * The rights are grouped by those that are tied together. |
98 | * For each set of rights in the returned list, either all |
99 | * or none of those rights may be set, but not only some of |
100 | * them. |
101 | * |
102 | * For example, under the UNIX permission model, the following |
103 | * rights are all controlled by the "write" flag, and hence |
104 | * must either all be set or all be not set: |
105 | * - Acl::KeepSeen |
106 | * - Acl::Write |
107 | * - Acl::Insert |
108 | * - Acl::DeleteMessage |
109 | * - Acl::Expunge |
110 | */ |
111 | QList<Acl::Rights> possibleRights(); |
112 | |
113 | protected: |
114 | virtual void doStart(); |
115 | virtual void handleResponse(const Message &response); |
116 | |
117 | }; |
118 | |
119 | } |
120 | |
121 | #endif |
122 | |