Kgapi

permission.h
1 /*
2  SPDX-FileCopyrightText: 2012 Andrius da Costa Ribas <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef LIBKGAPI2_DRIVEPERMISSION_H
8 #define LIBKGAPI2_DRIVEPERMISSION_H
9 
10 #include "object.h"
11 #include "types.h"
12 #include "file.h"
13 #include "kgapidrive_export.h"
14 
15 #include <QString>
16 #include <QUrl>
17 
18 namespace KGAPI2
19 {
20 
21 namespace Drive
22 {
23 
34 class KGAPIDRIVE_EXPORT Permission: public KGAPI2::Object
35 {
36 
37  public:
38 
39  enum Role {
40  UndefinedRole = -1,
41  OwnerRole = 0,
42  ReaderRole = 1,
43  WriterRole = 2,
44  CommenterRole = 3,
45  OrganizerRole = 4,
46  FileOrganizerRole = 5,
47  };
48 
49  enum Type {
50  UndefinedType = -1,
51  TypeUser = 0,
52  TypeGroup = 1,
53  TypeDomain = 2,
54  TypeAnyone = 3
55  };
56 
63  {
64 
65  public:
66  enum PermissionType {
67  UndefinedType = -1,
68  TypeFile = 0,
69  TypeMember = 1,
70  };
71 
75  bool operator==(const PermissionDetails &other) const;
76  bool operator!=(const PermissionDetails &other) const { return !operator==(other); }
77 
81  PermissionDetails::PermissionType permissionType() const;
82 
86  Permission::Role role() const;
87 
92  QList<Permission::Role> additionalRoles() const;
93 
99  QString inheritedFrom() const;
100 
104  bool inherited() const;
105 
106  private:
107  class Private;
108  QScopedPointer<Private> const d;
109  friend class Private;
110  friend class Permission;
111  };
112 
115 
116  explicit Permission();
117  explicit Permission(const Permission &other);
118  ~Permission() override;
119  bool operator==(const Permission &other) const;
120  bool operator!=(const Permission &other) const { return !operator==(other); }
121 
125  QString id() const;
126 
132  void setId(const QString &id);
133 
137  QUrl selfLink() const;
138 
142  QString name() const;
143 
147  Permission::Role role() const;
148 
152  void setRole(Permission::Role role);
153 
157  QList<Role> additionalRoles() const;
158 
164  void setAdditionalRoles(const QList<Role> &additionalRoles);
165 
169  Permission::Type type() const;
170 
176  void setType(Permission::Type type);
177 
181  QString authKey() const;
182 
186  bool withLink() const;
187 
193  void setWithLink(bool withLink);
194 
198  QUrl photoLink() const;
199 
207  QString value() const;
208 
218  void setValue(const QString &value);
219 
225  QString emailAddress() const;
226 
232  QString domain() const;
233 
237  QDateTime expirationDate() const;
238 
243  bool deleted() const;
244 
249  Permission::PermissionDetailsList permissionDetails() const;
250 
251  static PermissionPtr fromJSON(const QByteArray &jsonData);
252  static PermissionsList fromJSONFeed(const QByteArray &jsonData);
253  static QByteArray toJSON(const PermissionPtr &permission);
254 
255  private:
256  class Private;
257  Private *const d;
258  friend class Private;
259  friend class File::Private;
260 };
261 
262 } /* namespace Drive */
263 
264 } /* namespace KGAPI2 */
265 
266 #endif // LIBKGAPI2_DRIVEPERMISSION_H
Base class for all objects.
Definition: object.h:31
Permission contains a permission for a file.
Definition: permission.h:34
Details of whether the permissions on this shared drive item are inherited or directly on this item...
Definition: permission.h:62
A job to fetch a single map tile described by a StaticMapUrl.
Definition: blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Oct 22 2020 23:14:26 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.