File indexing completed on 2024-04-21 03:52:34

0001 /*
0002     SPDX-FileCopyrightText: 2012 Dario Freddi <drf@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef TEST_BACKEND_H
0008 #define TEST_BACKEND_H
0009 
0010 #include "AuthBackend.h"
0011 #include <QHash>
0012 
0013 class QByteArray;
0014 
0015 namespace KAuth
0016 {
0017 class TestBackend : public AuthBackend
0018 {
0019     Q_OBJECT
0020     Q_INTERFACES(KAuth::AuthBackend)
0021 
0022 public:
0023     TestBackend();
0024     void setupAction(const QString &) override;
0025     Action::AuthStatus authorizeAction(const QString &) override;
0026     Action::AuthStatus actionStatus(const QString &) override;
0027     QByteArray callerID() const override;
0028     bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details) override;
0029 
0030 public Q_SLOTS:
0031     void setNewCapabilities(KAuth::AuthBackend::Capabilities capabilities);
0032 
0033 private:
0034     QHash<QString, KAuth::Action::AuthStatus> m_actionStatuses;
0035 };
0036 
0037 } // namespace Auth
0038 
0039 #endif