From b62b9af6b00100a5932191a0250b5ade3b52f436 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 2 Dec 2008 11:15:08 +0000 Subject: [PATCH] Added two new "trusted" url handlers to the Inventory server, to allow the user server to get a list of items in a folder and add a new item. --- .../InventoryServer/GridInventoryService.cs | 36 +++++++++++++------ OpenSim/Grid/InventoryServer/Main.cs | 8 +++++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index 6f7672e951..78d9f653ea 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -192,15 +192,15 @@ namespace OpenSim.Grid.InventoryServer invCollection.Folders = allFolders; invCollection.Items = allItems; -// foreach (InventoryFolderBase folder in invCollection.Folders) -// { -// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); -// } -// -// foreach (InventoryItemBase item in invCollection.Items) -// { -// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); -// } + // foreach (InventoryFolderBase folder in invCollection.Folders) + // { + // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); + // } + // + // foreach (InventoryItemBase item in invCollection.Items) + // { + // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); + // } m_log.InfoFormat( "[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items", @@ -209,6 +209,22 @@ namespace OpenSim.Grid.InventoryServer return invCollection; } + public List GetFolderItems(Guid folderID) + { + List allItems = new List(); + + + List items = RequestFolderItems(new UUID(folderID)); + + if (items != null) + { + allItems.InsertRange(0, items); + } + m_log.InfoFormat( + "[GRID AGENT INVENTORY]: Sending back inventory response containing {0} items", allItems.Count.ToString()); + return allItems; + } + /// /// Guid to UUID wrapper for same name IInventoryServices method /// @@ -233,7 +249,7 @@ namespace OpenSim.Grid.InventoryServer return CreateNewUserInventory(userID); } - + public List GetActiveGestures(Guid rawUserID) { UUID userID = new UUID(rawUserID); diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 8be6a232fc..81a6a03ee0 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -109,6 +109,14 @@ namespace OpenSim.Grid.InventoryServer new RestDeserialiseSecureHandler( "POST", "/NewItem/", m_inventoryService.AddItem, m_inventoryService.CheckAuthSession)); + m_httpServer.AddStreamHandler( + new RestDeserialiseTrustedHandler>( + "POST", "/GetItems/", m_inventoryService.GetFolderItems, m_inventoryService.CheckTrustSource)); + + m_httpServer.AddStreamHandler( + new RestDeserialiseTrustedHandler( + "POST", "/AddNewItem/", m_inventoryService.AddItem, m_inventoryService.CheckTrustSource)); + m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler( "POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession));