mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:57:43 +02:00
add a class to hold web session data
This commit is contained in:
parent
1903fff45c
commit
e75ed2c4fa
2 changed files with 57 additions and 0 deletions
26
domain-server/src/DomainServerWebSessionData.cpp
Normal file
26
domain-server/src/DomainServerWebSessionData.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
//
|
||||||
|
// DomainServerWebSessionData.cpp
|
||||||
|
// domain-server/src
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 2014-07-21.
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtCore/QJsonDocument>
|
||||||
|
#include <QtCore/QJsonObject>
|
||||||
|
|
||||||
|
#include "DomainServerWebSessionData.h"
|
||||||
|
|
||||||
|
DomainServerWebSessionData::DomainServerWebSessionData(const QJsonDocument& profileDocument) :
|
||||||
|
_roles()
|
||||||
|
{
|
||||||
|
_username = profileDocument.object()["user"].toObject()["username"].toString();
|
||||||
|
|
||||||
|
// pull each of the roles and throw them into our set
|
||||||
|
foreach(const QJsonValue& rolesValue, profileDocument.object()["user"].toObject()["roles"].toObject()) {
|
||||||
|
_roles.insert(rolesValue.toString());
|
||||||
|
}
|
||||||
|
}
|
31
domain-server/src/DomainServerWebSessionData.h
Normal file
31
domain-server/src/DomainServerWebSessionData.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
//
|
||||||
|
// DomainServerWebSessionData.h
|
||||||
|
// domain-server/src
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 2014-07-21.
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_DomainServerWebSessionData_h
|
||||||
|
#define hifi_DomainServerWebSessionData_h
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QSet>
|
||||||
|
|
||||||
|
class DomainServerWebSessionData : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DomainServerWebSessionData(const QJsonDocument& profileDocument);
|
||||||
|
|
||||||
|
const QString& getUsername() const { return _username; }
|
||||||
|
const QSet<QString>& getRoles() const { return _roles; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString _username;
|
||||||
|
QSet<QString> _roles;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_DomainServerWebSessionData_h
|
Loading…
Reference in a new issue