KIMAP2

getacljob.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_GETACLJOB_H
21#define KIMAP2_GETACLJOB_H
22
23#include "kimap2_export.h"
24
25#include "acljobbase.h"
26
27namespace KIMAP2
28{
29
30class Session;
31struct Message;
32class GetAclJobPrivate;
33
34/**
35 * Gets the ACL for 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 * The meaning of identifiers depends on the server implementation,
49 * with the following restrictions:
50 *
51 * - "anyone" means any authenticated user, including anonymous
52 * - an identifier starting with a minus sign ('-') indicates
53 * "negative rights": rights that should be taken away from
54 * matching users
55 *
56 * Other than the above restrictions, ACL identifiers are usually
57 * IMAP usernames, but could potentially be group names as well.
58 *
59 * Note that negative rights override positive rights: if
60 * "fred" and "-fred" are both assigned the 'w' right, the
61 * user "fred" will not have the 'w' right.
62 */
63class KIMAP2_EXPORT GetAclJob : public AclJobBase
64{
65 Q_OBJECT
66 Q_DECLARE_PRIVATE(GetAclJob)
67
68 friend class SessionPrivate;
69
70public:
71 explicit GetAclJob(Session *session);
72 virtual ~GetAclJob();
73
74 /**
75 * The identifiers present in the ACL.
76 *
77 * This method will return an empty list if the job has
78 * not yet been run.
79 *
80 * See the GetAclJob documentation for an explanation of
81 * identifiers; in particular, identifiers starting with
82 * '-' specify negative rights.
83 */
84 QList<QByteArray> identifiers() const;
85 /**
86 * Check whether an identifier has a given right set
87 *
88 * The result of this method is undefined if the job has
89 * not yet completed.
90 *
91 * See the GetAclJob documentation for an explanation of
92 * identifiers; in particular, identifiers starting with
93 * '-' specify negative rights.
94 *
95 * Note that this will not tell you whether the net result
96 * of all the ACL entries means that a given user has
97 * a certain right.
98 *
99 * @param identifier the identifier to check the rights for
100 * @param right the right to check for
101 */
102 bool hasRightEnabled(const QByteArray &identifier, Acl::Right right) const;
103 /**
104 * Get the rights associated with an identifier.
105 *
106 * The result of this method is undefined if the job has
107 * not yet completed.
108 *
109 * See the GetAclJob documentation for an explanation of
110 * identifiers; in particular, identifiers starting with
111 * '-' specify negative rights.
112 *
113 * Note that this will not tell you the rights that a
114 * given user will have once all the ACL entries have
115 * been taken into account.
116 *
117 * @param identifier the identifier to check the rights for
118 */
119 Acl::Rights rights(const QByteArray &identifier) const;
120
121 /**
122 * Gets the full access control list.
123 *
124 * The result of this method is undefined if the job has
125 * not yet completed.
126 *
127 * See the GetAclJob documentation for an explanation of
128 * identifiers; in particular, identifiers starting with
129 * '-' specify negative rights.
130 */
131 QMap<QByteArray, Acl::Rights> allRights() const;
132
133protected:
134 void doStart() Q_DECL_OVERRIDE;
135 void handleResponse(const Message &response) Q_DECL_OVERRIDE;
136
137};
138
139}
140
141#endif
Base class for jobs that operate on mailbox ACLs.
Definition acljobbase.h:45
Gets the ACL for a mailbox.
Definition getacljob.h:64
Right
Possible rights that can be held on a mailbox.
Definition acl.h:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:18 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.