fix permissions check

This commit is contained in:
Liv Erickson 2018-05-22 15:41:48 -07:00
parent 0ebd13b3e6
commit 56493346c1
5 changed files with 7 additions and 9 deletions

View file

@ -271,14 +271,13 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
} }
} }
bool EntityScriptingInterface::addLocalEntityCopy(EntityItemProperties& properties, EntityItemID& id) { bool EntityScriptingInterface::addLocalEntityCopy(EntityItemProperties& properties, EntityItemID& id, bool isClone) {
bool success = true; bool success = true;
id = EntityItemID(QUuid::createUuid()); id = EntityItemID(QUuid::createUuid());
if (_entityTree) { if (_entityTree) {
_entityTree->withWriteLock([&] { _entityTree->withWriteLock([&] {
EntityItemPointer entity = _entityTree->addEntity(id, properties); EntityItemPointer entity = _entityTree->addEntity(id, properties, isClone);
if (entity) { if (entity) {
if (properties.queryAACubeRelatedPropertyChanged()) { if (properties.queryAACubeRelatedPropertyChanged()) {
// due to parenting, the server may not know where something is in world-space, so include the bounding cube. // due to parenting, the server may not know where something is in world-space, so include the bounding cube.
@ -340,7 +339,7 @@ QUuid EntityScriptingInterface::cloneEntity(QUuid entityIDToClone) {
// setLastEdited timestamp to 0 to ensure this entity gets updated with the properties // setLastEdited timestamp to 0 to ensure this entity gets updated with the properties
// from the server-created entity, don't change this unless you know what you are doing // from the server-created entity, don't change this unless you know what you are doing
properties.setLastEdited(0); properties.setLastEdited(0);
bool success = addLocalEntityCopy(properties, newEntityID); bool success = addLocalEntityCopy(properties, newEntityID, true);
if (success) { if (success) {
getEntityPacketSender()->queueCloneEntityMessage(entityIDToClone, newEntityID); getEntityPacketSender()->queueCloneEntityMessage(entityIDToClone, newEntityID);
return newEntityID; return newEntityID;

View file

@ -1885,7 +1885,7 @@ private:
bool polyVoxWorker(QUuid entityID, std::function<bool(PolyVoxEntityItem&)> actor); bool polyVoxWorker(QUuid entityID, std::function<bool(PolyVoxEntityItem&)> actor);
bool setPoints(QUuid entityID, std::function<bool(LineEntityItem&)> actor); bool setPoints(QUuid entityID, std::function<bool(LineEntityItem&)> actor);
void queueEntityMessage(PacketType packetType, EntityItemID entityID, const EntityItemProperties& properties); void queueEntityMessage(PacketType packetType, EntityItemID entityID, const EntityItemProperties& properties);
bool addLocalEntityCopy(EntityItemProperties& propertiesWithSimID, EntityItemID& id); bool addLocalEntityCopy(EntityItemProperties& propertiesWithSimID, EntityItemID& id, bool isClone = false);
EntityItemPointer checkForTreeEntityAndTypeMatch(const QUuid& entityID, EntityItemPointer checkForTreeEntityAndTypeMatch(const QUuid& entityID,
EntityTypes::EntityType entityType = EntityTypes::Unknown); EntityTypes::EntityType entityType = EntityTypes::Unknown);

View file

@ -493,7 +493,7 @@ bool EntityTree::updateEntity(EntityItemPointer entity, const EntityItemProperti
return true; return true;
} }
EntityItemPointer EntityTree::addEntity(const EntityItemID& entityID, const EntityItemProperties& properties) { EntityItemPointer EntityTree::addEntity(const EntityItemID& entityID, const EntityItemProperties& properties, bool isClone) {
EntityItemPointer result = NULL; EntityItemPointer result = NULL;
EntityItemProperties props = properties; EntityItemProperties props = properties;
@ -505,7 +505,7 @@ EntityItemPointer EntityTree::addEntity(const EntityItemID& entityID, const Enti
if (!properties.getClientOnly() && getIsClient() && if (!properties.getClientOnly() && getIsClient() &&
!nodeList->getThisNodeCanRez() && !nodeList->getThisNodeCanRezTmp() && !nodeList->getThisNodeCanRez() && !nodeList->getThisNodeCanRezTmp() &&
!nodeList->getThisNodeCanRezCertified() && !nodeList->getThisNodeCanRezTmpCertified() && !_serverlessDomain) { !nodeList->getThisNodeCanRezCertified() && !nodeList->getThisNodeCanRezTmpCertified() && !_serverlessDomain && !isClone) {
return nullptr; return nullptr;
} }

View file

@ -110,7 +110,7 @@ public:
// The newer API... // The newer API...
void postAddEntity(EntityItemPointer entityItem); void postAddEntity(EntityItemPointer entityItem);
EntityItemPointer addEntity(const EntityItemID& entityID, const EntityItemProperties& properties); EntityItemPointer addEntity(const EntityItemID& entityID, const EntityItemProperties& properties, bool isClone = false);
// use this method if you only know the entityID // use this method if you only know the entityID
bool updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties, const SharedNodePointer& senderNode = SharedNodePointer(nullptr)); bool updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties, const SharedNodePointer& senderNode = SharedNodePointer(nullptr));

View file

@ -133,7 +133,6 @@ public:
EntityClone, EntityClone,
NUM_PACKET_TYPE NUM_PACKET_TYPE
}; };