KIMAP2

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

KDE's Doxygen guidelines are available online.