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 KIMAP_SETACLJOB_H
21#define KIMAP_SETACLJOB_H
22
23#include "kimap_export.h"
24
25#include "acljobbase.h"
26
27namespace KIMAP {
28
29class Session;
30struct Message;
31class SetAclJobPrivate;
32
33/**
34 * Sets the rights that correspond to an identifier on a mailbox
35 *
36 * This job can only be run when the session is in the
37 * authenticated (or selected) state.
38 *
39 * This job requires that the server supports the ACL
40 * capability, defined in
41 * <a href="http://www.apps.ietf.org/rfc/rfc4314.html">RFC 4314</a>.
42 */
43class KIMAP_EXPORT SetAclJob : public AclJobBase
44{
45 Q_OBJECT
46 Q_DECLARE_PRIVATE( SetAclJob )
47
48 friend class SessionPrivate;
49
50 public:
51 explicit SetAclJob( Session *session );
52 virtual ~SetAclJob();
53
54 /**
55 * Sets the rights that will be changed for the identifier
56 *
57 * Note that multiple calls to this method will have a
58 * non-intuitive effect: the @p modifier value of the most
59 * recent call will be used, but the OR'd-together values
60 * of all calls to setRights() will be used.
61 *
62 * If the server does not recognise any of the rights,
63 * the job will fail and the ACL for the mailbox will
64 * remain unchanged.
65 *
66 * Note that some rights may be tied together, and must be set
67 * or removed as a group. See ListRightsJob::possibleRights()
68 * for more details. The server will only set a tied group
69 * of rights if you have requested that all the rights in that
70 * group should be set.
71 *
72 * @param modifier determines whether the rights will be
73 * added to the identifier, removed from
74 * the identifier or will replace any
75 * existing rights assigned to the
76 * identifier
77 * @param rights the rights to be added, removed or set
78 */
79 void setRights(AclModifier modifier, Acl::Rights rights);
80
81 /**
82 * Sets the identifier the rights will be modified for
83 *
84 * The meaning of identifiers depends on the server implementation,
85 * with the following restrictions:
86 *
87 * - "anyone" means any authenticated user, including anonymous
88 * - an identifier starting with a minus sign ('-') indicates
89 * "negative rights": rights that should be taken away from
90 * matching users
91 *
92 * Other than the above restrictions, ACL identifiers are usually
93 * IMAP usernames, but could potentially be group names as well.
94 *
95 * Note that negative rights override positive rights: if
96 * "fred" and "-fred" are both assigned the 'w' right, the
97 * user "fred" will not have the 'w' right.
98 * @param identifier the identifier to set
99 */
100 void setIdentifier( const QByteArray &identifier );
101 /**
102 * The identifier that rights will be associated with
103 */
104 QByteArray identifier();
105
106 protected:
107 virtual void doStart();
108
109};
110
111}
112
113#endif
114