Merge pull request #3496 from birarda/domain-wizard

fix for domain-server allowed roles
This commit is contained in:
Stephen Birarda 2014-09-26 16:24:24 -07:00
commit 4559c8a9ca

View file

@ -1573,14 +1573,13 @@ void DomainServer::handleProfileRequestFinished() {
// pull the user roles from the response // pull the user roles from the response
QJsonArray userRolesArray = profileJSON.object()["data"].toObject()["user"].toObject()["roles"].toArray(); QJsonArray userRolesArray = profileJSON.object()["data"].toObject()["user"].toObject()["roles"].toArray();
QJsonArray allowedRolesArray = _settingsManager.getSettingsMap() QStringList allowedRolesArray = _settingsManager.getSettingsMap().value(ALLOWED_ROLES_CONFIG_KEY).toStringList();
.value(ALLOWED_ROLES_CONFIG_KEY).toJsonValue().toArray();
QString connectableUsername; QString connectableUsername;
QString profileUsername = profileJSON.object()["data"].toObject()["user"].toObject()["username"].toString(); QString profileUsername = profileJSON.object()["data"].toObject()["user"].toObject()["username"].toString();
foreach(const QJsonValue& roleValue, userRolesArray) { foreach(const QJsonValue& roleValue, userRolesArray) {
if (allowedRolesArray.contains(roleValue)) { if (allowedRolesArray.contains(roleValue.toString())) {
// the user has a role that lets them in // the user has a role that lets them in
// set the bool to true and break // set the bool to true and break
connectableUsername = profileUsername; connectableUsername = profileUsername;