mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:27:48 +02:00
Merge pull request #8373 from sethalves/groups-handle-camelcase-usernames
Fix some group-related code to handle CamelCase usernames
This commit is contained in:
commit
f0338ceb49
3 changed files with 8 additions and 8 deletions
|
@ -182,7 +182,7 @@ NodePermissions DomainGatekeeper::setPermissionsForUser(bool isLocalUser, QStrin
|
||||||
|
|
||||||
GroupRank rank = _server->_settingsManager.getGroupRank(groupID, rankID);
|
GroupRank rank = _server->_settingsManager.getGroupRank(groupID, rankID);
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
qDebug() << "| user-permissions: user is in group:" << groupID << " rank:"
|
qDebug() << "| user-permissions: user " << verifiedUsername << "is in group:" << groupID << " rank:"
|
||||||
<< rank.name << "so:" << userPerms;
|
<< rank.name << "so:" << userPerms;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ void DomainServerSettingsManager::initializeGroupPermissions(NodePermissionsMap&
|
||||||
if (nameKey.first.toLower() != groupNameLower) {
|
if (nameKey.first.toLower() != groupNameLower) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QUuid groupID = _groupIDs[groupNameLower];
|
QUuid groupID = _groupIDs[groupNameLower.toLower()];
|
||||||
QUuid rankID = nameKey.second;
|
QUuid rankID = nameKey.second;
|
||||||
GroupRank rank = _groupRanks[groupID][rankID];
|
GroupRank rank = _groupRanks[groupID][rankID];
|
||||||
if (rank.order == 0) {
|
if (rank.order == 0) {
|
||||||
|
@ -1477,14 +1477,14 @@ void DomainServerSettingsManager::apiGetGroupRanksErrorCallback(QNetworkReply& r
|
||||||
|
|
||||||
void DomainServerSettingsManager::recordGroupMembership(const QString& name, const QUuid groupID, QUuid rankID) {
|
void DomainServerSettingsManager::recordGroupMembership(const QString& name, const QUuid groupID, QUuid rankID) {
|
||||||
if (rankID != QUuid()) {
|
if (rankID != QUuid()) {
|
||||||
_groupMembership[name][groupID] = rankID;
|
_groupMembership[name.toLower()][groupID] = rankID;
|
||||||
} else {
|
} else {
|
||||||
_groupMembership[name].remove(groupID);
|
_groupMembership[name.toLower()].remove(groupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid DomainServerSettingsManager::isGroupMember(const QString& name, const QUuid& groupID) {
|
QUuid DomainServerSettingsManager::isGroupMember(const QString& name, const QUuid& groupID) {
|
||||||
const QHash<QUuid, QUuid>& groupsForName = _groupMembership[name];
|
const QHash<QUuid, QUuid>& groupsForName = _groupMembership[name.toLower()];
|
||||||
if (groupsForName.contains(groupID)) {
|
if (groupsForName.contains(groupID)) {
|
||||||
return groupsForName[groupID];
|
return groupsForName[groupID];
|
||||||
}
|
}
|
||||||
|
@ -1528,7 +1528,7 @@ void DomainServerSettingsManager::debugDumpGroupsState() {
|
||||||
|
|
||||||
qDebug() << "_groupIDs:";
|
qDebug() << "_groupIDs:";
|
||||||
foreach (QString groupName, _groupIDs.keys()) {
|
foreach (QString groupName, _groupIDs.keys()) {
|
||||||
qDebug() << "| " << groupName << "==>" << _groupIDs[groupName];
|
qDebug() << "| " << groupName << "==>" << _groupIDs[groupName.toLower()];
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "_groupNames:";
|
qDebug() << "_groupNames:";
|
||||||
|
@ -1548,7 +1548,7 @@ void DomainServerSettingsManager::debugDumpGroupsState() {
|
||||||
|
|
||||||
qDebug() << "_groupMembership";
|
qDebug() << "_groupMembership";
|
||||||
foreach (QString userName, _groupMembership.keys()) {
|
foreach (QString userName, _groupMembership.keys()) {
|
||||||
QHash<QUuid, QUuid>& groupsForUser = _groupMembership[userName];
|
QHash<QUuid, QUuid>& groupsForUser = _groupMembership[userName.toLower()];
|
||||||
QString line = "";
|
QString line = "";
|
||||||
foreach (QUuid groupID, groupsForUser.keys()) {
|
foreach (QUuid groupID, groupsForUser.keys()) {
|
||||||
line += " g=" + groupID.toString() + ",r=" + groupsForUser[groupID].toString();
|
line += " g=" + groupID.toString() + ",r=" + groupsForUser[groupID].toString();
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
QList<QUuid> getBlacklistGroupIDs();
|
QList<QUuid> getBlacklistGroupIDs();
|
||||||
|
|
||||||
// these are used to locally cache the result of calling "api/v1/groups/.../is_member/..." on metaverse's api
|
// these are used to locally cache the result of calling "api/v1/groups/.../is_member/..." on metaverse's api
|
||||||
void clearGroupMemberships(const QString& name) { _groupMembership[name].clear(); }
|
void clearGroupMemberships(const QString& name) { _groupMembership[name.toLower()].clear(); }
|
||||||
void recordGroupMembership(const QString& name, const QUuid groupID, QUuid rankID);
|
void recordGroupMembership(const QString& name, const QUuid groupID, QUuid rankID);
|
||||||
QUuid isGroupMember(const QString& name, const QUuid& groupID); // returns rank or -1 if not a member
|
QUuid isGroupMember(const QString& name, const QUuid& groupID); // returns rank or -1 if not a member
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue