Changeset View
Changeset View
Standalone View
Standalone View
src/backends/policykit/PolicyKitBackend.h
- This file was copied from src/backends/mac/AuthServicesBackend.h.
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com> | 2 | * Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com> | ||
3 | * Copyright (C) 2009 Dario Freddi <drf@kde.org> | ||||
3 | * | 4 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU Lesser General Public License as published by | 6 | * it under the terms of the GNU Lesser General Public License as published by | ||
6 | * the Free Software Foundation; either version 2.1 of the License, or | 7 | * the Free Software Foundation; either version 2.1 of the License, or | ||
7 | * (at your option) any later version. | 8 | * (at your option) any later version. | ||
8 | * | 9 | * | ||
9 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
13 | * | 14 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public License | 15 | * You should have received a copy of the GNU Lesser General Public License | ||
15 | * along with this program; if not, write to the | 16 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 17 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . | ||
18 | */ | 19 | */ | ||
19 | 20 | | |||
20 | #ifndef AUTHSERVICES_BACKEND_H | 21 | #ifndef POLICYKIT_BACKEND_H | ||
21 | #define AUTHSERVICES_BACKEND_H | 22 | #define POLICYKIT_BACKEND_H | ||
22 | 23 | | |||
23 | #include "AuthBackend.h" | 24 | #include "AuthBackend.h" | ||
24 | #include <Security/Security.h> | 25 | #include <QHash> | ||
26 | | ||||
27 | class QByteArray; | ||||
25 | 28 | | |||
26 | namespace KAuth | 29 | namespace KAuth | ||
27 | { | 30 | { | ||
28 | 31 | | |||
29 | class AuthServicesBackend : public AuthBackend | 32 | class PolicyKitBackend : public AuthBackend | ||
30 | { | 33 | { | ||
31 | Q_OBJECT | 34 | Q_OBJECT | ||
32 | Q_PLUGIN_METADATA(IID "org.kde.AuthServicesBackend") | 35 | Q_PLUGIN_METADATA(IID "org.kde.PolicyKitBackend") | ||
33 | Q_INTERFACES(KAuth::AuthBackend) | 36 | Q_INTERFACES(KAuth::AuthBackend) | ||
34 | | ||||
35 | public: | 37 | public: | ||
36 | AuthServicesBackend(); | 38 | PolicyKitBackend(); | ||
37 | virtual ~AuthServicesBackend(); | | |||
38 | virtual void setupAction(const QString &); | 39 | virtual void setupAction(const QString &); | ||
39 | virtual Action::AuthStatus authorizeAction(const QString &); | 40 | virtual Action::AuthStatus authorizeAction(const QString &); | ||
40 | virtual Action::AuthStatus actionStatus(const QString &); | 41 | virtual Action::AuthStatus actionStatus(const QString &); | ||
41 | virtual QByteArray callerID() const; | 42 | virtual QByteArray callerID() const; | ||
42 | virtual bool isCallerAuthorized(const QString &action, QByteArray callerID); | 43 | ExtraCallerIDVerificationMethod extraCallerIDVerificationMethod() const override; | ||
43 | virtual bool actionExists(const QString &action); | 44 | virtual bool isCallerAuthorized(const QString &action, QByteArray callerID, const QVariantMap &details); | ||
44 | }; | | |||
45 | 45 | | |||
46 | private Q_SLOTS: | ||||
47 | void checkForResultChanged(); | ||||
46 | 48 | | |||
47 | } // namespace KAuth | 49 | private: | ||
50 | QHash<QString, Action::AuthStatus> m_cachedResults; | ||||
51 | }; | ||||
48 | 52 | | |||
49 | #endif | 53 | } // namespace Auth | ||
50 | 54 | | |||
55 | #endif |