KIMAP

listrightsjob.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 ListRightsJobPrivate;
18
19/**
20 * Lists the possible and automatic rights for
21 * an identifier on a mailbox
22 *
23 * This job can only be run when the session is in the
24 * authenticated (or selected) state.
25 *
26 * The user must have the Acl::Admin permission
27 * on the mailbox for this job to succeed (see
28 * MyRightsJob).
29 *
30 * This job requires that the server supports the ACL
31 * capability, defined in
32 * <a href="https://tools.ietf.org/html/rfc4314">RFC 4314</a>.
33 */
34class KIMAP_EXPORT ListRightsJob : public AclJobBase
35{
36 Q_OBJECT
37 Q_DECLARE_PRIVATE(ListRightsJob)
38
39 friend class SessionPrivate;
40
41public:
42 explicit ListRightsJob(Session *session);
43 ~ListRightsJob() override;
44
45 /**
46 * Sets the identifier that should be looked up
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 *
63 * @param identifier the identifier to list the rights for
64 */
65 void setIdentifier(const QByteArray &identifier);
66 /**
67 * The identifier that will be looked up
68 */
69 [[nodiscard]] QByteArray identifier();
70
71 /**
72 * The rights that will always be assigned to the identifier,
73 * regardless of the access control list.
74 *
75 * For example, under the UNIX permission model, the owner
76 * of a mailbox will always have the Acl::Admin right.
77 */
78 [[nodiscard]] Acl::Rights defaultRights();
79
80 /**
81 * The rights it is possible to assign to the identifier.
82 *
83 * The rights are grouped by those that are tied together.
84 * For each set of rights in the returned list, either all
85 * or none of those rights may be set, but not only some of
86 * them.
87 *
88 * For example, under the UNIX permission model, the following
89 * rights are all controlled by the "write" flag, and hence
90 * must either all be set or all be not set:
91 * - Acl::KeepSeen
92 * - Acl::Write
93 * - Acl::Insert
94 * - Acl::DeleteMessage
95 * - Acl::Expunge
96 */
97 [[nodiscard]] QList<Acl::Rights> possibleRights();
98
99protected:
100 void doStart() override;
101 void handleResponse(const Response &response) override;
102};
103
104}
Base class for jobs that operate on mailbox ACLs.
Definition acljobbase.h:30
Lists the possible and automatic rights for an identifier on a mailbox.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:52:37 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.