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!0.6.5-rc1
parent
9a4192d14e
commit
3c9cba1627
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* Copyright (c), Contributors. All rights reserved.
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Organizations nor the names of Individual
|
||||
* Contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Communications.Clients
|
||||
{
|
||||
public class InventoryClient
|
||||
{
|
||||
private string ServerURL;
|
||||
|
||||
public InventoryClient(string url)
|
||||
{
|
||||
ServerURL = url;
|
||||
}
|
||||
|
||||
public void GetInventoryItemAsync(InventoryItemBase item, ReturnResponse<InventoryItemBase> callBack)
|
||||
{
|
||||
System.Console.WriteLine("[HGrid] GetInventory from " + ServerURL);
|
||||
try
|
||||
{
|
||||
RestSessionObjectPosterResponse<InventoryItemBase, InventoryItemBase> requester
|
||||
= new RestSessionObjectPosterResponse<InventoryItemBase, InventoryItemBase>();
|
||||
requester.ResponseCallback = callBack;
|
||||
|
||||
requester.BeginPostObject(ServerURL + "/GetItem/", item, string.Empty, string.Empty);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.Console.WriteLine("[HGrid]: Exception posting to inventory: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryItemBase GetInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
System.Console.WriteLine("[HGrid] GetInventory " + item.ID + " from " + ServerURL);
|
||||
try
|
||||
{
|
||||
item = SynchronousRestSessionObjectPoster<Guid, InventoryItemBase>.BeginPostObject("POST", ServerURL + "/GetItem/", item.ID.Guid, "", "");
|
||||
return item;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.Console.WriteLine("[HGrid]: Exception posting to inventory: " + e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -417,6 +417,82 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
|
||||
}
|
||||
|
||||
public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID)
|
||||
{
|
||||
ulong regionHandle = GetRegionHandle(region.RegionHandle);
|
||||
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/";
|
||||
//m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri);
|
||||
|
||||
WebRequest ObjectCreateRequest = WebRequest.Create(uri);
|
||||
ObjectCreateRequest.Method = "PUT";
|
||||
ObjectCreateRequest.ContentType = "application/json";
|
||||
ObjectCreateRequest.Timeout = 10000;
|
||||
|
||||
OSDMap args = new OSDMap(2);
|
||||
args["userid"] = OSD.FromUUID(userID);
|
||||
args["itemid"] = OSD.FromUUID(itemID);
|
||||
|
||||
string strBuffer = "";
|
||||
byte[] buffer = new byte[1];
|
||||
try
|
||||
{
|
||||
strBuffer = OSDParser.SerializeJsonString(args);
|
||||
UTF8Encoding str = new UTF8Encoding();
|
||||
buffer = str.GetBytes(strBuffer);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message);
|
||||
// ignore. buffer will be empty, caller should check.
|
||||
}
|
||||
|
||||
Stream os = null;
|
||||
try
|
||||
{ // send the Post
|
||||
ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
|
||||
os = ObjectCreateRequest.GetRequestStream();
|
||||
os.Write(buffer, 0, strBuffer.Length); //Send it
|
||||
os.Close();
|
||||
//m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri);
|
||||
}
|
||||
//catch (WebException ex)
|
||||
catch
|
||||
{
|
||||
// m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Let's wait for the response
|
||||
//m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");
|
||||
|
||||
try
|
||||
{
|
||||
WebResponse webResponse = ObjectCreateRequest.GetResponse();
|
||||
if (webResponse == null)
|
||||
{
|
||||
m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post");
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
|
||||
sr.ReadToEnd().Trim();
|
||||
sr.ReadToEnd().Trim();
|
||||
sr.Close();
|
||||
|
||||
//m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply);
|
||||
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message);
|
||||
// ignore, really
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion)
|
||||
{
|
||||
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/";
|
||||
|
|
|
@ -107,6 +107,17 @@ namespace OpenSim.Framework.Communications.Services
|
|||
public virtual void AddHttpHandlers()
|
||||
{
|
||||
httpServer.AddHTTPHandler("/InvCap/", CapHandler);
|
||||
|
||||
// Un-cap'ed for now
|
||||
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<Guid, InventoryItemBase>(
|
||||
"POST", "/GetItem/", GetInventoryItem, CheckAuthSession));
|
||||
|
||||
}
|
||||
|
||||
public InventoryItemBase GetInventoryItem(Guid id)
|
||||
{
|
||||
UUID itemID = new UUID(id);
|
||||
return m_inventoryService.GetInventoryItem(itemID);
|
||||
}
|
||||
|
||||
public bool CheckAuthSession(string session_id, string avatar_id)
|
||||
|
@ -353,10 +364,15 @@ namespace OpenSim.Framework.Communications.Services
|
|||
m_log.DebugFormat("[HGStandaloneInvService]: client with uuid {0} is trying to get an item of owner {1}", item.Owner, item2.Owner);
|
||||
return asset;
|
||||
}
|
||||
UUID assetID = item2.AssetID;
|
||||
if (assetID != item.AssetID)
|
||||
{
|
||||
m_log.WarnFormat("[HGStandaloneInvService]: asset IDs don't match {0}, {1}", item.AssetID, item2.AssetID);
|
||||
}
|
||||
|
||||
// All good, get the asset
|
||||
//AssetBase theasset = m_assetProvider.FetchAsset(item.AssetID);
|
||||
AssetBase theasset = FetchAsset(item.AssetID, (item.InvType == (int)InventoryType.Texture));
|
||||
AssetBase theasset = FetchAsset(assetID, (item.InvType == (int)InventoryType.Texture));
|
||||
|
||||
m_log.Debug("[HGStandaloneInvService] Found asset " + ((theasset == null) ? "NULL" : "Not Null"));
|
||||
if (theasset != null)
|
||||
|
|
|
@ -76,8 +76,8 @@ namespace OpenSim.Grid.InventoryServer
|
|||
m_log.Info("[" + LogName + "]: Starting HTTP server ...");
|
||||
|
||||
m_httpServer = new BaseHttpServer(config.HttpPort);
|
||||
if (config.RegionAccessToAgentsInventory)
|
||||
AddHttpHandlers();
|
||||
|
||||
AddHttpHandlers(config.RegionAccessToAgentsInventory);
|
||||
|
||||
m_httpServer.Start();
|
||||
|
||||
|
@ -92,11 +92,39 @@ namespace OpenSim.Grid.InventoryServer
|
|||
"Add a random user inventory", HandleAddUser);
|
||||
}
|
||||
|
||||
protected void AddHttpHandlers()
|
||||
protected void AddHttpHandlers(bool regionAccess)
|
||||
{
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
||||
"POST", "/GetInventory/", m_inventoryService.GetUserInventory, m_inventoryService.CheckAuthSession));
|
||||
if (regionAccess)
|
||||
{
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
||||
"POST", "/GetInventory/", m_inventoryService.GetUserInventory, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/MoveFolder/", m_inventoryService.MoveFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
|
||||
"POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
|
||||
"POST", "/QueryFolder/", m_inventoryService.QueryFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
}
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, bool>(
|
||||
|
@ -106,41 +134,22 @@ namespace OpenSim.Grid.InventoryServer
|
|||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/NewFolder/", m_inventoryService.AddFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/MoveFolder/", m_inventoryService.MoveFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"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(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession));
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>(
|
||||
"POST", "/GetItems/", m_inventoryService.GetFolderItems, m_inventoryService.CheckTrustSource));
|
||||
|
||||
// for persistent active gestures
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
|
||||
"POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
|
||||
"POST", "/QueryFolder/", m_inventoryService.QueryFolder, m_inventoryService.CheckAuthSession));
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
|
||||
("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource));
|
||||
|
||||
// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
|
||||
// system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
|
||||
|
@ -150,11 +159,6 @@ namespace OpenSim.Grid.InventoryServer
|
|||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
||||
("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource));
|
||||
|
||||
// for persistent active gestures
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
|
||||
("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource));
|
||||
}
|
||||
|
||||
private void Work()
|
||||
|
|
|
@ -113,6 +113,17 @@ namespace OpenSim.Region.Communications.Hypergrid
|
|||
|
||||
m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Request inventory operation failed, {0} {1}",
|
||||
e.Source, e.Message);
|
||||
|
||||
// Well, let's synthesize one
|
||||
InventoryCollection icol = new InventoryCollection();
|
||||
icol.UserID = userID;
|
||||
icol.Items = new List<InventoryItemBase>();
|
||||
icol.Folders = new List<InventoryFolderBase>();
|
||||
InventoryFolderBase rootFolder = new InventoryFolderBase();
|
||||
rootFolder.ID = UUID.Random();
|
||||
rootFolder.Owner = userID;
|
||||
icol.Folders.Add(rootFolder);
|
||||
InventoryResponse(icol);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -244,6 +244,19 @@ namespace OpenSim.Region.CoreModules.Communications.Local
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID)
|
||||
{
|
||||
foreach (Scene s in m_sceneList)
|
||||
{
|
||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
return s.IncomingCreateObject(userID, itemID);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Region-related communications
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static bool initialized = false;
|
||||
private static bool enabled = false;
|
||||
private static bool safemode = false;
|
||||
|
||||
private bool m_doLookup = false;
|
||||
Scene m_scene;
|
||||
|
@ -77,6 +78,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
|
||||
// This module is only on for standalones
|
||||
enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
|
||||
if (config.Configs["Hypergrid"] != null)
|
||||
safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,34 +119,35 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
|
||||
public virtual void AddHttpHandlers(IHttpServer httpServer)
|
||||
{
|
||||
if (!safemode)
|
||||
{
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
||||
"POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession));
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession));
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession));
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
||||
"POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession));
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession));
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession));
|
||||
}
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession));
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession));
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession));
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession));
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession));
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,16 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <returns></returns>
|
||||
bool SendCreateObject(ulong regionHandle, ISceneObject sog, bool isLocalCall);
|
||||
|
||||
/// <summary>
|
||||
/// Create an object from the user's inventory in the destination region.
|
||||
/// This message is used primarily for prim crossing.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="sog"></param>
|
||||
/// <param name="isLocalCall"></param>
|
||||
/// <returns></returns>
|
||||
bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID);
|
||||
|
||||
#endregion Objects
|
||||
|
||||
#region Regions
|
||||
|
|
|
@ -33,6 +33,7 @@ using log4net;
|
|||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Communications.Clients;
|
||||
|
||||
//using HyperGrid.Framework;
|
||||
//using OpenSim.Region.Communications.Hypergrid;
|
||||
|
@ -50,6 +51,10 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
// This maps between asset UUIDs and asset servers
|
||||
private Dictionary<UUID, GridAssetClient> m_assetMap = new Dictionary<UUID, GridAssetClient>();
|
||||
|
||||
// This maps between inventory server urls and inventory server clients
|
||||
private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
|
||||
|
||||
|
||||
private Scene m_scene;
|
||||
#endregion
|
||||
|
||||
|
@ -72,6 +77,14 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
return null;
|
||||
}
|
||||
|
||||
private string UserInventoryURL(UUID userID)
|
||||
{
|
||||
CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
if (uinfo != null)
|
||||
return (uinfo.UserProfile.UserInventoryURI == "") ? null : uinfo.UserProfile.UserInventoryURI;
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool IsLocalUser(UUID userID)
|
||||
{
|
||||
CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
|
@ -275,9 +288,9 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
|
||||
#region Public interface
|
||||
|
||||
public void Get(UUID itemID, UUID ownerID)
|
||||
public void Get(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!IsInAssetMap(itemID) && !IsLocalUser(ownerID))
|
||||
if (!IsInAssetMap(assetID) && !IsLocalUser(ownerID))
|
||||
{
|
||||
// Get the item from the remote asset server onto the local AssetCache
|
||||
// and place an entry in m_assetMap
|
||||
|
@ -295,11 +308,11 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
m_assetServers.Add(userAssetURL, asscli);
|
||||
}
|
||||
|
||||
m_log.Debug("[HGScene]: Fetching object " + itemID + " to asset server " + userAssetURL);
|
||||
bool success = FetchAsset(asscli, itemID, false); // asscli.RequestAsset(item.ItemID, false);
|
||||
m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL);
|
||||
bool success = FetchAsset(asscli, assetID, false); // asscli.RequestAsset(item.ItemID, false);
|
||||
|
||||
// OK, now fetch the inside.
|
||||
Dictionary<UUID, bool> ids = SniffUUIDs(itemID);
|
||||
Dictionary<UUID, bool> ids = SniffUUIDs(assetID);
|
||||
Dump(ids);
|
||||
foreach (KeyValuePair<UUID, bool> kvp in ids)
|
||||
FetchAsset(asscli, kvp.Key, kvp.Value);
|
||||
|
@ -308,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
if (success)
|
||||
{
|
||||
m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL);
|
||||
m_assetMap.Add(itemID, asscli);
|
||||
m_assetMap.Add(assetID, asscli);
|
||||
}
|
||||
else
|
||||
m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
|
||||
|
@ -318,7 +331,36 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
}
|
||||
}
|
||||
|
||||
public void Post(UUID itemID, UUID ownerID)
|
||||
public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
||||
{
|
||||
if (!IsLocalUser(item.Owner))
|
||||
{
|
||||
InventoryClient invCli = null;
|
||||
string inventoryURL = UserInventoryURL(item.Owner);
|
||||
if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
|
||||
{
|
||||
m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
|
||||
invCli = new InventoryClient(inventoryURL);
|
||||
m_inventoryServers.Add(inventoryURL, invCli);
|
||||
}
|
||||
|
||||
item = invCli.GetInventoryItem(item);
|
||||
if (item != null)
|
||||
{
|
||||
// Change the folder, stick it in root folder, all items flattened out here in this region cache
|
||||
item.Folder = rootFolder;
|
||||
//userInfo.AddItem(item); don't use this, it calls back to the inventory server
|
||||
lock (userInfo.RootFolder.Items)
|
||||
{
|
||||
userInfo.RootFolder.Items[item.ID] = item;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public void Post(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!IsLocalUser(ownerID))
|
||||
{
|
||||
|
@ -337,11 +379,11 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
asscli.SetReceiver(m_scene.CommsManager.AssetCache); // Straight to the asset cache!
|
||||
m_assetServers.Add(userAssetURL, asscli);
|
||||
}
|
||||
m_log.Debug("[HGScene]: Posting object " + itemID + " to asset server " + userAssetURL);
|
||||
bool success = PostAsset(asscli, itemID);
|
||||
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
|
||||
bool success = PostAsset(asscli, assetID);
|
||||
|
||||
// Now the inside
|
||||
Dictionary<UUID, bool> ids = SniffUUIDs(itemID);
|
||||
Dictionary<UUID, bool> ids = SniffUUIDs(assetID);
|
||||
Dump(ids);
|
||||
foreach (KeyValuePair<UUID, bool> kvp in ids)
|
||||
PostAsset(asscli, kvp.Key);
|
||||
|
@ -349,8 +391,8 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
if (success)
|
||||
{
|
||||
m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL);
|
||||
if (!m_assetMap.ContainsKey(itemID))
|
||||
m_assetMap.Add(itemID, asscli);
|
||||
if (!m_assetMap.ContainsKey(assetID))
|
||||
m_assetMap.Add(assetID, asscli);
|
||||
}
|
||||
else
|
||||
m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL);
|
||||
|
|
|
@ -120,6 +120,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
|
||||
if (item == null)
|
||||
{ // Fetch the item
|
||||
item = new InventoryItemBase();
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.ID = itemID;
|
||||
item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
m_assMapper.Get(item.AssetID, remoteClient.AgentId);
|
||||
|
|
|
@ -1731,6 +1731,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
|
||||
{
|
||||
ScenePresence sp = GetScenePresence(userID);
|
||||
if (sp != null)
|
||||
{
|
||||
uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
|
||||
SceneObjectGroup sog = m_sceneGraph.RezSingleAttachment(sp.ControllingClient, itemID, attPt);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AddSceneObject(UUID primID, SceneObjectGroup sceneObject)
|
||||
{
|
||||
// If the user is banned, we won't let any of their objects
|
||||
|
|
|
@ -1147,3 +1147,7 @@
|
|||
; Enables the Mini Region Modules Script Engine. WARNING: SECURITY RISK.
|
||||
; default is false
|
||||
Enabled = false
|
||||
|
||||
[Hypergrid]
|
||||
; Keep it false for now. Making it true requires the use of a special client in order to access inventory
|
||||
safemode = false
|
||||
|
|
Loading…
Reference in New Issue