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

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 "createjob.h"
0012 #include "kgapidrive_export.h"
0013 
0014 namespace KGAPI2
0015 {
0016 
0017 namespace Drive
0018 {
0019 
0020 class KGAPIDRIVE_EXPORT PermissionCreateJob : public KGAPI2::CreateJob
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit PermissionCreateJob(const QString &fileId, const PermissionPtr &permission, const AccountPtr &account, QObject *parent = nullptr);
0026     explicit PermissionCreateJob(const QString &fileId, const PermissionsList &permissions, const AccountPtr &account, QObject *parent = nullptr);
0027     ~PermissionCreateJob() override;
0028 
0029     /**
0030      * @brief The plain text custom message to include in notification emails.
0031      */
0032     [[nodiscard]] QString emailMessage() const;
0033 
0034     /**
0035      * @brief Sets the plain text custom message to include in notification emails.
0036      */
0037     void setEmailMessage(const QString &emailMessage);
0038 
0039     /**
0040      * @brief Sets whether to send notification emails when sharing to users
0041      * or groups. This parameter is ignored and an email is sent if the role
0042      * is owner. (Default: true)
0043      */
0044     [[nodiscard]] bool sendNotificationEmails() const;
0045 
0046     /**
0047      * @brief Whether to send notification emails when sharing to users or
0048      * groups. This parameter is ignored and an email is sent if the role
0049      * is owner. (Default: true)
0050      */
0051     void setSendNotificationEmails(bool sendNotificationEmails);
0052 
0053     /**
0054      * @brief Whether the request supports both My Drives and shared drives.
0055      *
0056      * Set to true by default as LibKGAPI supports Team Drives.
0057      *
0058      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0059      * are assumed to support shared drives.
0060      */
0061     KGAPIDRIVE_DEPRECATED bool supportsAllDrives() const;
0062 
0063     /**
0064      * @brief Sets whether the request supports both My Drives and shared drives.
0065      *
0066      * Set to true by default as LibKGAPI supports Team Drives.
0067      *
0068      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0069      * are assumed to support shared drives.
0070      */
0071     KGAPIDRIVE_DEPRECATED void setSupportsAllDrives(bool supportsAllDrives);
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