File indexing completed on 2024-04-14 14:17:57

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     bool actionExists(const QString &action) override;
0030 
0031 public Q_SLOTS:
0032     void setNewCapabilities(KAuth::AuthBackend::Capabilities capabilities);
0033 
0034 private:
0035     QHash<QString, KAuth::Action::AuthStatus> m_actionStatuses;
0036 };
0037 
0038 } // namespace Auth
0039 
0040 #endif