File indexing completed on 2024-09-08 03:36:48
0001 /* 0002 SPDX-FileCopyrightText: 2008 Nicola Gigante <nicola.gigante@gmail.com> 0003 SPDX-FileCopyrightText: 2009-2010 Dario Freddi <drf@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef KAUTH_AUTH_BACKEND_H 0009 #define KAUTH_AUTH_BACKEND_H 0010 0011 #include <QObject> 0012 0013 #include "action.h" 0014 0015 namespace KAuth 0016 { 0017 typedef Action::DetailsMap DetailsMap; 0018 0019 class AuthBackend : public QObject 0020 { 0021 Q_OBJECT 0022 Q_DISABLE_COPY(AuthBackend) 0023 0024 public: 0025 enum Capability { 0026 NoCapability = 0, 0027 AuthorizeFromClientCapability = 1, 0028 AuthorizeFromHelperCapability = 2, 0029 PreAuthActionCapability = 4, 0030 }; 0031 Q_DECLARE_FLAGS(Capabilities, Capability) 0032 0033 AuthBackend(); 0034 ~AuthBackend() override; 0035 virtual void setupAction(const QString &action) = 0; 0036 virtual void preAuthAction(const QString &action, QWindow *parent); 0037 virtual Action::AuthStatus authorizeAction(const QString &action) = 0; 0038 virtual Action::AuthStatus actionStatus(const QString &action) = 0; 0039 virtual QByteArray callerID() const = 0; 0040 virtual bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details) = 0; 0041 virtual QVariantMap backendDetails(const DetailsMap &details); 0042 0043 Capabilities capabilities() const; 0044 0045 protected: 0046 void setCapabilities(Capabilities capabilities); 0047 0048 Q_SIGNALS: 0049 void actionStatusChanged(const QString &action, KAuth::Action::AuthStatus status); 0050 0051 private: 0052 class Private; 0053 Private *const d; 0054 }; 0055 0056 Q_DECLARE_OPERATORS_FOR_FLAGS(AuthBackend::Capabilities) 0057 0058 } // namespace Auth 0059 0060 Q_DECLARE_INTERFACE(KAuth::AuthBackend, "org.kde.kf6auth.AuthBackend/0.1") 0061 0062 #endif