PolkitQt-1

polkitqt1-temporaryauthorization.h
1 /*
2  This file is part of the PolKit1-qt project
3  SPDX-FileCopyrightText: 2009 Radek Novacek <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef POLKITQT1_TEMPORARYAUTHORIZATION_H
9 #define POLKITQT1_TEMPORARYAUTHORIZATION_H
10 
11 #include "polkitqt1-subject.h"
12 
13 #include <QObject>
14 #include <QDateTime>
15 #include <QMetaType>
16 #include <QSharedData>
17 
18 typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization;
19 
20 /**
21  * \namespace PolkitQt1 PolkitQt
22  *
23  * \brief Namespace wrapping PolicyKit-Qt classes
24  *
25  * This namespace wraps all PolicyKit-Qt classes.
26  */
27 namespace PolkitQt1
28 {
29 
30 /**
31  * \class TemporaryAuthorization polkitqt1-temporaryauthorization.h TemporaryAuthorization
32  * \author Radek Novacek <[email protected]>
33  *
34  * \brief This class represents PolicyKit temporary authorization
35  *
36  * This class encapsulates the PolkitTemporaryAuthorization interface.
37  */
38 class POLKITQT1_CORE_EXPORT TemporaryAuthorization
39 {
40 public:
43  /**
44  * Creates TemporaryAuthorization object from PolkitTemporaryAuthorization
45  *
46  * \warning It shouldn't be used directly unless you are completely aware of what are you doing
47  *
48  * \param pkTemporaryAuthorization PolkitTemporaryAuthorization object
49  * \param parent
50  */
51  explicit TemporaryAuthorization(PolkitTemporaryAuthorization *pkTemporaryAuthorization);
53 
55 
56  TemporaryAuthorization &operator=(const TemporaryAuthorization &other);
57 
58  /**
59  * \brief Gets the identifier for the authorization.
60  *
61  * This identifier can be user by the revokeTemporaryAuthorization function
62  *
63  * \return Unique identifier for the authorization
64  */
65  QString id() const;
66 
67  /**
68  * \brief Gets the identifier of the action that authorization is for
69  *
70  * \return String that identifies the action
71  */
72  QString actionId() const;
73 
74  /**
75  * \brief Gets the subject that authorization is for
76  *
77  * \return A Subject.
78  */
79  Subject subject() const;
80 
81  /**
82  * \brief Gets the time when authorization was obtained
83  *
84  * \return Time of obtaining the authorization
85  */
86  QDateTime obtainedAt() const;
87 
88  /**
89  * \brief Gets the time when authorizaton will expire
90  *
91  * \return Time of expiration
92  */
93  QDateTime expirationTime() const;
94 
95  /**
96  * \brief Revoke temporary authorization
97  *
98  * \return \c true Authorization has been revoked
99  * \c false Revoking authorization failed
100  */
101  bool revoke();
102 
103 private:
104  class Data;
106 };
107 }
108 
109 Q_DECLARE_METATYPE(PolkitQt1::TemporaryAuthorization::List)
110 
111 #endif // TEMPORARYAUTHORIZATION_H
This class represents PolicyKit subjects.
This class represents PolicyKit temporary authorization.
Namespace wrapping Polkit-Qt classes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Jun 26 2022 04:06:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.