From 1bae47da5149a5d4eb43c6b8ae92a05f64d6d6b5 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 24 Jun 2013 14:00:38 +0200 Subject: [PATCH] Add a storage class for API users --- src/tomahawk/web/Api2User.cpp | 81 +++++++++++++++++++++++++++++++++++ src/tomahawk/web/Api2User.h | 62 +++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 src/tomahawk/web/Api2User.cpp create mode 100644 src/tomahawk/web/Api2User.h diff --git a/src/tomahawk/web/Api2User.cpp b/src/tomahawk/web/Api2User.cpp new file mode 100644 index 000000000..5ecd6bccf --- /dev/null +++ b/src/tomahawk/web/Api2User.cpp @@ -0,0 +1,81 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2013, Uwe L. Korn + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#include "Api2User.h" + +Api2User::Api2User( const QString& name ) + : QObject( 0 ) + , m_aclDecision( None ) + , m_name( name ) +{ +} + +Api2User::ACLDecision +Api2User::aclDecision() const +{ + return m_aclDecision; +} + + +QString +Api2User::name() const +{ + return m_name; +} + + +QSslKey +Api2User::pubkey() const +{ + return m_pubkey; +} + + +void +Api2User::setPubkey( const QSslKey &pubkey ) +{ + m_pubkey = pubkey; +} + + +QString +Api2User::clientDescription() const +{ + return m_clientDescription; +} + + +void +Api2User::setClientDescription( const QString& clientDescription ) +{ + m_clientDescription = clientDescription; +} + + +QString +Api2User::clientName() const +{ + return m_clientName; +} + + +void +Api2User::setClientName( const QString& clientName ) +{ + m_clientName = clientName; +} diff --git a/src/tomahawk/web/Api2User.h b/src/tomahawk/web/Api2User.h new file mode 100644 index 000000000..82fd3c3b5 --- /dev/null +++ b/src/tomahawk/web/Api2User.h @@ -0,0 +1,62 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2013, Uwe L. Korn + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef API2USER_H +#define API2USER_H + +#include +#include + +class Api2User : public QObject +{ + Q_OBJECT +public: + Api2User( const QString& name ); + + enum ACLDecision { + None, Deny, FullAccess + }; + + ACLDecision aclDecision() const; + void setAclDecision( ACLDecision decision ); + + QString clientDescription() const; + void setClientDescription( const QString& clientDescription ); + + QString clientName() const; + void setClientName( const QString& clientName ); + + QString name() const; + + QSslKey pubkey() const; + void setPubkey( const QSslKey& pubkey ); + +signals: + +public slots: + +private: + ACLDecision m_aclDecision; + QString m_clientDescription; + QString m_clientName; + QString m_name; + QSslKey m_pubkey; + +}; + +#endif // API2USER_H