fix bug that was losing verified status for users with permissions specific to their account

This commit is contained in:
Seth Alves 2016-07-22 14:00:46 -07:00
parent 6ec8aff645
commit 8e5262872e
2 changed files with 12 additions and 6 deletions

View file

@ -21,6 +21,9 @@
#include "DomainServer.h" #include "DomainServer.h"
#include "DomainServerNodeData.h" #include "DomainServerNodeData.h"
#define WANT_DEBUG 1
using SharedAssignmentPointer = QSharedPointer<Assignment>; using SharedAssignmentPointer = QSharedPointer<Assignment>;
DomainGatekeeper::DomainGatekeeper(DomainServer* server) : DomainGatekeeper::DomainGatekeeper(DomainServer* server) :
@ -134,16 +137,17 @@ NodePermissions DomainGatekeeper::applyPermissionsForUser(bool isLocalUser,
if (verifiedUsername.isEmpty()) { if (verifiedUsername.isEmpty()) {
userPerms |= _server->_settingsManager.getStandardPermissionsForName(NodePermissions::standardNameAnonymous); userPerms |= _server->_settingsManager.getStandardPermissionsForName(NodePermissions::standardNameAnonymous);
#ifdef WANT_DEBUG #ifdef WANT_DEBUG
qDebug() << "| user-permissions: unverified or no username, so:" << userPerms; qDebug() << "| user-permissions: unverified or no username for" << userPerms.getID() << ", so:" << userPerms;
#endif #endif
} else { } else {
userPerms.setVerifiedUserName(verifiedUsername);
if (_server->_settingsManager.havePermissionsForName(verifiedUsername)) { if (_server->_settingsManager.havePermissionsForName(verifiedUsername)) {
userPerms = _server->_settingsManager.getPermissionsForName(verifiedUsername); userPerms = _server->_settingsManager.getPermissionsForName(verifiedUsername);
userPerms.setVerifiedUserName(verifiedUsername);
#ifdef WANT_DEBUG #ifdef WANT_DEBUG
qDebug() << "| user-permissions: specific user matches, so:" << userPerms; qDebug() << "| user-permissions: specific user matches, so:" << userPerms;
#endif #endif
} else { } else {
userPerms.setVerifiedUserName(verifiedUsername);
// they are logged into metaverse, but we don't have specific permissions for them. // they are logged into metaverse, but we don't have specific permissions for them.
userPerms |= _server->_settingsManager.getStandardPermissionsForName(NodePermissions::standardNameLoggedIn); userPerms |= _server->_settingsManager.getStandardPermissionsForName(NodePermissions::standardNameLoggedIn);
#ifdef WANT_DEBUG #ifdef WANT_DEBUG
@ -851,7 +855,6 @@ void DomainGatekeeper::getDomainOwnerFriendsListErrorCallback(QNetworkReply& req
void DomainGatekeeper::refreshGroupsCache() { void DomainGatekeeper::refreshGroupsCache() {
// if agents are connected to this domain, refresh our cached information about groups and memberships in such. // if agents are connected to this domain, refresh our cached information about groups and memberships in such.
getDomainOwnerFriendsList(); getDomainOwnerFriendsList();
int agentCount = 0; int agentCount = 0;
@ -872,4 +875,8 @@ void DomainGatekeeper::refreshGroupsCache() {
} }
updateNodePermissions(); updateNodePermissions();
#if WANT_DEBUG
_server->_settingsManager.debugDumpGroupsState();
#endif
} }

View file

@ -87,6 +87,8 @@ public:
// calls http api to refresh group information // calls http api to refresh group information
void apiRefreshGroupInformation(); void apiRefreshGroupInformation();
void debugDumpGroupsState();
signals: signals:
void updateNodePermissions(); void updateNodePermissions();
@ -145,9 +147,6 @@ private:
// keep track of answers to api queries about which users are in which groups // keep track of answers to api queries about which users are in which groups
QHash<QString, QHash<QUuid, QUuid>> _groupMembership; // QHash<user-name, QHash<group-id, rank-id>> QHash<QString, QHash<QUuid, QUuid>> _groupMembership; // QHash<user-name, QHash<group-id, rank-id>>
void debugDumpGroupsState();
}; };
#endif // hifi_DomainServerSettingsManager_h #endif // hifi_DomainServerSettingsManager_h