Changeset View
Changeset View
Standalone View
Standalone View
src/AuthBackend.h
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | 25 | | |||
26 | #include "kauthaction.h" | 26 | #include "kauthaction.h" | ||
27 | 27 | | |||
28 | namespace KAuth | 28 | namespace KAuth | ||
29 | { | 29 | { | ||
30 | 30 | | |||
31 | typedef Action::DetailsMap DetailsMap; | ||||
32 | | ||||
31 | class AuthBackend : public QObject | 33 | class AuthBackend : public QObject | ||
32 | { | 34 | { | ||
33 | Q_OBJECT | 35 | Q_OBJECT | ||
34 | Q_DISABLE_COPY(AuthBackend) | 36 | Q_DISABLE_COPY(AuthBackend) | ||
35 | 37 | | |||
36 | public: | 38 | public: | ||
37 | enum Capability { | 39 | enum Capability { | ||
38 | NoCapability = 0, | 40 | NoCapability = 0, | ||
Show All 13 Lines | |||||
52 | AuthBackend(); | 54 | AuthBackend(); | ||
53 | virtual ~AuthBackend(); | 55 | virtual ~AuthBackend(); | ||
54 | virtual void setupAction(const QString &action) = 0; | 56 | virtual void setupAction(const QString &action) = 0; | ||
55 | virtual void preAuthAction(const QString &action, QWidget *parent); | 57 | virtual void preAuthAction(const QString &action, QWidget *parent); | ||
56 | virtual Action::AuthStatus authorizeAction(const QString &action) = 0; | 58 | virtual Action::AuthStatus authorizeAction(const QString &action) = 0; | ||
57 | virtual Action::AuthStatus actionStatus(const QString &action) = 0; | 59 | virtual Action::AuthStatus actionStatus(const QString &action) = 0; | ||
58 | virtual QByteArray callerID() const = 0; | 60 | virtual QByteArray callerID() const = 0; | ||
59 | virtual ExtraCallerIDVerificationMethod extraCallerIDVerificationMethod() const; | 61 | virtual ExtraCallerIDVerificationMethod extraCallerIDVerificationMethod() const; | ||
60 | virtual bool isCallerAuthorized(const QString &action, QByteArray callerID) = 0; | 62 | virtual bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details) = 0; | ||
61 | virtual bool actionExists(const QString &action); | 63 | virtual bool actionExists(const QString &action); | ||
sitter: I didn't check super carefully but at a glance the backend api is not public API so we could… | |||||
the mac backend modifies callerID later on so I think it was deliberately kept here. chinmoyr: the mac backend modifies `callerID` later on so I think it was deliberately kept here. | |||||
I wonder if we should change that. Right now every backend gets a QBA copy even when they don't need to modify it. So it sounds to me like it should be const& and the mac backend should make a copy on its stack. Not that it matters a great deal though, so if you disagree that's fine too. sitter: I wonder if we should change that. Right now every backend gets a QBA copy even when they don't… | |||||
Looking at the code your intuition was correct, i.e. none of the QBAs were modified, so I've switched to const & feverfew: Looking at the code your intuition was correct, i.e. none of the QBAs were modified, so I've… | |||||
64 | virtual QVariantMap backendDetails(const DetailsMap &details); | ||||
62 | 65 | | |||
63 | Capabilities capabilities() const; | 66 | Capabilities capabilities() const; | ||
64 | 67 | | |||
65 | protected: | 68 | protected: | ||
66 | void setCapabilities(Capabilities capabilities); | 69 | void setCapabilities(Capabilities capabilities); | ||
67 | 70 | | |||
68 | Q_SIGNALS: | 71 | Q_SIGNALS: | ||
69 | void actionStatusChanged(const QString &action, KAuth::Action::AuthStatus status); | 72 | void actionStatusChanged(const QString &action, KAuth::Action::AuthStatus status); | ||
Show All 12 Lines |
I didn't check super carefully but at a glance the backend api is not public API so we could probably refactor this right now already.
Also, shouldn't the callerID be a const ref?