1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Add a storage class for API users

This commit is contained in:
Uwe L. Korn
2013-06-24 14:00:38 +02:00
parent 6bf471ff13
commit 1bae47da51
2 changed files with 143 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#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;
}

View File

@@ -0,0 +1,62 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef API2USER_H
#define API2USER_H
#include <QObject>
#include <QSslKey>
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