KIMAP

getacljob.h
1/*
2 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "kimap_export.h"
10
11#include "acljobbase.h"
12
13namespace KIMAP
14{
15class Session;
16struct Response;
17class GetAclJobPrivate;
18
19/**
20 * Gets the ACL for a mailbox
21 *
22 * This job can only be run when the session is in the
23 * authenticated (or selected) state.
24 *
25 * The user must have the Acl::Admin permission
26 * on the mailbox for this job to succeed (see
27 * MyRightsJob).
28 *
29 * This job requires that the server supports the ACL
30 * capability, defined in
31 * <a href="https://tools.ietf.org/html/rfc4314">RFC 4314</a>.
32 *
33 * The meaning of identifiers depends on the server implementation,
34 * with the following restrictions:
35 *
36 * - "anyone" means any authenticated user, including anonymous
37 * - an identifier starting with a minus sign ('-') indicates
38 * "negative rights": rights that should be taken away from
39 * matching users
40 *
41 * Other than the above restrictions, ACL identifiers are usually
42 * IMAP usernames, but could potentially be group names as well.
43 *
44 * Note that negative rights override positive rights: if
45 * "fred" and "-fred" are both assigned the 'w' right, the
46 * user "fred" will not have the 'w' right.
47 */
48class KIMAP_EXPORT GetAclJob : public AclJobBase
49{
50 Q_OBJECT
51 Q_DECLARE_PRIVATE(GetAclJob)
52
53 friend class SessionPrivate;
54
55public:
56 explicit GetAclJob(Session *session);
57 ~GetAclJob() override;
58
59 /**
60 * The identifiers present in the ACL.
61 *
62 * This method will return an empty list if the job has
63 * not yet been run.
64 *
65 * See the GetAclJob documentation for an explanation of
66 * identifiers; in particular, identifiers starting with
67 * '-' specify negative rights.
68 */
69 [[nodiscard]] QList<QByteArray> identifiers() const;
70 /**
71 * Check whether an identifier has a given right set
72 *
73 * The result of this method is undefined if the job has
74 * not yet completed.
75 *
76 * See the GetAclJob documentation for an explanation of
77 * identifiers; in particular, identifiers starting with
78 * '-' specify negative rights.
79 *
80 * Note that this will not tell you whether the net result
81 * of all the ACL entries means that a given user has
82 * a certain right.
83 *
84 * @param identifier the identifier to check the rights for
85 * @param right the right to check for
86 */
87 [[nodiscard]] bool hasRightEnabled(const QByteArray &identifier, Acl::Right right) const;
88 /**
89 * Get the rights associated with an identifier.
90 *
91 * The result of this method is undefined if the job has
92 * not yet completed.
93 *
94 * See the GetAclJob documentation for an explanation of
95 * identifiers; in particular, identifiers starting with
96 * '-' specify negative rights.
97 *
98 * Note that this will not tell you the rights that a
99 * given user will have once all the ACL entries have
100 * been taken into account.
101 *
102 * @param identifier the identifier to check the rights for
103 */
104 [[nodiscard]] Acl::Rights rights(const QByteArray &identifier) const;
105
106 /**
107 * Gets the full access control list.
108 *
109 * The result of this method is undefined if the job has
110 * not yet completed.
111 *
112 * See the GetAclJob documentation for an explanation of
113 * identifiers; in particular, identifiers starting with
114 * '-' specify negative rights.
115 */
116 [[nodiscard]] QMap<QByteArray, Acl::Rights> allRights() const;
117
118protected:
119 void doStart() override;
120 void handleResponse(const Response &response) override;
121};
122
123}
Base class for jobs that operate on mailbox ACLs.
Definition acljobbase.h:30
Gets the ACL for a mailbox.
Definition getacljob.h:49
Right
Possible rights that can be held on a mailbox.
Definition acl.h:23
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:06:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.