1 /* 2 SPDX-FileCopyrightText: 2012 Dario Freddi <drf@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.1-or-later 5 */ 6 7 #ifndef TEST_BACKEND_H 8 #define TEST_BACKEND_H 9 10 #include "AuthBackend.h" 11 #include <QHash> 12 13 class QByteArray; 14 15 namespace KAuth 16 { 17 class TestBackend : public AuthBackend 18 { 19 Q_OBJECT 20 Q_INTERFACES(KAuth::AuthBackend) 21 22 public: 23 TestBackend(); 24 void setupAction(const QString &) override; 25 Action::AuthStatus authorizeAction(const QString &) override; 26 Action::AuthStatus actionStatus(const QString &) override; 27 QByteArray callerID() const override; 28 bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details) override; 29 bool actionExists(const QString &action) override; 30 31 public Q_SLOTS: 32 void setNewCapabilities(KAuth::AuthBackend::Capabilities capabilities); 33 34 private: 35 QHash<QString, KAuth::Action::AuthStatus> m_actionStatuses; 36 }; 37 38 } // namespace Auth 39 40 #endif 41