From afea5f353400dfdd4f9998f7cd694add75269ff4 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 4 Feb 2015 16:31:36 -0800 Subject: [PATCH 01/12] added allowed_editors to settings json --- domain-server/resources/describe-settings.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index e2f751a7f0..31635e40d3 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -73,6 +73,20 @@ "can_set": true } ] + }, + { + "name": "allowed_editors", + "type": "table", + "label": "Allowed Editors", + "help": "List the High Fidelity names for people you want to be able to make changes to this domain.
An empty list means everyone.", + "numbered": false, + "columns": [ + { + "name": "username", + "label": "Username", + "can_set": true + } + ] } ] }, @@ -433,4 +447,4 @@ } ] } -] \ No newline at end of file +] From 485785be7ff93cff0fc63a631dfd782ae824bde8 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 15:37:14 -0800 Subject: [PATCH 02/12] Allowed Editors setting in DomainServer; domain-list wire protocol includes "you can edit" boolean after uuid; entity server checks canEdit flag of node who sends edit requests; interface does not attempt to do edits if DomainServer sent false for "you can edit" --- .../octree/OctreeInboundPacketProcessor.cpp | 5 +++ domain-server/src/DomainServer.cpp | 19 +++++++++--- domain-server/src/DomainServerNodeData.h | 2 +- .../entities/src/EntityScriptingInterface.cpp | 31 ++++++++++++++----- .../entities/src/EntityScriptingInterface.h | 2 ++ libraries/networking/src/LimitedNodeList.cpp | 6 ++-- libraries/networking/src/LimitedNodeList.h | 6 +++- libraries/networking/src/Node.cpp | 10 ++++-- libraries/networking/src/Node.h | 6 +++- libraries/networking/src/NodeList.cpp | 21 +++++++------ libraries/networking/src/PacketHeaders.cpp | 2 +- 11 files changed, 80 insertions(+), 30 deletions(-) diff --git a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp index 8a560984a6..d1b84ec63c 100644 --- a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp +++ b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp @@ -92,6 +92,11 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin if (_myServer->getOctree()->handlesEditPacketType(packetType)) { PerformanceWarning warn(debugProcessPacket, "processPacket KNOWN TYPE",debugProcessPacket); _receivedPacketCount++; + + if (! sendingNode.data()->getCanEdit()) { + qDebug("node %s attempted unpermitted edit", sendingNode->getUUID().toString().toUtf8().constData()); + return; + } const unsigned char* packetData = reinterpret_cast(packet.data()); diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index d680bbf520..578ee5202d 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -41,6 +41,11 @@ int const DomainServer::EXIT_CODE_REBOOT = 234923; const QString ICE_SERVER_DEFAULT_HOSTNAME = "ice.highfidelity.io"; + +const QString ALLOWED_USERS_SETTINGS_KEYPATH = "security.allowed_users"; +const QString ALLOWED_EDITORS_SETTINGS_KEYPATH = "security.allowed_editors"; + + DomainServer::DomainServer(int argc, char* argv[]) : QCoreApplication(argc, argv), _httpManager(DOMAIN_SERVER_HTTP_PORT, QString("%1/resources/web/").arg(QCoreApplication::applicationDirPath()), this), @@ -638,10 +643,16 @@ void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSock // we got a packetUUID we didn't recognize, just add the node nodeUUID = QUuid::createUuid(); } - - SharedNodePointer newNode = DependencyManager::get()->addOrUpdateNode(nodeUUID, nodeType, - publicSockAddr, localSockAddr); + // if this user is in the editors list (or if the editors list is empty) set the user's node's canEdit to true + const QVariant* allowedEditorsVariant = + valueForKeyPath(_settingsManager.getSettingsMap(), ALLOWED_EDITORS_SETTINGS_KEYPATH); + QStringList allowedEditors = allowedEditorsVariant ? allowedEditorsVariant->toStringList() : QStringList(); + bool canEdit = allowedEditors.isEmpty() || allowedEditors.contains(username); + + SharedNodePointer newNode = + DependencyManager::get()->addOrUpdateNode(nodeUUID, nodeType, + publicSockAddr, localSockAddr, canEdit); // when the newNode is created the linked data is also created // if this was a static assignment set the UUID, set the sendingSockAddr DomainServerNodeData* nodeData = reinterpret_cast(newNode->getLinkedData()); @@ -663,7 +674,6 @@ void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSock } } -const QString ALLOWED_USERS_SETTINGS_KEYPATH = "security.allowed_users"; bool DomainServer::shouldAllowConnectionFromNode(const QString& username, const QByteArray& usernameSignature, @@ -842,6 +852,7 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif // always send the node their own UUID back QDataStream broadcastDataStream(&broadcastPacket, QIODevice::Append); broadcastDataStream << node->getUUID(); + broadcastDataStream << node->getCanEdit(); int numBroadcastPacketLeadBytes = broadcastDataStream.device()->pos(); diff --git a/domain-server/src/DomainServerNodeData.h b/domain-server/src/DomainServerNodeData.h index 366ee8c730..6ba4206adc 100644 --- a/domain-server/src/DomainServerNodeData.h +++ b/domain-server/src/DomainServerNodeData.h @@ -45,7 +45,7 @@ public: void setIsAuthenticated(bool isAuthenticated) { _isAuthenticated = isAuthenticated; } bool isAuthenticated() const { return _isAuthenticated; } - + QHash& getSessionSecretHash() { return _sessionSecretHash; } private: QJsonObject mergeJSONStatsFromNewObject(const QJsonObject& newObject, QJsonObject destinationObject); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index c247da2a8c..1bca754337 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -26,22 +26,32 @@ void EntityScriptingInterface::queueEntityMessage(PacketType packetType, getEntityPacketSender()->queueEditEntityMessage(packetType, entityID, properties); } + +bool EntityScriptingInterface::canEdit() { + auto nodeList = DependencyManager::get(); + return nodeList->getThisNodeCanEdit(); +} + + EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& properties) { + // The application will keep track of creatorTokenID uint32_t creatorTokenID = EntityItemID::getNextCreatorTokenID(); EntityItemID id(NEW_ENTITY, creatorTokenID, false ); - // If we have a local entity tree set, then also update it. - if (_entityTree) { - _entityTree->lockForWrite(); - _entityTree->addEntity(id, properties); - _entityTree->unlock(); - } + if (canEdit()) { + // If we have a local entity tree set, then also update it. + if (_entityTree) { + _entityTree->lockForWrite(); + _entityTree->addEntity(id, properties); + _entityTree->unlock(); + } - // queue the packet - queueEntityMessage(PacketTypeEntityAddOrEdit, id, properties); + // queue the packet + queueEntityMessage(PacketTypeEntityAddOrEdit, id, properties); + } return id; } @@ -94,6 +104,11 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID } EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const EntityItemProperties& properties) { + + if (! canEdit()) { + return entityID; + } + EntityItemID actualID = entityID; // if the entity is unknown, attempt to look it up if (!entityID.isKnownID) { diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 3585cce946..6700a86731 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -59,6 +59,8 @@ public: void setEntityTree(EntityTree* modelTree) { _entityTree = modelTree; } EntityTree* getEntityTree(EntityTree*) { return _entityTree; } + + bool canEdit(); public slots: /// adds a model with the specific properties diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 06b3b6a0db..b90551dcd0 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -411,7 +411,8 @@ void LimitedNodeList::handleNodeKill(const SharedNodePointer& node) { } SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType, - const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket) { + const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, + bool canEdit) { NodeHash::const_iterator it = _nodeHash.find(uuid); if (it != _nodeHash.end()) { @@ -419,11 +420,12 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t matchingNode->setPublicSocket(publicSocket); matchingNode->setLocalSocket(localSocket); + matchingNode->setCanEdit(canEdit); return matchingNode; } else { // we didn't have this node, so add them - Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket); + Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket, canEdit); SharedNodePointer newNodePointer(newNode); _nodeHash.insert(UUIDNodePair(newNode->getUUID(), newNodePointer)); diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index 6e736519a0..378fa89786 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -76,6 +76,9 @@ class LimitedNodeList : public QObject, public Dependency { public: const QUuid& getSessionUUID() const { return _sessionUUID; } void setSessionUUID(const QUuid& sessionUUID); + + bool getThisNodeCanEdit() { return _thisNodeCanEdit; } + void setThisNodeCanEdit(bool canEdit) { _thisNodeCanEdit = canEdit; } void rebindNodeSocket(); QUdpSocket& getNodeSocket() { return _nodeSocket; } @@ -106,7 +109,7 @@ public: SharedNodePointer sendingNodeForPacket(const QByteArray& packet); SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType, - const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket); + const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, bool canEdit); const HifiSockAddr& getLocalSockAddr() const { return _localSockAddr; } const HifiSockAddr& getSTUNSockAddr() const { return _stunSockAddr; } @@ -201,6 +204,7 @@ protected: void handleNodeKill(const SharedNodePointer& node); QUuid _sessionUUID; + bool _thisNodeCanEdit; NodeHash _nodeHash; QReadWriteLock _nodeMutex; QUdpSocket _nodeSocket; diff --git a/libraries/networking/src/Node.cpp b/libraries/networking/src/Node.cpp index 697ef99b6d..ccefc4d1d0 100644 --- a/libraries/networking/src/Node.cpp +++ b/libraries/networking/src/Node.cpp @@ -41,8 +41,9 @@ const QString& NodeType::getNodeTypeName(NodeType_t nodeType) { return matchedTypeName != TypeNameHash.end() ? matchedTypeName.value() : UNKNOWN_NodeType_t_NAME; } -Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket) : - NetworkPeer(uuid, publicSocket, localSocket), +Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, + const HifiSockAddr& localSocket, bool canEdit) : + NetworkPeer(uuid, publicSocket, localSocket), _type(type), _activeSocket(NULL), _symmetricSocket(), @@ -52,7 +53,8 @@ Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, _pingMs(-1), // "Uninitialized" _clockSkewUsec(0), _mutex(), - _clockSkewMovingPercentile(30, 0.8f) // moving 80th percentile of 30 samples + _clockSkewMovingPercentile(30, 0.8f), // moving 80th percentile of 30 samples + _canEdit(canEdit) { } @@ -131,6 +133,7 @@ QDataStream& operator<<(QDataStream& out, const Node& node) { out << node._uuid; out << node._publicSocket; out << node._localSocket; + out << node._canEdit; return out; } @@ -140,6 +143,7 @@ QDataStream& operator>>(QDataStream& in, Node& node) { in >> node._uuid; in >> node._publicSocket; in >> node._localSocket; + in >> node._canEdit; return in; } diff --git a/libraries/networking/src/Node.h b/libraries/networking/src/Node.h index 3ff8d771e0..dbdca9bbc0 100644 --- a/libraries/networking/src/Node.h +++ b/libraries/networking/src/Node.h @@ -45,7 +45,7 @@ namespace NodeType { class Node : public NetworkPeer { Q_OBJECT public: - Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket); + Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, bool canEdit); ~Node(); bool operator==(const Node& otherNode) const { return _uuid == otherNode._uuid; } @@ -76,6 +76,9 @@ public: virtual void setSymmetricSocket(const HifiSockAddr& symmetricSocket); const HifiSockAddr* getActiveSocket() const { return _activeSocket; } + + void setCanEdit(bool canEdit) { _canEdit = canEdit; } + bool getCanEdit() { return _canEdit; } void activatePublicSocket(); void activateLocalSocket(); @@ -101,6 +104,7 @@ private: int _clockSkewUsec; QMutex _mutex; MovingPercentile _clockSkewMovingPercentile; + bool _canEdit; }; QDebug operator<<(QDebug debug, const Node &message); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index bb095b2a3d..972efda79e 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -370,13 +370,6 @@ int NodeList::processDomainServerList(const QByteArray& packet) { int readNodes = 0; - // setup variables to read into from QDataStream - qint8 nodeType; - - QUuid nodeUUID, connectionUUID; - - HifiSockAddr nodePublicSocket; - HifiSockAddr nodeLocalSocket; QDataStream packetStream(packet); packetStream.skipRawData(numBytesForPacketHeader(packet)); @@ -385,10 +378,20 @@ int NodeList::processDomainServerList(const QByteArray& packet) { QUuid newUUID; packetStream >> newUUID; setSessionUUID(newUUID); + + bool thisNodeCanEdit; + packetStream >> thisNodeCanEdit; + setThisNodeCanEdit(thisNodeCanEdit); // pull each node in the packet while(packetStream.device()->pos() < packet.size()) { - packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket; + // setup variables to read into from QDataStream + qint8 nodeType; + QUuid nodeUUID, connectionUUID; + HifiSockAddr nodePublicSocket, nodeLocalSocket; + bool canEdit; + + packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> canEdit; // if the public socket address is 0 then it's reachable at the same IP // as the domain server @@ -396,7 +399,7 @@ int NodeList::processDomainServerList(const QByteArray& packet) { nodePublicSocket.setAddress(_domainHandler.getIP()); } - SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket, nodeLocalSocket); + SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket, nodeLocalSocket, canEdit); packetStream >> connectionUUID; node->setConnectionSecret(connectionUUID); diff --git a/libraries/networking/src/PacketHeaders.cpp b/libraries/networking/src/PacketHeaders.cpp index 21625dc7d5..d2806f3db5 100644 --- a/libraries/networking/src/PacketHeaders.cpp +++ b/libraries/networking/src/PacketHeaders.cpp @@ -64,7 +64,7 @@ PacketVersion versionForPacketType(PacketType type) { return 2; case PacketTypeDomainList: case PacketTypeDomainListRequest: - return 3; + return 4; case PacketTypeCreateAssignment: case PacketTypeRequestAssignment: return 2; From 810e7549d12799dd9ee07fc071ba8e452be00c2a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 15:41:04 -0800 Subject: [PATCH 03/12] formatting --- domain-server/resources/describe-settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 31635e40d3..28636c404f 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -448,3 +448,4 @@ ] } ] + From 6bad141004004aad14245efa22f15c48fc0f588d Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 15:42:42 -0800 Subject: [PATCH 04/12] formatting --- domain-server/src/DomainServerNodeData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain-server/src/DomainServerNodeData.h b/domain-server/src/DomainServerNodeData.h index 6ba4206adc..366ee8c730 100644 --- a/domain-server/src/DomainServerNodeData.h +++ b/domain-server/src/DomainServerNodeData.h @@ -45,7 +45,7 @@ public: void setIsAuthenticated(bool isAuthenticated) { _isAuthenticated = isAuthenticated; } bool isAuthenticated() const { return _isAuthenticated; } - + QHash& getSessionSecretHash() { return _sessionSecretHash; } private: QJsonObject mergeJSONStatsFromNewObject(const QJsonObject& newObject, QJsonObject destinationObject); From 80cf571d7d5ac516ab88b7d09fed4abe3ac7826b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 15:43:27 -0800 Subject: [PATCH 05/12] formatting --- libraries/entities/src/EntityScriptingInterface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 1bca754337..8aa3c31a5e 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -35,7 +35,6 @@ bool EntityScriptingInterface::canEdit() { EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& properties) { - // The application will keep track of creatorTokenID uint32_t creatorTokenID = EntityItemID::getNextCreatorTokenID(); From ccc8662732f3ab077771fa67b12dfe23609a5918 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 15:46:23 -0800 Subject: [PATCH 06/12] formatting --- domain-server/resources/describe-settings.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 28636c404f..9a8efcf725 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -447,5 +447,4 @@ } ] } -] - +] From d19ab4c36fbcc3eab04c3c0e3fdb781edacba247 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 15:46:40 -0800 Subject: [PATCH 07/12] formatting --- domain-server/resources/describe-settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 9a8efcf725..31635e40d3 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -447,4 +447,4 @@ } ] } -] +] From bad44c540a692f56af832cfc59fe29f73aad59fa Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 16:22:52 -0800 Subject: [PATCH 08/12] also guard deleteEntity and getEntityProperties with canEdit. make canEdit available to javascript --- .../entities/src/EntityScriptingInterface.cpp | 44 +++++++++++-------- .../entities/src/EntityScriptingInterface.h | 5 ++- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 8aa3c31a5e..35c0bb1ddb 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -73,30 +73,33 @@ EntityItemID EntityScriptingInterface::identifyEntity(EntityItemID entityID) { EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID entityID) { EntityItemProperties results; - EntityItemID identity = identifyEntity(entityID); - if (_entityTree) { - _entityTree->lockForRead(); - EntityItem* entity = const_cast(_entityTree->findEntityByEntityItemID(identity)); + + if (canEdit()) { + EntityItemID identity = identifyEntity(entityID); + if (_entityTree) { + _entityTree->lockForRead(); + EntityItem* entity = const_cast(_entityTree->findEntityByEntityItemID(identity)); - if (entity) { - results = entity->getProperties(); + if (entity) { + results = entity->getProperties(); - // TODO: improve sitting points and naturalDimensions in the future, - // for now we've included the old sitting points model behavior for entity types that are models - // we've also added this hack for setting natural dimensions of models - if (entity->getType() == EntityTypes::Model) { - const FBXGeometry* geometry = _entityTree->getGeometryForEntity(entity); - if (geometry) { - results.setSittingPoints(geometry->sittingPoints); - Extents meshExtents = geometry->getUnscaledMeshExtents(); - results.setNaturalDimensions(meshExtents.maximum - meshExtents.minimum); + // TODO: improve sitting points and naturalDimensions in the future, + // for now we've included the old sitting points model behavior for entity types that are models + // we've also added this hack for setting natural dimensions of models + if (entity->getType() == EntityTypes::Model) { + const FBXGeometry* geometry = _entityTree->getGeometryForEntity(entity); + if (geometry) { + results.setSittingPoints(geometry->sittingPoints); + Extents meshExtents = geometry->getUnscaledMeshExtents(); + results.setNaturalDimensions(meshExtents.maximum - meshExtents.minimum); + } } - } - } else { - results.setIsUnknownID(); + } else { + results.setIsUnknownID(); + } + _entityTree->unlock(); } - _entityTree->unlock(); } return results; @@ -148,6 +151,9 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E void EntityScriptingInterface::deleteEntity(EntityItemID entityID) { + if (! canEdit()) + return; + EntityItemID actualID = entityID; // if the entity is unknown, attempt to look it up diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 6700a86731..19003c3349 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -60,9 +60,12 @@ public: void setEntityTree(EntityTree* modelTree) { _entityTree = modelTree; } EntityTree* getEntityTree(EntityTree*) { return _entityTree; } - bool canEdit(); public slots: + + // returns true if the DomainServer will allow this Node/Avatar to make changes + Q_INVOKABLE bool canEdit(); + /// adds a model with the specific properties Q_INVOKABLE EntityItemID addEntity(const EntityItemProperties& properties); From 46bf6ea5da091bcd134fa7e5ede20ae77ce7e1e5 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Feb 2015 16:37:37 -0800 Subject: [PATCH 09/12] coding standard --- libraries/entities/src/EntityScriptingInterface.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 35c0bb1ddb..d2f0c4edb7 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -107,7 +107,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const EntityItemProperties& properties) { - if (! canEdit()) { + if (!canEdit()) { return entityID; } @@ -151,8 +151,9 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E void EntityScriptingInterface::deleteEntity(EntityItemID entityID) { - if (! canEdit()) + if (!canEdit()) { return; + } EntityItemID actualID = entityID; From 60a4f48985308ff98cc233fa9a7b578a5a43e086 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 6 Feb 2015 09:14:40 -0800 Subject: [PATCH 10/12] rather than a list of allowed editors, a list of allowed lockers/unlockers --- .../octree/OctreeInboundPacketProcessor.cpp | 5 -- domain-server/src/DomainServer.cpp | 8 +-- .../entities/src/EntityScriptingInterface.cpp | 72 ++++++++----------- .../entities/src/EntityScriptingInterface.h | 3 +- libraries/entities/src/EntityTree.cpp | 18 +++-- libraries/entities/src/EntityTree.h | 6 +- libraries/networking/src/LimitedNodeList.cpp | 6 +- libraries/networking/src/LimitedNodeList.h | 8 +-- libraries/networking/src/Node.cpp | 8 +-- libraries/networking/src/Node.h | 9 +-- libraries/networking/src/NodeList.cpp | 12 ++-- tests/octree/src/ModelTests.cpp | 4 +- 12 files changed, 74 insertions(+), 85 deletions(-) diff --git a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp index d1b84ec63c..8a560984a6 100644 --- a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp +++ b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp @@ -92,11 +92,6 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin if (_myServer->getOctree()->handlesEditPacketType(packetType)) { PerformanceWarning warn(debugProcessPacket, "processPacket KNOWN TYPE",debugProcessPacket); _receivedPacketCount++; - - if (! sendingNode.data()->getCanEdit()) { - qDebug("node %s attempted unpermitted edit", sendingNode->getUUID().toString().toUtf8().constData()); - return; - } const unsigned char* packetData = reinterpret_cast(packet.data()); diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 578ee5202d..046df5189d 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -644,15 +644,15 @@ void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSock nodeUUID = QUuid::createUuid(); } - // if this user is in the editors list (or if the editors list is empty) set the user's node's canEdit to true + // if this user is in the editors list (or if the editors list is empty) set the user's node's canAdjustLocks to true const QVariant* allowedEditorsVariant = valueForKeyPath(_settingsManager.getSettingsMap(), ALLOWED_EDITORS_SETTINGS_KEYPATH); QStringList allowedEditors = allowedEditorsVariant ? allowedEditorsVariant->toStringList() : QStringList(); - bool canEdit = allowedEditors.isEmpty() || allowedEditors.contains(username); + bool canAdjustLocks = allowedEditors.isEmpty() || allowedEditors.contains(username); SharedNodePointer newNode = DependencyManager::get()->addOrUpdateNode(nodeUUID, nodeType, - publicSockAddr, localSockAddr, canEdit); + publicSockAddr, localSockAddr, canAdjustLocks); // when the newNode is created the linked data is also created // if this was a static assignment set the UUID, set the sendingSockAddr DomainServerNodeData* nodeData = reinterpret_cast(newNode->getLinkedData()); @@ -852,7 +852,7 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif // always send the node their own UUID back QDataStream broadcastDataStream(&broadcastPacket, QIODevice::Append); broadcastDataStream << node->getUUID(); - broadcastDataStream << node->getCanEdit(); + broadcastDataStream << node->getCanAdjustLocks(); int numBroadcastPacketLeadBytes = broadcastDataStream.device()->pos(); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index d2f0c4edb7..5d949912a7 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -27,9 +27,9 @@ void EntityScriptingInterface::queueEntityMessage(PacketType packetType, } -bool EntityScriptingInterface::canEdit() { +bool EntityScriptingInterface::canAdjustLocks() { auto nodeList = DependencyManager::get(); - return nodeList->getThisNodeCanEdit(); + return nodeList->getThisNodeCanAdjustLocks(); } @@ -40,18 +40,16 @@ EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& pro EntityItemID id(NEW_ENTITY, creatorTokenID, false ); - if (canEdit()) { - // If we have a local entity tree set, then also update it. - if (_entityTree) { - _entityTree->lockForWrite(); - _entityTree->addEntity(id, properties); - _entityTree->unlock(); - } - - // queue the packet - queueEntityMessage(PacketTypeEntityAddOrEdit, id, properties); + // If we have a local entity tree set, then also update it. + if (_entityTree) { + _entityTree->lockForWrite(); + _entityTree->addEntity(id, properties); + _entityTree->unlock(); } + // queue the packet + queueEntityMessage(PacketTypeEntityAddOrEdit, id, properties); + return id; } @@ -74,32 +72,30 @@ EntityItemID EntityScriptingInterface::identifyEntity(EntityItemID entityID) { EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID entityID) { EntityItemProperties results; - if (canEdit()) { - EntityItemID identity = identifyEntity(entityID); - if (_entityTree) { - _entityTree->lockForRead(); - EntityItem* entity = const_cast(_entityTree->findEntityByEntityItemID(identity)); + EntityItemID identity = identifyEntity(entityID); + if (_entityTree) { + _entityTree->lockForRead(); + EntityItem* entity = const_cast(_entityTree->findEntityByEntityItemID(identity)); - if (entity) { - results = entity->getProperties(); + if (entity) { + results = entity->getProperties(); - // TODO: improve sitting points and naturalDimensions in the future, - // for now we've included the old sitting points model behavior for entity types that are models - // we've also added this hack for setting natural dimensions of models - if (entity->getType() == EntityTypes::Model) { - const FBXGeometry* geometry = _entityTree->getGeometryForEntity(entity); - if (geometry) { - results.setSittingPoints(geometry->sittingPoints); - Extents meshExtents = geometry->getUnscaledMeshExtents(); - results.setNaturalDimensions(meshExtents.maximum - meshExtents.minimum); - } + // TODO: improve sitting points and naturalDimensions in the future, + // for now we've included the old sitting points model behavior for entity types that are models + // we've also added this hack for setting natural dimensions of models + if (entity->getType() == EntityTypes::Model) { + const FBXGeometry* geometry = _entityTree->getGeometryForEntity(entity); + if (geometry) { + results.setSittingPoints(geometry->sittingPoints); + Extents meshExtents = geometry->getUnscaledMeshExtents(); + results.setNaturalDimensions(meshExtents.maximum - meshExtents.minimum); } - - } else { - results.setIsUnknownID(); } - _entityTree->unlock(); + + } else { + results.setIsUnknownID(); } + _entityTree->unlock(); } return results; @@ -107,10 +103,6 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const EntityItemProperties& properties) { - if (!canEdit()) { - return entityID; - } - EntityItemID actualID = entityID; // if the entity is unknown, attempt to look it up if (!entityID.isKnownID) { @@ -125,7 +117,7 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E // the actual id, because we can edit out local entities just with creatorTokenID if (_entityTree) { _entityTree->lockForWrite(); - _entityTree->updateEntity(entityID, properties); + _entityTree->updateEntity(entityID, properties, canAdjustLocks()); _entityTree->unlock(); } @@ -151,10 +143,6 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E void EntityScriptingInterface::deleteEntity(EntityItemID entityID) { - if (!canEdit()) { - return; - } - EntityItemID actualID = entityID; // if the entity is unknown, attempt to look it up diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 19003c3349..6b02d6db0a 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -59,12 +59,11 @@ public: void setEntityTree(EntityTree* modelTree) { _entityTree = modelTree; } EntityTree* getEntityTree(EntityTree*) { return _entityTree; } - public slots: // returns true if the DomainServer will allow this Node/Avatar to make changes - Q_INVOKABLE bool canEdit(); + Q_INVOKABLE bool canAdjustLocks(); /// adds a model with the specific properties Q_INVOKABLE EntityItemID addEntity(const EntityItemProperties& properties); diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index fa64540c4e..95617b4944 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -93,7 +93,7 @@ void EntityTree::postAddEntity(EntityItem* entity) { emit addingEntity(entity->getEntityItemID()); } -bool EntityTree::updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties) { +bool EntityTree::updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties, bool allowLockChange) { EntityTreeElement* containingElement = getContainingElement(entityID); if (!containingElement) { qDebug() << "UNEXPECTED!!!! EntityTree::updateEntity() entityID doesn't exist!!! entityID=" << entityID; @@ -106,21 +106,27 @@ bool EntityTree::updateEntity(const EntityItemID& entityID, const EntityItemProp return false; } - return updateEntityWithElement(existingEntity, properties, containingElement); + return updateEntityWithElement(existingEntity, properties, containingElement, allowLockChange); } -bool EntityTree::updateEntity(EntityItem* entity, const EntityItemProperties& properties) { +bool EntityTree::updateEntity(EntityItem* entity, const EntityItemProperties& properties, bool allowLockChange) { EntityTreeElement* containingElement = getContainingElement(entity->getEntityItemID()); if (!containingElement) { qDebug() << "UNEXPECTED!!!! EntityTree::updateEntity() entity-->element lookup failed!!! entityID=" << entity->getEntityItemID(); return false; } - return updateEntityWithElement(entity, properties, containingElement); + return updateEntityWithElement(entity, properties, containingElement, allowLockChange); } bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemProperties& properties, - EntityTreeElement* containingElement) { + EntityTreeElement* containingElement, bool allowLockChange) { + + if (!allowLockChange && (entity->getLocked() != properties.getLocked())) { + qDebug() << "Refusing disallowed lock adjustment."; + return false; + } + // enforce support for locked entities. If an entity is currently locked, then the only // property we allow you to change is the locked property. if (entity->getLocked()) { @@ -586,7 +592,7 @@ int EntityTree::processEditPacketData(PacketType packetType, const unsigned char // if the EntityItem exists, then update it if (existingEntity) { - updateEntity(entityItemID, properties); + updateEntity(entityItemID, properties, senderNode->getCanAdjustLocks()); existingEntity->markAsChangedOnServer(); } else { qDebug() << "User attempted to edit an unknown entity. ID:" << entityItemID; diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index b4621f1a10..62d6db0a10 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -86,10 +86,10 @@ public: EntityItem* addEntity(const EntityItemID& entityID, const EntityItemProperties& properties); // use this method if you only know the entityID - bool updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties); + bool updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties, bool allowLockChange); // use this method if you have a pointer to the entity (avoid an extra entity lookup) - bool updateEntity(EntityItem* entity, const EntityItemProperties& properties); + bool updateEntity(EntityItem* entity, const EntityItemProperties& properties, bool allowLockChange); void deleteEntity(const EntityItemID& entityID, bool force = false); void deleteEntities(QSet entityIDs, bool force = false); @@ -162,7 +162,7 @@ private: void processRemovedEntities(const DeleteEntityOperator& theOperator); bool updateEntityWithElement(EntityItem* entity, const EntityItemProperties& properties, - EntityTreeElement* containingElement); + EntityTreeElement* containingElement, bool AllowLockChange); static bool findNearPointOperation(OctreeElement* element, void* extraData); static bool findInSphereOperation(OctreeElement* element, void* extraData); static bool findInCubeOperation(OctreeElement* element, void* extraData); diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index b90551dcd0..54c746fcb6 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -412,7 +412,7 @@ void LimitedNodeList::handleNodeKill(const SharedNodePointer& node) { SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, - bool canEdit) { + bool canAdjustLocks) { NodeHash::const_iterator it = _nodeHash.find(uuid); if (it != _nodeHash.end()) { @@ -420,12 +420,12 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t matchingNode->setPublicSocket(publicSocket); matchingNode->setLocalSocket(localSocket); - matchingNode->setCanEdit(canEdit); + matchingNode->setCanAdjustLocks(canAdjustLocks); return matchingNode; } else { // we didn't have this node, so add them - Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket, canEdit); + Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket, canAdjustLocks); SharedNodePointer newNodePointer(newNode); _nodeHash.insert(UUIDNodePair(newNode->getUUID(), newNodePointer)); diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index 378fa89786..72aefdb2b3 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -77,8 +77,8 @@ public: const QUuid& getSessionUUID() const { return _sessionUUID; } void setSessionUUID(const QUuid& sessionUUID); - bool getThisNodeCanEdit() { return _thisNodeCanEdit; } - void setThisNodeCanEdit(bool canEdit) { _thisNodeCanEdit = canEdit; } + bool getThisNodeCanAdjustLocks() { return _thisNodeCanAdjustLocks; } + void setThisNodeCanAdjustLocks(bool canAdjustLocks) { _thisNodeCanAdjustLocks = canAdjustLocks; } void rebindNodeSocket(); QUdpSocket& getNodeSocket() { return _nodeSocket; } @@ -109,7 +109,7 @@ public: SharedNodePointer sendingNodeForPacket(const QByteArray& packet); SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType, - const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, bool canEdit); + const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, bool canAdjustLocks); const HifiSockAddr& getLocalSockAddr() const { return _localSockAddr; } const HifiSockAddr& getSTUNSockAddr() const { return _stunSockAddr; } @@ -204,7 +204,7 @@ protected: void handleNodeKill(const SharedNodePointer& node); QUuid _sessionUUID; - bool _thisNodeCanEdit; + bool _thisNodeCanAdjustLocks; NodeHash _nodeHash; QReadWriteLock _nodeMutex; QUdpSocket _nodeSocket; diff --git a/libraries/networking/src/Node.cpp b/libraries/networking/src/Node.cpp index ccefc4d1d0..2bf792c6ee 100644 --- a/libraries/networking/src/Node.cpp +++ b/libraries/networking/src/Node.cpp @@ -42,7 +42,7 @@ const QString& NodeType::getNodeTypeName(NodeType_t nodeType) { } Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, - const HifiSockAddr& localSocket, bool canEdit) : + const HifiSockAddr& localSocket, bool canAdjustLocks) : NetworkPeer(uuid, publicSocket, localSocket), _type(type), _activeSocket(NULL), @@ -54,7 +54,7 @@ Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, _clockSkewUsec(0), _mutex(), _clockSkewMovingPercentile(30, 0.8f), // moving 80th percentile of 30 samples - _canEdit(canEdit) + _canAdjustLocks(canAdjustLocks) { } @@ -133,7 +133,7 @@ QDataStream& operator<<(QDataStream& out, const Node& node) { out << node._uuid; out << node._publicSocket; out << node._localSocket; - out << node._canEdit; + out << node._canAdjustLocks; return out; } @@ -143,7 +143,7 @@ QDataStream& operator>>(QDataStream& in, Node& node) { in >> node._uuid; in >> node._publicSocket; in >> node._localSocket; - in >> node._canEdit; + in >> node._canAdjustLocks; return in; } diff --git a/libraries/networking/src/Node.h b/libraries/networking/src/Node.h index dbdca9bbc0..ddda947ff4 100644 --- a/libraries/networking/src/Node.h +++ b/libraries/networking/src/Node.h @@ -45,7 +45,8 @@ namespace NodeType { class Node : public NetworkPeer { Q_OBJECT public: - Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, bool canEdit); + Node(const QUuid& uuid, NodeType_t type, + const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket, bool canAdjustLocks); ~Node(); bool operator==(const Node& otherNode) const { return _uuid == otherNode._uuid; } @@ -77,8 +78,8 @@ public: const HifiSockAddr* getActiveSocket() const { return _activeSocket; } - void setCanEdit(bool canEdit) { _canEdit = canEdit; } - bool getCanEdit() { return _canEdit; } + void setCanAdjustLocks(bool canAdjustLocks) { _canAdjustLocks = canAdjustLocks; } + bool getCanAdjustLocks() { return _canAdjustLocks; } void activatePublicSocket(); void activateLocalSocket(); @@ -104,7 +105,7 @@ private: int _clockSkewUsec; QMutex _mutex; MovingPercentile _clockSkewMovingPercentile; - bool _canEdit; + bool _canAdjustLocks; }; QDebug operator<<(QDebug debug, const Node &message); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 972efda79e..d35e11a1c3 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -379,9 +379,9 @@ int NodeList::processDomainServerList(const QByteArray& packet) { packetStream >> newUUID; setSessionUUID(newUUID); - bool thisNodeCanEdit; - packetStream >> thisNodeCanEdit; - setThisNodeCanEdit(thisNodeCanEdit); + bool thisNodeCanAdjustLocks; + packetStream >> thisNodeCanAdjustLocks; + setThisNodeCanAdjustLocks(thisNodeCanAdjustLocks); // pull each node in the packet while(packetStream.device()->pos() < packet.size()) { @@ -389,9 +389,9 @@ int NodeList::processDomainServerList(const QByteArray& packet) { qint8 nodeType; QUuid nodeUUID, connectionUUID; HifiSockAddr nodePublicSocket, nodeLocalSocket; - bool canEdit; + bool canAdjustLocks; - packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> canEdit; + packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> canAdjustLocks; // if the public socket address is 0 then it's reachable at the same IP // as the domain server @@ -399,7 +399,7 @@ int NodeList::processDomainServerList(const QByteArray& packet) { nodePublicSocket.setAddress(_domainHandler.getIP()); } - SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket, nodeLocalSocket, canEdit); + SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket, nodeLocalSocket, canAdjustLocks); packetStream >> connectionUUID; node->setConnectionSecret(connectionUUID); diff --git a/tests/octree/src/ModelTests.cpp b/tests/octree/src/ModelTests.cpp index 3666759de4..00cb3901e5 100644 --- a/tests/octree/src/ModelTests.cpp +++ b/tests/octree/src/ModelTests.cpp @@ -107,7 +107,7 @@ void EntityTests::entityTreeTests(bool verbose) { properties.setPosition(newPosition); - tree.updateEntity(entityID, properties); + tree.updateEntity(entityID, properties, true); float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units const EntityItem* foundEntityByRadius = tree.findClosestEntity(positionNearOriginInTreeUnits, targetRadius); @@ -147,7 +147,7 @@ void EntityTests::entityTreeTests(bool verbose) { properties.setPosition(newPosition); - tree.updateEntity(entityID, properties); + tree.updateEntity(entityID, properties, true); float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units const EntityItem* foundEntityByRadius = tree.findClosestEntity(positionAtCenterInTreeUnits, targetRadius); From 839b622a05c69926b0bed53dc3edb0e50f110aef Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 6 Feb 2015 09:20:16 -0800 Subject: [PATCH 11/12] formatting --- libraries/entities/src/EntityScriptingInterface.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 5d949912a7..0ee2e243f9 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -71,7 +71,6 @@ EntityItemID EntityScriptingInterface::identifyEntity(EntityItemID entityID) { EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID entityID) { EntityItemProperties results; - EntityItemID identity = identifyEntity(entityID); if (_entityTree) { _entityTree->lockForRead(); @@ -102,7 +101,6 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID } EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const EntityItemProperties& properties) { - EntityItemID actualID = entityID; // if the entity is unknown, attempt to look it up if (!entityID.isKnownID) { From 9539292c223987654a34594c17755e2664609c49 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 6 Feb 2015 10:44:35 -0800 Subject: [PATCH 12/12] clarify settings explaination, coding standard --- domain-server/resources/describe-settings.json | 2 +- libraries/entities/src/EntityTree.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 31635e40d3..83b270c772 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -78,7 +78,7 @@ "name": "allowed_editors", "type": "table", "label": "Allowed Editors", - "help": "List the High Fidelity names for people you want to be able to make changes to this domain.
An empty list means everyone.", + "help": "List the High Fidelity names for people you want to be able lock or unlock entities in this domain.
An empty list means everyone.", "numbered": false, "columns": [ { diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index 62d6db0a10..3bc0986799 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -162,7 +162,7 @@ private: void processRemovedEntities(const DeleteEntityOperator& theOperator); bool updateEntityWithElement(EntityItem* entity, const EntityItemProperties& properties, - EntityTreeElement* containingElement, bool AllowLockChange); + EntityTreeElement* containingElement, bool allowLockChange); static bool findNearPointOperation(OctreeElement* element, void* extraData); static bool findInSphereOperation(OctreeElement* element, void* extraData); static bool findInCubeOperation(OctreeElement* element, void* extraData);