authed username wasn't being saved in permissions, so that interface would get briefly disconnected when their permissions changed.

This commit is contained in:
Seth Alves 2016-06-11 15:16:02 -07:00
parent 27c6df660c
commit e79767a121

View file

@ -128,7 +128,7 @@ void DomainGatekeeper::updateNodePermissions() {
QList<SharedNodePointer> nodesToKill; QList<SharedNodePointer> nodesToKill;
auto limitedNodeList = DependencyManager::get<LimitedNodeList>(); auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
limitedNodeList->eachNodeBreakable([this, limitedNodeList, &nodesToKill](const SharedNodePointer& node){ limitedNodeList->eachNode([this, limitedNodeList, &nodesToKill](const SharedNodePointer& node){
QString username = node->getPermissions().getUserName(); QString username = node->getPermissions().getUserName();
NodePermissions userPerms(username); NodePermissions userPerms(username);
@ -167,8 +167,6 @@ void DomainGatekeeper::updateNodePermissions() {
// hang up on this node // hang up on this node
nodesToKill << node; nodesToKill << node;
} }
return true;
}); });
foreach (auto node, nodesToKill) { foreach (auto node, nodesToKill) {
@ -264,7 +262,6 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
qDebug() << "user-permissions: no username, so:" << userPerms; qDebug() << "user-permissions: no username, so:" << userPerms;
} else if (verifyUserSignature(username, usernameSignature, nodeConnection.senderSockAddr)) { } else if (verifyUserSignature(username, usernameSignature, nodeConnection.senderSockAddr)) {
// they are sent us a username and the signature verifies it // they are sent us a username and the signature verifies it
userPerms.setUserName(username);
if (_server->_settingsManager.havePermissionsForName(username)) { if (_server->_settingsManager.havePermissionsForName(username)) {
// we have specific permissions for this user. // we have specific permissions for this user.
userPerms = _server->_settingsManager.getPermissionsForName(username); userPerms = _server->_settingsManager.getPermissionsForName(username);
@ -274,6 +271,7 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
userPerms |= _server->_settingsManager.getStandardPermissionsForName(NodePermissions::standardNameLoggedIn); userPerms |= _server->_settingsManager.getStandardPermissionsForName(NodePermissions::standardNameLoggedIn);
qDebug() << "user-permissions: user is logged in, so:" << userPerms; qDebug() << "user-permissions: user is logged in, so:" << userPerms;
} }
userPerms.setUserName(username);
} else { } else {
// they sent us a username, but it didn't check out // they sent us a username, but it didn't check out
requestUserPublicKey(username); requestUserPublicKey(username);