PolkitQt-1

polkitqt1-temporaryauthorization.h
1/*
2 This file is part of the PolKit1-qt project
3 SPDX-FileCopyrightText: 2009 Radek Novacek <rnovacek@redhat.com>
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
18typedef 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 */
27namespace PolkitQt1
28{
29
30/**
31 * \class TemporaryAuthorization polkitqt1-temporaryauthorization.h TemporaryAuthorization
32 * \author Radek Novacek <rnovacek@redhat.com>
33 *
34 * \brief This class represents PolicyKit temporary authorization
35 *
36 * This class encapsulates the PolkitTemporaryAuthorization interface.
37 */
38class POLKITQT1_CORE_EXPORT TemporaryAuthorization
39{
40public:
42 TemporaryAuthorization();
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);
52 TemporaryAuthorization(const TemporaryAuthorization &other);
53
54 ~TemporaryAuthorization();
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 */
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
103private:
104 class Data;
106};
107}
108
109Q_DECLARE_METATYPE(PolkitQt1::TemporaryAuthorization::List)
110
111#endif // TEMPORARYAUTHORIZATION_H
This class represents PolicyKit subjects.
QDateTime obtainedAt() const
Gets the time when authorization was obtained.
Subject subject() const
Gets the subject that authorization is for.
QDateTime expirationTime() const
Gets the time when authorizaton will expire.
bool revoke()
Revoke temporary authorization.
QString actionId() const
Gets the identifier of the action that authorization is for.
QString id() const
Gets the identifier for the authorization.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:54:55 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.