KIMAP

setacljob.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 SetAclJobPrivate;
18
19/**
20 * Sets the rights that correspond to an identifier on a mailbox
21 *
22 * This job can only be run when the session is in the
23 * authenticated (or selected) state.
24 *
25 * This job requires that the server supports the ACL
26 * capability, defined in
27 * <a href="https://tools.ietf.org/html/rfc4314">RFC 4314</a>.
28 */
29class KIMAP_EXPORT SetAclJob : public AclJobBase
30{
31 Q_OBJECT
32 Q_DECLARE_PRIVATE(SetAclJob)
33
34 friend class SessionPrivate;
35
36public:
37 explicit SetAclJob(Session *session);
38 ~SetAclJob() override;
39
40 /**
41 * Sets the rights that will be changed for the identifier
42 *
43 * Note that multiple calls to this method will have a
44 * non-intuitive effect: the @p modifier value of the most
45 * recent call will be used, but the OR'd-together values
46 * of all calls to setRights() will be used.
47 *
48 * If the server does not recognise any of the rights,
49 * the job will fail and the ACL for the mailbox will
50 * remain unchanged.
51 *
52 * Note that some rights may be tied together, and must be set
53 * or removed as a group. See ListRightsJob::possibleRights()
54 * for more details. The server will only set a tied group
55 * of rights if you have requested that all the rights in that
56 * group should be set.
57 *
58 * @param modifier determines whether the rights will be
59 * added to the identifier, removed from
60 * the identifier or will replace any
61 * existing rights assigned to the
62 * identifier
63 * @param rights the rights to be added, removed or set
64 */
65 void setRights(AclModifier modifier, Acl::Rights rights);
66
67 /**
68 * Sets the identifier the rights will be modified for
69 *
70 * The meaning of identifiers depends on the server implementation,
71 * with the following restrictions:
72 *
73 * - "anyone" means any authenticated user, including anonymous
74 * - an identifier starting with a minus sign ('-') indicates
75 * "negative rights": rights that should be taken away from
76 * matching users
77 *
78 * Other than the above restrictions, ACL identifiers are usually
79 * IMAP usernames, but could potentially be group names as well.
80 *
81 * Note that negative rights override positive rights: if
82 * "fred" and "-fred" are both assigned the 'w' right, the
83 * user "fred" will not have the 'w' right.
84 * @param identifier the identifier to set
85 */
86 void setIdentifier(const QByteArray &identifier);
87 /**
88 * The identifier that rights will be associated with
89 */
90 [[nodiscard]] QByteArray identifier();
91
92protected:
93 void doStart() override;
94};
95
96}
Base class for jobs that operate on mailbox ACLs.
Definition acljobbase.h:30
AclModifier
Used when subclassing to specify how the ACL will be modified.
Definition acljobbase.h:43
Sets the rights that correspond to an identifier on a mailbox.
Definition setacljob.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:37 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.