mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:19:05 +02:00
Distinguish domain groups with a leading "@"
This commit is contained in:
parent
60048162c0
commit
6f9b47c07d
4 changed files with 14 additions and 7 deletions
|
@ -181,7 +181,7 @@ NodePermissions DomainGatekeeper::setPermissionsForUser(bool isLocalUser, QStrin
|
||||||
auto userGroups = _domainGroupMemberships[verifiedDomainUserName];
|
auto userGroups = _domainGroupMemberships[verifiedDomainUserName];
|
||||||
foreach (QString userGroup, userGroups) {
|
foreach (QString userGroup, userGroups) {
|
||||||
// Domain groups may be specified as comma- and/or space-separated lists of group names.
|
// Domain groups may be specified as comma- and/or space-separated lists of group names.
|
||||||
// For example, "silver gold, platinum".
|
// For example, "@silver @Gold, @platinum".
|
||||||
auto domainGroups = _server->_settingsManager.getDomainGroupNames()
|
auto domainGroups = _server->_settingsManager.getDomainGroupNames()
|
||||||
.filter(QRegularExpression("^(.*[\\s,])?" + userGroup + "([\\s,].*)?$",
|
.filter(QRegularExpression("^(.*[\\s,])?" + userGroup + "([\\s,].*)?$",
|
||||||
QRegularExpression::CaseInsensitiveOption));
|
QRegularExpression::CaseInsensitiveOption));
|
||||||
|
@ -302,7 +302,7 @@ NodePermissions DomainGatekeeper::setPermissionsForUser(bool isLocalUser, QStrin
|
||||||
auto userGroups = _domainGroupMemberships[verifiedDomainUserName];
|
auto userGroups = _domainGroupMemberships[verifiedDomainUserName];
|
||||||
foreach(QString userGroup, userGroups) {
|
foreach(QString userGroup, userGroups) {
|
||||||
// Domain groups may be specified as comma- and/or space-separated lists of group names.
|
// Domain groups may be specified as comma- and/or space-separated lists of group names.
|
||||||
// For example, "silver gold, platinum".
|
// For example, "@silver @Gold, @platinum".
|
||||||
auto domainGroups = _server->_settingsManager.getDomainBlacklistGroupNames()
|
auto domainGroups = _server->_settingsManager.getDomainBlacklistGroupNames()
|
||||||
.filter(QRegularExpression("^(.*[\\s,])?" + userGroup + "([\\s,].*)?$",
|
.filter(QRegularExpression("^(.*[\\s,])?" + userGroup + "([\\s,].*)?$",
|
||||||
QRegularExpression::CaseInsensitiveOption));
|
QRegularExpression::CaseInsensitiveOption));
|
||||||
|
@ -1277,7 +1277,8 @@ void DomainGatekeeper::requestDomainUserFinished() {
|
||||||
QStringList domainUserGroups;
|
QStringList domainUserGroups;
|
||||||
auto userRoles = rootObject.value("roles").toArray();
|
auto userRoles = rootObject.value("roles").toArray();
|
||||||
foreach (auto role, userRoles) {
|
foreach (auto role, userRoles) {
|
||||||
domainUserGroups.append(role.toString());
|
// Distinguish domain groups from metaverse groups by a leading special character.
|
||||||
|
domainUserGroups.append(DOMAIN_GROUP_CHAR + role.toString().toLower());
|
||||||
}
|
}
|
||||||
_domainGroupMemberships[username] = domainUserGroups;
|
_domainGroupMemberships[username] = domainUserGroups;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "NodeConnectionData.h"
|
#include "NodeConnectionData.h"
|
||||||
#include "PendingAssignedNodeData.h"
|
#include "PendingAssignedNodeData.h"
|
||||||
|
|
||||||
|
const QString DOMAIN_GROUP_CHAR = "@";
|
||||||
|
|
||||||
class DomainServer;
|
class DomainServer;
|
||||||
|
|
||||||
class DomainGatekeeper : public QObject {
|
class DomainGatekeeper : public QObject {
|
||||||
|
|
|
@ -1966,6 +1966,10 @@ void DomainServerSettingsManager::apiRefreshGroupInformation() {
|
||||||
QStringList groupNames = getAllKnownGroupNames();
|
QStringList groupNames = getAllKnownGroupNames();
|
||||||
foreach (QString groupName, groupNames) {
|
foreach (QString groupName, groupNames) {
|
||||||
QString lowerGroupName = groupName.toLower();
|
QString lowerGroupName = groupName.toLower();
|
||||||
|
if (lowerGroupName.contains(DOMAIN_GROUP_CHAR)) {
|
||||||
|
// Ignore domain groups.
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_groupIDs.contains(lowerGroupName)) {
|
if (_groupIDs.contains(lowerGroupName)) {
|
||||||
// we already know about this one. recall setGroupID in case the group has been
|
// we already know about this one. recall setGroupID in case the group has been
|
||||||
// added to another section (the same group is found in both groups and blacklists).
|
// added to another section (the same group is found in both groups and blacklists).
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
|
|
||||||
#include <HifiConfigVariantMap.h>
|
#include <HifiConfigVariantMap.h>
|
||||||
#include <HTTPManager.h>
|
#include <HTTPManager.h>
|
||||||
|
|
||||||
#include <ReceivedMessage.h>
|
|
||||||
#include "NodePermissions.h"
|
|
||||||
|
|
||||||
#include <Node.h>
|
#include <Node.h>
|
||||||
|
#include <ReceivedMessage.h>
|
||||||
|
|
||||||
|
#include "DomainGatekeeper.h"
|
||||||
|
#include "NodePermissions.h"
|
||||||
|
|
||||||
const QString SETTINGS_PATHS_KEY = "paths";
|
const QString SETTINGS_PATHS_KEY = "paths";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue