From 1503338ddcd170871815d70d328cbbd1dfd40c82 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 27 Feb 2012 16:15:16 -0800 Subject: PATH-292: Ensuring that the terrain linkset is not visible and/or editable to a non-estate non-god agent. --- indra/newview/llpathfindingmanager.cpp | 33 +++++++++++++++++++++++++++------ indra/newview/llpathfindingmanager.h | 3 +++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 3a96ed72e5..5c9293a28a 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -173,6 +173,12 @@ bool LLPathfindingManager::isAllowAlterPermanent() return (!isPathfindingEnabledForCurrentRegion() || (getAgentState() == kAgentStateUnfrozen)); } +bool LLPathfindingManager::isAllowViewTerrainProperties() const +{ + LLViewerRegion* region = getCurrentRegion(); + return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate())); +} + LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateSignal(agent_state_callback_t pAgentStateCallback) { return mAgentStateSignal.connect(pAgentStateCallback); @@ -231,13 +237,18 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestGetLin } else { - LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pLinksetsCallback, true, true)); + bool doRequestTerrain = isAllowViewTerrainProperties(); + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pLinksetsCallback, true, doRequestTerrain)); LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); - LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); - LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); - LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); + + if (doRequestTerrain) + { + LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); + LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); + } + status = kLinksetsRequestStarted; } @@ -257,7 +268,12 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin else { LLSD objectPostData = pLinksetList->encodeObjectFields(pLinksetUse, pA, pB, pC, pD); - LLSD terrainPostData = pLinksetList->encodeTerrainFields(pLinksetUse, pA, pB, pC, pD); + LLSD terrainPostData; + if (isAllowViewTerrainProperties()) + { + terrainPostData = pLinksetList->encodeTerrainFields(pLinksetUse, pA, pB, pC, pD); + } + if (objectPostData.isUndefined() && terrainPostData.isUndefined()) { status = kLinksetsRequestCompleted; @@ -362,7 +378,7 @@ std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::st { std::string capabilityURL(""); - LLViewerRegion* region = gAgent.getRegion(); + LLViewerRegion* region = getCurrentRegion(); if (region != NULL) { capabilityURL = region->getCapability(pCapabilityName); @@ -377,6 +393,11 @@ std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::st return capabilityURL; } +LLViewerRegion *LLPathfindingManager::getCurrentRegion() const +{ + return gAgent.getRegion(); +} + //--------------------------------------------------------------------------- // AgentStateResponder //--------------------------------------------------------------------------- diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 4b6fd49640..9a6bbb81b9 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -38,6 +38,7 @@ #include "llpathfindinglinksetlist.h" class LLFloater; +class LLViewerRegion; class LLPathfindingManager : public LLSingleton { @@ -70,6 +71,7 @@ public: bool isPathfindingEnabledForCurrentRegion() const; bool isAllowAlterPermanent(); + bool isAllowViewTerrainProperties() const; agent_state_slot_t registerAgentStateSignal(agent_state_callback_t pAgentStateCallback); EAgentState getAgentState(); @@ -95,6 +97,7 @@ private: std::string getTerrainLinksetsURLForCurrentRegion() const; std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const; + LLViewerRegion *getCurrentRegion() const; agent_state_signal_t mAgentStateSignal; EAgentState mAgentState; -- cgit v1.2.3