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.

0.6.1-post-fixes
MW 2008-12-02 11:15:08 +00:00
parent bf4ccf3858
commit b62b9af6b0
2 changed files with 34 additions and 10 deletions

View File

@ -192,15 +192,15 @@ namespace OpenSim.Grid.InventoryServer
invCollection.Folders = allFolders; invCollection.Folders = allFolders;
invCollection.Items = allItems; invCollection.Items = allItems;
// foreach (InventoryFolderBase folder in invCollection.Folders) // foreach (InventoryFolderBase folder in invCollection.Folders)
// { // {
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
// } // }
// //
// foreach (InventoryItemBase item in invCollection.Items) // 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.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
// } // }
m_log.InfoFormat( m_log.InfoFormat(
"[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items", "[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; return invCollection;
} }
public List<InventoryItemBase> GetFolderItems(Guid folderID)
{
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
List<InventoryItemBase> 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;
}
/// <summary> /// <summary>
/// Guid to UUID wrapper for same name IInventoryServices method /// Guid to UUID wrapper for same name IInventoryServices method
/// </summary> /// </summary>

View File

@ -109,6 +109,14 @@ namespace OpenSim.Grid.InventoryServer
new RestDeserialiseSecureHandler<InventoryItemBase, bool>( new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
"POST", "/NewItem/", m_inventoryService.AddItem, m_inventoryService.CheckAuthSession)); "POST", "/NewItem/", m_inventoryService.AddItem, m_inventoryService.CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>(
"POST", "/GetItems/", m_inventoryService.GetFolderItems, m_inventoryService.CheckTrustSource));
m_httpServer.AddStreamHandler(
new RestDeserialiseTrustedHandler<InventoryItemBase, bool>(
"POST", "/AddNewItem/", m_inventoryService.AddItem, m_inventoryService.CheckTrustSource));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, bool>( new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
"POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession)); "POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession));