aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authordiva2009-04-05 03:27:50 +0000
committerdiva2009-04-05 03:27:50 +0000
commit3c9cba162739b93a07067d8a286f6dad55e02217 (patch)
treec4f9054f524b002b37e4d36a382c206b028f25d9 /OpenSim/Region/CoreModules
parent* Fixed copyright headers on HyperGrid source files. (Now match the rest of O... (diff)
downloadopensim-SC_OLD-3c9cba162739b93a07067d8a286f6dad55e02217.zip
opensim-SC_OLD-3c9cba162739b93a07067d8a286f6dad55e02217.tar.gz
opensim-SC_OLD-3c9cba162739b93a07067d8a286f6dad55e02217.tar.bz2
opensim-SC_OLD-3c9cba162739b93a07067d8a286f6dad55e02217.tar.xz
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!
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs13
-rw-r--r--OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs53
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs42
3 files changed, 78 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs
index fb293e8..1e430e5 100644
--- a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs
@@ -244,6 +244,19 @@ namespace OpenSim.Region.CoreModules.Communications.Local
244 return false; 244 return false;
245 } 245 }
246 246
247 public bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID)
248 {
249 foreach (Scene s in m_sceneList)
250 {
251 if (s.RegionInfo.RegionHandle == regionHandle)
252 {
253 return s.IncomingCreateObject(userID, itemID);
254 }
255 }
256 return false;
257 }
258
259
247 /** 260 /**
248 * Region-related communications 261 * Region-related communications
249 */ 262 */
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
276 return false; 276 return false;
277 } 277 }
278 278
279 public bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID)
280 {
281 // Not Implemented
282 return false;
283 }
284
279 /** 285 /**
280 * Region-related communications 286 * Region-related communications
281 */ 287 */
@@ -527,13 +533,13 @@ namespace OpenSim.Region.CoreModules.Communications.REST
527 533
528 public Hashtable ObjectHandler(Hashtable request) 534 public Hashtable ObjectHandler(Hashtable request)
529 { 535 {
530 //m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); 536 m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called");
531 537
532 //m_log.Debug("---------------------------"); 538 m_log.Debug("---------------------------");
533 //m_log.Debug(" >> uri=" + request["uri"]); 539 m_log.Debug(" >> uri=" + request["uri"]);
534 //m_log.Debug(" >> content-type=" + request["content-type"]); 540 m_log.Debug(" >> content-type=" + request["content-type"]);
535 //m_log.Debug(" >> http-method=" + request["http-method"]); 541 m_log.Debug(" >> http-method=" + request["http-method"]);
536 //m_log.Debug("---------------------------\n"); 542 m_log.Debug("---------------------------\n");
537 543
538 Hashtable responsedata = new Hashtable(); 544 Hashtable responsedata = new Hashtable();
539 responsedata["content_type"] = "text/html"; 545 responsedata["content_type"] = "text/html";
@@ -557,11 +563,11 @@ namespace OpenSim.Region.CoreModules.Communications.REST
557 DoObjectPost(request, responsedata, regionHandle); 563 DoObjectPost(request, responsedata, regionHandle);
558 return responsedata; 564 return responsedata;
559 } 565 }
560 //else if (method.Equals("PUT")) 566 else if (method.Equals("PUT"))
561 //{ 567 {
562 // DoObjectPut(request, responsedata, agentID); 568 DoObjectPut(request, responsedata, regionHandle);
563 // return responsedata; 569 return responsedata;
564 //} 570 }
565 //else if (method.Equals("DELETE")) 571 //else if (method.Equals("DELETE"))
566 //{ 572 //{
567 // DoObjectDelete(request, responsedata, agentID, action, regionHandle); 573 // DoObjectDelete(request, responsedata, agentID, action, regionHandle);
@@ -632,6 +638,31 @@ namespace OpenSim.Region.CoreModules.Communications.REST
632 responsedata["str_response_string"] = result.ToString(); 638 responsedata["str_response_string"] = result.ToString();
633 } 639 }
634 640
641 protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, ulong regionhandle)
642 {
643 OSDMap args = RegionClient.GetOSDMap((string)request["body"]);
644 if (args == null)
645 {
646 responsedata["int_response_code"] = 400;
647 responsedata["str_response_string"] = "false";
648 return;
649 }
650
651 UUID userID = UUID.Zero, itemID = UUID.Zero;
652 if (args["userid"] != null)
653 userID = args["userid"].AsUUID();
654 if (args["itemid"] != null)
655 itemID = args["itemid"].AsUUID();
656
657 UUID regionID = m_localBackend.GetRegionID(regionhandle);
658
659 // This is the meaning of PUT object
660 bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID);
661
662 responsedata["int_response_code"] = 200;
663 responsedata["str_response_string"] = result.ToString();
664 }
665
635 /* 666 /*
636 * Region-related incoming calls 667 * Region-related incoming calls
637 * 668 *
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
index 741075c..3675583 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private static bool initialized = false; 55 private static bool initialized = false;
56 private static bool enabled = false; 56 private static bool enabled = false;
57 private static bool safemode = false;
57 58
58 private bool m_doLookup = false; 59 private bool m_doLookup = false;
59 Scene m_scene; 60 Scene m_scene;
@@ -77,6 +78,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
77 78
78 // This module is only on for standalones 79 // This module is only on for standalones
79 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); 80 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
81 if (config.Configs["Hypergrid"] != null)
82 safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
80 } 83 }
81 } 84 }
82 85
@@ -116,34 +119,35 @@ namespace OpenSim.Region.CoreModules.Hypergrid
116 119
117 public virtual void AddHttpHandlers(IHttpServer httpServer) 120 public virtual void AddHttpHandlers(IHttpServer httpServer)
118 { 121 {
119 122 if (!safemode)
120 httpServer.AddStreamHandler( 123 {
121 new RestDeserialiseSecureHandler<Guid, InventoryCollection>( 124 httpServer.AddStreamHandler(
122 "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession)); 125 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
126 "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession));
127 httpServer.AddStreamHandler(
128 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
129 "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession));
130 httpServer.AddStreamHandler(
131 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
132 "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession));
133
134 httpServer.AddStreamHandler(
135 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
136 "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession));
137
138 httpServer.AddStreamHandler(
139 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
140 "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession));
141 }
123 142
124 httpServer.AddStreamHandler( 143 httpServer.AddStreamHandler(
125 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 144 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
126 "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession)); 145 "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession));
127 146
128 httpServer.AddStreamHandler( 147 httpServer.AddStreamHandler(
129 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
130 "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession));
131
132 httpServer.AddStreamHandler(
133 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
134 "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession));
135
136 httpServer.AddStreamHandler(
137 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
138 "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession));
139
140 httpServer.AddStreamHandler(
141 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 148 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
142 "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession)); 149 "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession));
143 150
144 httpServer.AddStreamHandler(
145 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
146 "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession));
147 151
148 } 152 }
149 153