diff --git a/domain-server/src/DomainServerSettingsManager.cpp b/domain-server/src/DomainServerSettingsManager.cpp index 4fffefa20a..1eb04da87a 100644 --- a/domain-server/src/DomainServerSettingsManager.cpp +++ b/domain-server/src/DomainServerSettingsManager.cpp @@ -755,7 +755,6 @@ void DomainServerSettingsManager::processUsernameFromIDRequestPacket(QSharedPoin // From the packet, pull the UUID we're identifying QUuid nodeUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID)); - // If the UUID isn't NULL... if (!nodeUUID.isNull()) { // First, make sure we actually have a node with this UUID auto limitedNodeList = DependencyManager::get(); @@ -766,33 +765,25 @@ void DomainServerSettingsManager::processUsernameFromIDRequestPacket(QSharedPoin // It's time to figure out the username QString verifiedUsername = matchingNode->getPermissions().getVerifiedUserName(); - // If the verified username is Empty... if (verifiedUsername.isEmpty()) { // Make sure we're using an empty string as the Verified Username verifiedUsername = ""; } // Setup the packet auto usernameFromIDReplyPacket = NLPacket::create(PacketType::UsernameFromIDReply, NUM_BYTES_RFC4122_UUID + sizeof(verifiedUsername), true); - - // write the node ID to the packet usernameFromIDReplyPacket->write(nodeUUID.toRfc4122()); - // write the username to the packet usernameFromIDReplyPacket->writeString(verifiedUsername); // Ship it! limitedNodeList->sendPacket(std::move(usernameFromIDReplyPacket), *sendingNode); - } - else { + } else { qWarning() << "Node username request received for unknown node. Refusing to process."; } - } - else { - // This isn't a UUID we can use + } else { qWarning() << "Node username request received for invalid node ID. Refusing to process."; } - } - else { + } else { qWarning() << "Refusing to process a username request packet from node" << uuidStringWithoutCurlyBraces(sendingNode->getUUID()) << "that does not have kick permissions."; } diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 62e7ba1571..7a8dc4722e 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -76,18 +76,18 @@ Rectangle { case 'updateUsername': // The User ID (UUID) is the first parameter in the message. var userId = message.params[0]; - // The Username String (name + UUID) is the second parameter in the message. + // The text that goes in the userName field is the second parameter in the message. var userName = message.params[1]; // If the userId is empty, we're updating "myData". if (!userId) { myData.userName = userName; - myCard.userName = userName; + myCard.userName = userName; // Defensive programming } else { // Get the index in userModel and userData associated with the passed UUID var userIndex = findSessionIndex(userId); // Set the userName appropriately userModel.get(userIndex).userName = userName; - userData[userIndex].userName = userName; + userData[userIndex].userName = userName; // Defensive programming } break; default: diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index c14643ca70..b464b14224 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -907,8 +907,7 @@ void NodeList::requestUsernameFromSessionID(const QUuid& nodeID) { qDebug() << "Sending packet to get username of node" << uuidStringWithoutCurlyBraces(nodeID); sendPacket(std::move(usernameFromIDRequestPacket), _domainHandler.getSockAddr()); - } - else { + } 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"; } diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 9143ffc0b9..98be26a5f6 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -44,7 +44,7 @@ const QSet NON_SOURCED_PACKETS = QSet() PacketVersion versionForPacketType(PacketType packetType) { switch (packetType) { case PacketType::DomainList: - return static_cast(DomainListVersion::PermissionsGrid); + return static_cast(DomainListVersion::GetUsernameFromUUIDSupport); case PacketType::EntityAdd: case PacketType::EntityEdit: case PacketType::EntityData: diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 6662b3abba..73a5b885f0 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -228,7 +228,8 @@ enum class DomainServerAddedNodeVersion : PacketVersion { enum class DomainListVersion : PacketVersion { PrePermissionsGrid = 18, - PermissionsGrid + PermissionsGrid, + GetUsernameFromUUIDSupport }; enum class AudioVersion : PacketVersion {