diff --git a/domain-server/src/DomainServerWebSessionData.cpp b/domain-server/src/DomainServerWebSessionData.cpp new file mode 100644 index 0000000000..e59f255822 --- /dev/null +++ b/domain-server/src/DomainServerWebSessionData.cpp @@ -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 +#include + +#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()); + } +} \ No newline at end of file diff --git a/domain-server/src/DomainServerWebSessionData.h b/domain-server/src/DomainServerWebSessionData.h new file mode 100644 index 0000000000..80088c9362 --- /dev/null +++ b/domain-server/src/DomainServerWebSessionData.h @@ -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 +#include + +class DomainServerWebSessionData : public QObject { + Q_OBJECT +public: + DomainServerWebSessionData(const QJsonDocument& profileDocument); + + const QString& getUsername() const { return _username; } + const QSet& getRoles() const { return _roles; } + +private: + QString _username; + QSet _roles; +}; + +#endif // hifi_DomainServerWebSessionData_h \ No newline at end of file