KDECore
AuthBackend.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com> 00003 * Copyright (C) 2009-2010 Dario Freddi <drf@kde.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as published by 00007 * the Free Software Foundation; either version 2.1 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program; if not, write to the 00017 * Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . 00019 */ 00020 00021 #ifndef AUTH_BACKEND_H 00022 #define AUTH_BACKEND_H 00023 00024 #include <QObject> 00025 00026 #include "kauthaction.h" 00027 00028 namespace KAuth 00029 { 00030 00031 class AuthBackend : public QObject 00032 { 00033 Q_OBJECT 00034 Q_DISABLE_COPY(AuthBackend) 00035 00036 public: 00037 enum Capability { 00038 NoCapability = 0, 00039 AuthorizeFromClientCapability = 1, 00040 AuthorizeFromHelperCapability = 2, 00041 CheckActionExistenceCapability = 4, 00042 PreAuthActionCapability = 8 00043 }; 00044 Q_DECLARE_FLAGS(Capabilities, Capability) 00045 00046 AuthBackend(); 00047 virtual ~AuthBackend(); 00048 virtual void setupAction(const QString &action) = 0; 00049 virtual void preAuthAction(const QString &action, QWidget *parent); 00050 virtual Action::AuthStatus authorizeAction(const QString &action) = 0; 00051 virtual Action::AuthStatus actionStatus(const QString &action) = 0; 00052 virtual QByteArray callerID() const = 0; 00053 virtual bool isCallerAuthorized(const QString &action, QByteArray callerID) = 0; 00054 virtual bool actionExists(const QString &action); 00055 00056 Capabilities capabilities() const; 00057 00058 protected: 00059 void setCapabilities(Capabilities capabilities); 00060 00061 Q_SIGNALS: 00062 void actionStatusChanged(const QString &action, Action::AuthStatus status); 00063 00064 private: 00065 class Private; 00066 Private * const d; 00067 }; 00068 00069 } // namespace Auth 00070 00071 Q_DECLARE_INTERFACE(KAuth::AuthBackend, "org.kde.auth.AuthBackend/0.1") 00072 Q_DECLARE_OPERATORS_FOR_FLAGS(KAuth::AuthBackend::Capabilities) 00073 00074 #endif
KDE 4.6 API Reference