File indexing completed on 2024-05-12 05:22:22

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #pragma once
0010 
0011 #include "kgapidrive_export.h"
0012 #include "modifyjob.h"
0013 
0014 namespace KGAPI2
0015 {
0016 
0017 namespace Drive
0018 {
0019 
0020 class KGAPIDRIVE_EXPORT PermissionModifyJob : public KGAPI2::ModifyJob
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit PermissionModifyJob(const QString &fileId, const PermissionPtr &permission, const AccountPtr &account, QObject *parent = nullptr);
0026     explicit PermissionModifyJob(const QString &fileId, const PermissionsList &permissions, const AccountPtr &account, QObject *parent = nullptr);
0027     ~PermissionModifyJob() override;
0028 
0029     /**
0030      * @brief Whether to remove the expiration date. (Default: false)
0031      */
0032     bool removeExpiration() const;
0033 
0034     /**
0035      * @brief Sets whether to remove the expiration date. (Default: false)
0036      */
0037     void setRemoveExpiration(bool removeExpiration);
0038 
0039     /**
0040      * @brief Whether the request supports both My Drives and shared drives.
0041      *
0042      * Set to true by default as LibKGAPI supports Team Drives.
0043      *
0044      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0045      * are assumed to support shared drives.
0046      */
0047     KGAPIDRIVE_DEPRECATED bool supportsAllDrives() const;
0048 
0049     /**
0050      * @brief Sets whether the request supports both My Drives and shared drives.
0051      *
0052      * Set to true by default as LibKGAPI supports Team Drives.
0053      *
0054      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0055      * are assumed to support shared drives.
0056      */
0057     KGAPIDRIVE_DEPRECATED void setSupportsAllDrives(bool supportsAllDrives);
0058 
0059     /**
0060      * @brief Whether changing a role to 'owner' downgrades the current owners
0061      * to writers. Does nothing if the specified role is not 'owner'.
0062      * (Default: false)
0063      */
0064     bool transferOwnership() const;
0065 
0066     /**
0067      * @brief Sets whether changing a role to 'owner' downgrades the current owners
0068      * to writers. Does nothing if the specified role is not 'owner'.
0069      * (Default: false)
0070      */
0071     void setTransferOwnership(bool transferOwnership);
0072 
0073     /**
0074      * @brief Issue the request as a domain administrator; if set to true,
0075      * then the requester will be granted access if the file ID parameter refers
0076      * to a shared drive and the requester is an administrator of the domain to
0077      * which the shared drive belongs. (Default: false)
0078      */
0079     [[nodiscard]] bool useDomainAdminAccess() const;
0080 
0081     /**
0082      * @brief Sets to issue the request as a domain administrator; if set to true,
0083      * then the requester will be granted access if the file ID parameter refers
0084      * to a shared drive and the requester is an administrator of the domain to
0085      * which the shared drive belongs. (Default: false)
0086      */
0087     void setUseDomainAdminAccess(bool useDomainAdminAccess);
0088 
0089 protected:
0090     void start() override;
0091     KGAPI2::ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
0092 
0093 private:
0094     class Private;
0095     QScopedPointer<Private> d;
0096     friend class Private;
0097 };
0098 
0099 } // namespace Drive
0100 
0101 } // namespace KGAPI2