File indexing completed on 2024-05-05 16:05:15

0001 /*
0002     SPDX-FileCopyrightText: 2008 Nicola Gigante <nicola.gigante@gmail.com>
0003     SPDX-FileCopyrightText: 2009 Radek Novacek <rnovacek@redhat.com>
0004     SPDX-FileCopyrightText: 2009-2010 Dario Freddi <drf@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #ifndef POLKIT1BACKEND_H
0010 #define POLKIT1BACKEND_H
0011 
0012 #include "AuthBackend.h"
0013 
0014 #include <QEventLoop>
0015 #include <QHash>
0016 #include <QStringList>
0017 
0018 #include <PolkitQt1/Authority>
0019 
0020 class QByteArray;
0021 
0022 namespace KAuth
0023 {
0024 class Polkit1Backend : public AuthBackend
0025 {
0026     Q_OBJECT
0027     Q_PLUGIN_METADATA(IID "org.kde.Polkit1Backend")
0028     Q_INTERFACES(KAuth::AuthBackend)
0029 
0030 public:
0031     Polkit1Backend();
0032     ~Polkit1Backend() override;
0033     void setupAction(const QString &) override;
0034     void preAuthAction(const QString &action, QWidget *parent) override;
0035     Action::AuthStatus authorizeAction(const QString &) override;
0036     Action::AuthStatus actionStatus(const QString &) override;
0037     QByteArray callerID() const override;
0038     ExtraCallerIDVerificationMethod extraCallerIDVerificationMethod() const override;
0039     virtual bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details) override;
0040     bool actionExists(const QString &action) override;
0041     QVariantMap backendDetails(const DetailsMap &details) override;
0042 
0043 private Q_SLOTS:
0044     void checkForResultChanged();
0045 
0046 private:
0047     QHash<QString, Action::AuthStatus> m_cachedResults;
0048 };
0049 
0050 } // namespace Auth
0051 
0052 #endif