diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 7c5e7fc5b7..7bfe1d1845 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -1040,25 +1040,20 @@ void NodeList::muteNodeBySessionID(const QUuid& nodeID) { } void NodeList::requestUsernameFromSessionID(const QUuid& nodeID) { - // send a request to domain-server to get the username associated with the given session ID - if (getThisNodeCanKick() || nodeID.isNull()) { - // setup the packet - auto usernameFromIDRequestPacket = NLPacket::create(PacketType::UsernameFromIDRequest, NUM_BYTES_RFC4122_UUID, true); + // send a request to domain-server to get the username/machine fingerprint/admin status associated with the given session ID + // If the requesting user isn't an admin, the username and machine fingerprint will return "". + auto usernameFromIDRequestPacket = NLPacket::create(PacketType::UsernameFromIDRequest, NUM_BYTES_RFC4122_UUID, true); - // write the node ID to the packet - if (nodeID.isNull()) { - usernameFromIDRequestPacket->write(getSessionUUID().toRfc4122()); - } else { - usernameFromIDRequestPacket->write(nodeID.toRfc4122()); - } - - qCDebug(networking) << "Sending packet to get username of node" << uuidStringWithoutCurlyBraces(nodeID); - - sendPacket(std::move(usernameFromIDRequestPacket), _domainHandler.getSockAddr()); + // write the node ID to the packet + if (nodeID.isNull()) { + usernameFromIDRequestPacket->write(getSessionUUID().toRfc4122()); } else { - qWarning() << "You do not have permissions to kick in this domain." - << "Request to get the username of node" << uuidStringWithoutCurlyBraces(nodeID) << "will not be sent"; + usernameFromIDRequestPacket->write(nodeID.toRfc4122()); } + + qCDebug(networking) << "Sending packet to get username/fingerprint/admin status of node" << uuidStringWithoutCurlyBraces(nodeID); + + sendPacket(std::move(usernameFromIDRequestPacket), _domainHandler.getSockAddr()); } void NodeList::processUsernameFromIDReply(QSharedPointer message) { @@ -1071,7 +1066,8 @@ void NodeList::processUsernameFromIDReply(QSharedPointer messag bool isAdmin; message->readPrimitive(&isAdmin); - qCDebug(networking) << "Got username" << username << "and machine fingerprint" << machineFingerprintString << "for node" << nodeUUIDString; + qCDebug(networking) << "Got username" << username << "and machine fingerprint" + << machineFingerprintString << "for node" << nodeUUIDString << ". isAdmin:" << isAdmin; emit usernameFromIDReply(nodeUUIDString, username, machineFingerprintString, isAdmin); }