From 3c9cba162739b93a07067d8a286f6dad55e02217 Mon Sep 17 00:00:00 2001 From: diva Date: Sun, 5 Apr 2009 03:27:50 +0000 Subject: Added CreateObject(regionhandle, userID, itemID) to post objects that are to be fetched from the user's inventory server and rezzed in the region. Added all code necessary to fetch the item and the asset, and rez it inworld. The access to the item is uncap-ed and unverified -- I may place it later either under a cap or with auth verification. But in this model regions don't have the user's inventory, so they would have to guess the item IDs. Added safemode config to Standalone Hypergrid, similar effect to AllowRegionAccessToInventory in Inventory Server. Everyone should have these vars set to their default values except me! --- .../Communications/REST/RESTInterregionComms.cs | 53 +++++++++++++++++----- 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/CoreModules/Communications/REST') diff --git a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs index b507bdd..90104f2 100644 --- a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs @@ -276,6 +276,12 @@ namespace OpenSim.Region.CoreModules.Communications.REST return false; } + public bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID) + { + // Not Implemented + return false; + } + /** * Region-related communications */ @@ -527,13 +533,13 @@ namespace OpenSim.Region.CoreModules.Communications.REST public Hashtable ObjectHandler(Hashtable request) { - //m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); + m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); - //m_log.Debug("---------------------------"); - //m_log.Debug(" >> uri=" + request["uri"]); - //m_log.Debug(" >> content-type=" + request["content-type"]); - //m_log.Debug(" >> http-method=" + request["http-method"]); - //m_log.Debug("---------------------------\n"); + m_log.Debug("---------------------------"); + m_log.Debug(" >> uri=" + request["uri"]); + m_log.Debug(" >> content-type=" + request["content-type"]); + m_log.Debug(" >> http-method=" + request["http-method"]); + m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; @@ -557,11 +563,11 @@ namespace OpenSim.Region.CoreModules.Communications.REST DoObjectPost(request, responsedata, regionHandle); return responsedata; } - //else if (method.Equals("PUT")) - //{ - // DoObjectPut(request, responsedata, agentID); - // return responsedata; - //} + else if (method.Equals("PUT")) + { + DoObjectPut(request, responsedata, regionHandle); + return responsedata; + } //else if (method.Equals("DELETE")) //{ // DoObjectDelete(request, responsedata, agentID, action, regionHandle); @@ -632,6 +638,31 @@ namespace OpenSim.Region.CoreModules.Communications.REST responsedata["str_response_string"] = result.ToString(); } + protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, ulong regionhandle) + { + OSDMap args = RegionClient.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = 400; + responsedata["str_response_string"] = "false"; + return; + } + + UUID userID = UUID.Zero, itemID = UUID.Zero; + if (args["userid"] != null) + userID = args["userid"].AsUUID(); + if (args["itemid"] != null) + itemID = args["itemid"].AsUUID(); + + UUID regionID = m_localBackend.GetRegionID(regionhandle); + + // This is the meaning of PUT object + bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID); + + responsedata["int_response_code"] = 200; + responsedata["str_response_string"] = result.ToString(); + } + /* * Region-related incoming calls * -- cgit v1.1