Kgapi

permission.h
1 /*
2  Copyright 2012 Andrius da Costa Ribas <[email protected]>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) version 3, or any
8  later version accepted by the membership of KDE e.V. (or its
9  successor approved by the membership of KDE e.V.), which shall
10  act as a proxy defined in Section 6 of version 3 of the license.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library. If not, see <https://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef LIBKGAPI2_DRIVEPERMISSION_H
22 #define LIBKGAPI2_DRIVEPERMISSION_H
23 
24 #include "object.h"
25 #include "types.h"
26 #include "file.h"
27 #include "kgapidrive_export.h"
28 
29 #include <QString>
30 #include <QUrl>
31 
32 namespace KGAPI2
33 {
34 
35 namespace Drive
36 {
37 
48 class KGAPIDRIVE_EXPORT Permission: public KGAPI2::Object
49 {
50 
51  public:
52 
53  enum Role {
54  UndefinedRole = -1,
55  OwnerRole = 0,
56  ReaderRole = 1,
57  WriterRole = 2,
58  CommenterRole = 3,
59  OrganizerRole = 4,
60  FileOrganizerRole = 5,
61  };
62 
63  enum Type {
64  UndefinedType = -1,
65  TypeUser = 0,
66  TypeGroup = 1,
67  TypeDomain = 2,
68  TypeAnyone = 3
69  };
70 
77  {
78 
79  public:
80  enum PermissionType {
81  UndefinedType = -1,
82  TypeFile = 0,
83  TypeMember = 1,
84  };
85 
89  bool operator==(const PermissionDetails &other) const;
90  bool operator!=(const PermissionDetails &other) const { return !operator==(other); }
91 
95  PermissionDetails::PermissionType permissionType() const;
96 
100  Permission::Role role() const;
101 
106  QList<Permission::Role> additionalRoles() const;
107 
113  QString inheritedFrom() const;
114 
118  bool inherited() const;
119 
120  private:
121  class Private;
122  QScopedPointer<Private> const d;
123  friend class Private;
124  friend class Permission;
125  };
126 
129 
130  explicit Permission();
131  explicit Permission(const Permission &other);
132  ~Permission() override;
133  bool operator==(const Permission &other) const;
134  bool operator!=(const Permission &other) const { return !operator==(other); }
135 
139  QString id() const;
140 
146  void setId(const QString &id);
147 
151  QUrl selfLink() const;
152 
156  QString name() const;
157 
161  Permission::Role role() const;
162 
166  void setRole(Permission::Role role);
167 
171  QList<Role> additionalRoles() const;
172 
178  void setAdditionalRoles(const QList<Role> &additionalRoles);
179 
183  Permission::Type type() const;
184 
190  void setType(Permission::Type type);
191 
195  QString authKey() const;
196 
200  bool withLink() const;
201 
207  void setWithLink(bool withLink);
208 
212  QUrl photoLink() const;
213 
221  QString value() const;
222 
232  void setValue(const QString &value);
233 
239  QString emailAddress() const;
240 
246  QString domain() const;
247 
251  QDateTime expirationDate() const;
252 
257  bool deleted() const;
258 
263  Permission::PermissionDetailsList permissionDetails() const;
264 
265  static PermissionPtr fromJSON(const QByteArray &jsonData);
266  static PermissionsList fromJSONFeed(const QByteArray &jsonData);
267  static QByteArray toJSON(const PermissionPtr &permission);
268 
269  private:
270  class Private;
271  Private *const d;
272  friend class Private;
273  friend class File::Private;
274 };
275 
276 } /* namespace Drive */
277 
278 } /* namespace KGAPI2 */
279 
280 #endif // LIBKGAPI2_DRIVEPERMISSION_H
Base class for all objects.
Definition: object.h:45
Permission contains a permission for a file.
Definition: permission.h:48
Details of whether the permissions on this shared drive item are inherited or directly on this item...
Definition: permission.h:76
A job to fetch a single map tile described by a StaticMapUrl.
Definition: blog.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri May 29 2020 22:32:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.