diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs index 54c6d89073..1bd00f5c0b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs @@ -98,9 +98,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory m_log.Info("[RegionInventoryService]: Starting..."); - Object[] args = new Object[] { m_Config, MainServer.Instance, String.Empty }; + Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" }; - ServerUtils.LoadPlugin("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args); + ServerUtils.LoadPlugin("OpenSim.Server.Handlers.dll:HGInventoryServiceInConnector", args); } } diff --git a/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs new file mode 100644 index 0000000000..cf5d521993 --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs @@ -0,0 +1,104 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * 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 OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 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 System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using log4net; +using Nini.Config; +using Nwc.XmlRpc; +using OpenSim.Server.Base; +using OpenSim.Server.Handlers.Inventory; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; +using OpenMetaverse; + +namespace OpenSim.Server.Handlers.Hypergrid +{ + public class HGInventoryServiceInConnector : InventoryServiceInConnector + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + //private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs + //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); + + private IUserAgentService m_UserAgentService; + + public HGInventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); + + string userAgentService = serverConfig.GetString("UserAgentService", string.Empty); + string m_userserver_url = serverConfig.GetString("UserAgentURI", String.Empty); + if (m_userserver_url != string.Empty) + { + Object[] args = new Object[] { m_userserver_url }; + m_UserAgentService = ServerUtils.LoadPlugin(userAgentService, args); + } + + AddHttpHandlers(server); + m_log.Debug("[HG HG INVENTORY HANDLER]: handlers initialized"); + } + + /// + /// Check that the source of an inventory request for a particular agent is a current session belonging to + /// that agent. + /// + /// + /// + /// + public override bool CheckAuthSession(string session_id, string avatar_id) + { + m_log.InfoFormat("[HG INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id); + // This doesn't work + + // if (m_session_cache.getCachedSession(session_id, avatar_id) == null) + // { + // //cache miss, ask userserver + // m_UserAgentService.VerifyAgent(session_id, ???); + // } + // else + // { + // // cache hits + // m_log.Info("[HG INVENTORY IN CONNECTOR]: got authed session from cache"); + // return true; + // } + + // m_log.Warn("[HG INVENTORY IN CONNECTOR]: unknown session_id, request rejected"); + // return false; + + return true; + } + } +} diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs new file mode 100644 index 0000000000..17d7850666 --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -0,0 +1,181 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * 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 OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 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 System.Collections; +using System.IO; +using System.Reflection; +using System.Net; +using System.Text; + +using OpenSim.Server.Base; +using OpenSim.Server.Handlers.Base; +using OpenSim.Services.Interfaces; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Simulation; +using Utils = OpenSim.Server.Handlers.Simulation.Utils; + +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using Nini.Config; +using log4net; + + +namespace OpenSim.Server.Handlers.Hypergrid +{ + public class HomeAgentHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IUserAgentService m_UserAgentService; + + public HomeAgentHandler(IUserAgentService userAgentService) + { + m_UserAgentService = userAgentService; + } + + public Hashtable Handler(Hashtable request) + { + m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler 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"); + + Hashtable responsedata = new Hashtable(); + responsedata["content_type"] = "text/html"; + responsedata["keepalive"] = false; + + + UUID agentID; + UUID regionID; + string action; + if (!Utils.GetParams((string)request["uri"], out agentID, out regionID, out action)) + { + m_log.InfoFormat("[HOME AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]); + responsedata["int_response_code"] = 404; + responsedata["str_response_string"] = "false"; + + return responsedata; + } + + // Next, let's parse the verb + string method = (string)request["http-method"]; + if (method.Equals("POST")) + { + DoAgentPost(request, responsedata, agentID); + return responsedata; + } + else + { + m_log.InfoFormat("[HOME AGENT HANDLER]: method {0} not supported in agent message", method); + responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; + responsedata["str_response_string"] = "Method not allowed"; + + return responsedata; + } + + } + + protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) + { + OSDMap args = Utils.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + // retrieve the input arguments + int x = 0, y = 0; + UUID uuid = UUID.Zero; + string regionname = string.Empty; + string gatekeeper_host = string.Empty; + int gatekeeper_port = 0; + + if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) + gatekeeper_host = args["gatekeeper_host"].AsString(); + if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) + Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); + + GridRegion gatekeeper = new GridRegion(); + gatekeeper.ExternalHostName = gatekeeper_host; + gatekeeper.HttpPort = (uint)gatekeeper_port; + gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); + + if (args.ContainsKey("destination_x") && args["destination_x"] != null) + Int32.TryParse(args["destination_x"].AsString(), out x); + else + m_log.WarnFormat(" -- request didn't have destination_x"); + if (args.ContainsKey("destination_y") && args["destination_y"] != null) + Int32.TryParse(args["destination_y"].AsString(), out y); + else + m_log.WarnFormat(" -- request didn't have destination_y"); + if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) + UUID.TryParse(args["destination_uuid"].AsString(), out uuid); + if (args.ContainsKey("destination_name") && args["destination_name"] != null) + regionname = args["destination_name"].ToString(); + + GridRegion destination = new GridRegion(); + destination.RegionID = uuid; + destination.RegionLocX = x; + destination.RegionLocY = y; + destination.RegionName = regionname; + + AgentCircuitData aCircuit = new AgentCircuitData(); + try + { + aCircuit.UnpackAgentCircuitData(args); + } + catch (Exception ex) + { + m_log.InfoFormat("[HOME AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message); + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + OSDMap resp = new OSDMap(2); + string reason = String.Empty; + + bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); + + resp["reason"] = OSD.FromString(reason); + resp["success"] = OSD.FromBoolean(result); + + // TODO: add reason if not String.Empty? + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); + } + + } + +} diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 3c92209d80..53db73921e 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Inventory { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private IInventoryService m_InventoryService; + protected IInventoryService m_InventoryService; private bool m_doLookup = false; @@ -54,11 +54,12 @@ namespace OpenSim.Server.Handlers.Inventory //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); private string m_userserver_url; - private string m_ConfigName = "InventoryService"; + protected string m_ConfigName = "InventoryService"; public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { + m_ConfigName = configName; IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); @@ -328,46 +329,9 @@ namespace OpenSim.Server.Handlers.Inventory /// /// /// - public bool CheckAuthSession(string session_id, string avatar_id) + public virtual bool CheckAuthSession(string session_id, string avatar_id) { - if (m_doLookup) - { - m_log.InfoFormat("[INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id); - - //if (m_session_cache.getCachedSession(session_id, avatar_id) == null) - //{ - // cache miss, ask userserver - Hashtable requestData = new Hashtable(); - requestData["avatar_uuid"] = avatar_id; - requestData["session_id"] = session_id; - ArrayList SendParams = new ArrayList(); - SendParams.Add(requestData); - XmlRpcRequest UserReq = new XmlRpcRequest("check_auth_session", SendParams); - XmlRpcResponse UserResp = UserReq.Send(m_userserver_url, 3000); - - Hashtable responseData = (Hashtable)UserResp.Value; - if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE") - { - m_log.Info("[INVENTORY IN CONNECTOR]: got authed session from userserver"); - //// add to cache; the session time will be automatically renewed - //m_session_cache.Add(session_id, avatar_id); - return true; - } - //} - //else - //{ - // // cache hits - // m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache"); - // return true; - //} - - m_log.Warn("[INVENTORY IN CONNECTOR]: unknown session_id, request rejected"); - return false; - } - else - { - return true; - } + return true; } } diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs new file mode 100644 index 0000000000..85f3bfc57c --- /dev/null +++ b/OpenSim/Services/InventoryService/HGInventoryService.cs @@ -0,0 +1,302 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * 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 OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 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 System.Collections.Generic; +using OpenMetaverse; +using log4net; +using Nini.Config; +using System.Reflection; +using OpenSim.Services.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Data; +using OpenSim.Framework; + +namespace OpenSim.Services.InventoryService +{ + public class HGInventoryService : XInventoryService, IInventoryService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + protected IXInventoryData m_Database; + + public HGInventoryService(IConfigSource config) + : base(config) + { + string dllName = String.Empty; + string connString = String.Empty; + //string realm = "Inventory"; // OSG version doesn't use this + + // + // Try reading the [DatabaseService] section, if it exists + // + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + if (dllName == String.Empty) + dllName = dbConfig.GetString("StorageProvider", String.Empty); + if (connString == String.Empty) + connString = dbConfig.GetString("ConnectionString", String.Empty); + } + + // + // Try reading the [InventoryService] section, if it exists + // + IConfig authConfig = config.Configs["InventoryService"]; + if (authConfig != null) + { + dllName = authConfig.GetString("StorageProvider", dllName); + connString = authConfig.GetString("ConnectionString", connString); + // realm = authConfig.GetString("Realm", realm); + } + + // + // We tried, but this doesn't exist. We can't proceed. + // + if (dllName == String.Empty) + throw new Exception("No StorageProvider configured"); + + m_Database = LoadPlugin(dllName, + new Object[] {connString, String.Empty}); + if (m_Database == null) + throw new Exception("Could not find a storage interface in the given module"); + + m_log.Debug("[HG INVENTORY SERVVICE]: Starting..."); + } + + public override bool CreateUserInventory(UUID principalID) + { + // NOGO + return false; + } + + + public override List GetInventorySkeleton(UUID principalID) + { + // NOGO for this inventory service + return new List(); + } + + public override InventoryFolderBase GetRootFolder(UUID principalID) + { + // Warp! Root folder for travelers + XInventoryFolder[] folders = m_Database.GetFolders( + new string[] { "agentID", "folderName"}, + new string[] { principalID.ToString(), "Suitcase" }); + + if (folders.Length > 0) + return ConvertToOpenSim(folders[0]); + + // make one + XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "Suitcase"); + return ConvertToOpenSim(suitcase); + } + + //private bool CreateSystemFolders(UUID principalID, XInventoryFolder suitcase) + //{ + + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Animation, "Animations"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Bodypart, "Body Parts"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.CallingCard, "Calling Cards"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Clothing, "Clothing"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Gesture, "Gestures"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Landmark, "Landmarks"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Notecard, "Notecards"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Object, "Objects"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.SnapshotFolder, "Photo Album"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.LSLText, "Scripts"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Sound, "Sounds"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Texture, "Textures"); + // CreateFolder(principalID, suitcase.folderID, (int)AssetType.TrashFolder, "Trash"); + + // return true; + //} + + + public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) + { + return GetRootFolder(principalID); + } + + // + // Use the inherited methods + // + //public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) + //{ + //} + + //public List GetFolderItems(UUID principalID, UUID folderID) + //{ + //} + + //public override bool AddFolder(InventoryFolderBase folder) + //{ + // // Check if it's under the Suitcase folder + // List skel = base.GetInventorySkeleton(folder.Owner); + // InventoryFolderBase suitcase = GetRootFolder(folder.Owner); + // List suitDescendents = GetDescendents(skel, suitcase.ID); + + // foreach (InventoryFolderBase f in suitDescendents) + // if (folder.ParentID == f.ID) + // { + // XInventoryFolder xFolder = ConvertFromOpenSim(folder); + // return m_Database.StoreFolder(xFolder); + // } + // return false; + //} + + private List GetDescendents(List lst, UUID root) + { + List direct = lst.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == root; }); + if (direct == null) + return new List(); + + List indirect = new List(); + foreach (InventoryFolderBase f in direct) + indirect.AddRange(GetDescendents(lst, f.ID)); + + direct.AddRange(indirect); + return direct; + } + + // Use inherited method + //public bool UpdateFolder(InventoryFolderBase folder) + //{ + //} + + //public override bool MoveFolder(InventoryFolderBase folder) + //{ + // XInventoryFolder[] x = m_Database.GetFolders( + // new string[] { "folderID" }, + // new string[] { folder.ID.ToString() }); + + // if (x.Length == 0) + // return false; + + // // Check if it's under the Suitcase folder + // List skel = base.GetInventorySkeleton(folder.Owner); + // InventoryFolderBase suitcase = GetRootFolder(folder.Owner); + // List suitDescendents = GetDescendents(skel, suitcase.ID); + + // foreach (InventoryFolderBase f in suitDescendents) + // if (folder.ParentID == f.ID) + // { + // x[0].parentFolderID = folder.ParentID; + // return m_Database.StoreFolder(x[0]); + // } + + // return false; + //} + + public override bool DeleteFolders(UUID principalID, List folderIDs) + { + // NOGO + return false; + } + + public override bool PurgeFolder(InventoryFolderBase folder) + { + // NOGO + return false; + } + + // Unfortunately we need to use the inherited method because of how DeRez works. + // The viewer sends the folderID hard-wired in the derez message + //public override bool AddItem(InventoryItemBase item) + //{ + // // Check if it's under the Suitcase folder + // List skel = base.GetInventorySkeleton(item.Owner); + // InventoryFolderBase suitcase = GetRootFolder(item.Owner); + // List suitDescendents = GetDescendents(skel, suitcase.ID); + + // foreach (InventoryFolderBase f in suitDescendents) + // if (item.Folder == f.ID) + // return m_Database.StoreItem(ConvertFromOpenSim(item)); + + // return false; + //} + + //public override bool UpdateItem(InventoryItemBase item) + //{ + // // Check if it's under the Suitcase folder + // List skel = base.GetInventorySkeleton(item.Owner); + // InventoryFolderBase suitcase = GetRootFolder(item.Owner); + // List suitDescendents = GetDescendents(skel, suitcase.ID); + + // foreach (InventoryFolderBase f in suitDescendents) + // if (item.Folder == f.ID) + // return m_Database.StoreItem(ConvertFromOpenSim(item)); + + // return false; + //} + + //public override bool MoveItems(UUID principalID, List items) + //{ + // // Principal is b0rked. *sigh* + // // + // // Let's assume they all have the same principal + // // Check if it's under the Suitcase folder + // List skel = base.GetInventorySkeleton(items[0].Owner); + // InventoryFolderBase suitcase = GetRootFolder(items[0].Owner); + // List suitDescendents = GetDescendents(skel, suitcase.ID); + + // foreach (InventoryItemBase i in items) + // { + // foreach (InventoryFolderBase f in suitDescendents) + // if (i.Folder == f.ID) + // m_Database.MoveItem(i.ID.ToString(), i.Folder.ToString()); + // } + + // return true; + //} + + // Let these pass. Use inherited methods. + //public bool DeleteItems(UUID principalID, List itemIDs) + //{ + //} + + //public InventoryItemBase GetItem(InventoryItemBase item) + //{ + //} + + //public InventoryFolderBase GetFolder(InventoryFolderBase folder) + //{ + //} + + //public List GetActiveGestures(UUID principalID) + //{ + //} + + //public int GetAssetPermissions(UUID principalID, UUID assetID) + //{ + //} + + } +} diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 2c79c777f8..2fb6a561f8 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.InventoryService throw new Exception("Could not find a storage interface in the given module"); } - public bool CreateUserInventory(UUID principalID) + public virtual bool CreateUserInventory(UUID principalID) { // This is braindeaad. We can't ever communicate that we fixed // an existing inventory. Well, just return root folder status, @@ -137,7 +137,7 @@ namespace OpenSim.Services.InventoryService return result; } - private XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) + protected XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) { XInventoryFolder newFolder = new XInventoryFolder(); @@ -153,7 +153,7 @@ namespace OpenSim.Services.InventoryService return newFolder; } - private XInventoryFolder[] GetSystemFolders(UUID principalID) + protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID) { XInventoryFolder[] allFolders = m_Database.GetFolders( new string[] { "agentID" }, @@ -171,7 +171,7 @@ namespace OpenSim.Services.InventoryService return sysFolders; } - public List GetInventorySkeleton(UUID principalID) + public virtual List GetInventorySkeleton(UUID principalID) { XInventoryFolder[] allFolders = m_Database.GetFolders( new string[] { "agentID" }, @@ -191,7 +191,7 @@ namespace OpenSim.Services.InventoryService return folders; } - public InventoryFolderBase GetRootFolder(UUID principalID) + public virtual InventoryFolderBase GetRootFolder(UUID principalID) { XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "parentFolderID"}, @@ -203,7 +203,7 @@ namespace OpenSim.Services.InventoryService return ConvertToOpenSim(folders[0]); } - public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) + public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "type"}, @@ -215,7 +215,7 @@ namespace OpenSim.Services.InventoryService return ConvertToOpenSim(folders[0]); } - public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) + public virtual InventoryCollection GetFolderContent(UUID principalID, UUID folderID) { // This method doesn't receive a valud principal id from the // connector. So we disregard the principal and look @@ -250,7 +250,7 @@ namespace OpenSim.Services.InventoryService return inventory; } - public List GetFolderItems(UUID principalID, UUID folderID) + public virtual List GetFolderItems(UUID principalID, UUID folderID) { // Since we probably don't get a valid principal here, either ... // @@ -266,18 +266,18 @@ namespace OpenSim.Services.InventoryService return invItems; } - public bool AddFolder(InventoryFolderBase folder) + public virtual bool AddFolder(InventoryFolderBase folder) { XInventoryFolder xFolder = ConvertFromOpenSim(folder); return m_Database.StoreFolder(xFolder); } - public bool UpdateFolder(InventoryFolderBase folder) + public virtual bool UpdateFolder(InventoryFolderBase folder) { return AddFolder(folder); } - public bool MoveFolder(InventoryFolderBase folder) + public virtual bool MoveFolder(InventoryFolderBase folder) { XInventoryFolder[] x = m_Database.GetFolders( new string[] { "folderID" }, @@ -293,7 +293,7 @@ namespace OpenSim.Services.InventoryService // We don't check the principal's ID here // - public bool DeleteFolders(UUID principalID, List folderIDs) + public virtual bool DeleteFolders(UUID principalID, List folderIDs) { // Ignore principal ID, it's bogus at connector level // @@ -308,7 +308,7 @@ namespace OpenSim.Services.InventoryService return true; } - public bool PurgeFolder(InventoryFolderBase folder) + public virtual bool PurgeFolder(InventoryFolderBase folder) { XInventoryFolder[] subFolders = m_Database.GetFolders( new string[] { "parentFolderID" }, @@ -325,17 +325,17 @@ namespace OpenSim.Services.InventoryService return true; } - public bool AddItem(InventoryItemBase item) + public virtual bool AddItem(InventoryItemBase item) { return m_Database.StoreItem(ConvertFromOpenSim(item)); } - public bool UpdateItem(InventoryItemBase item) + public virtual bool UpdateItem(InventoryItemBase item) { return m_Database.StoreItem(ConvertFromOpenSim(item)); } - public bool MoveItems(UUID principalID, List items) + public virtual bool MoveItems(UUID principalID, List items) { // Principal is b0rked. *sigh* // @@ -347,7 +347,7 @@ namespace OpenSim.Services.InventoryService return true; } - public bool DeleteItems(UUID principalID, List itemIDs) + public virtual bool DeleteItems(UUID principalID, List itemIDs) { // Just use the ID... *facepalms* // @@ -357,7 +357,7 @@ namespace OpenSim.Services.InventoryService return true; } - public InventoryItemBase GetItem(InventoryItemBase item) + public virtual InventoryItemBase GetItem(InventoryItemBase item) { XInventoryItem[] items = m_Database.GetItems( new string[] { "inventoryID" }, @@ -369,7 +369,7 @@ namespace OpenSim.Services.InventoryService return ConvertToOpenSim(items[0]); } - public InventoryFolderBase GetFolder(InventoryFolderBase folder) + public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) { XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "folderID"}, @@ -381,7 +381,7 @@ namespace OpenSim.Services.InventoryService return ConvertToOpenSim(folders[0]); } - public List GetActiveGestures(UUID principalID) + public virtual List GetActiveGestures(UUID principalID) { XInventoryItem[] items = m_Database.GetActiveGestures(principalID); @@ -396,7 +396,7 @@ namespace OpenSim.Services.InventoryService return ret; } - public int GetAssetPermissions(UUID principalID, UUID assetID) + public virtual int GetAssetPermissions(UUID principalID, UUID assetID) { return m_Database.GetAssetPermissions(principalID, assetID); } @@ -421,7 +421,7 @@ namespace OpenSim.Services.InventoryService // CM Helpers // - private InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder) + protected InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder) { InventoryFolderBase newFolder = new InventoryFolderBase(); @@ -435,7 +435,7 @@ namespace OpenSim.Services.InventoryService return newFolder; } - private XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder) + protected XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder) { XInventoryFolder newFolder = new XInventoryFolder(); @@ -449,7 +449,7 @@ namespace OpenSim.Services.InventoryService return newFolder; } - private InventoryItemBase ConvertToOpenSim(XInventoryItem item) + protected InventoryItemBase ConvertToOpenSim(XInventoryItem item) { InventoryItemBase newItem = new InventoryItemBase(); @@ -477,7 +477,7 @@ namespace OpenSim.Services.InventoryService return newItem; } - private XInventoryItem ConvertFromOpenSim(InventoryItemBase item) + protected XInventoryItem ConvertFromOpenSim(InventoryItemBase item) { XInventoryItem newItem = new XInventoryItem(); diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 686d2a4628..f36b0c49ec 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -33,7 +33,6 @@ SimulationServiceInConnector = true [AssetService] - ; For the AssetServiceInConnector LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" ; For HGAssetBroker @@ -41,7 +40,6 @@ HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector" [InventoryService] - ; For the InventoryServiceInConnector LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService" ; For HGInventoryBroker @@ -49,7 +47,6 @@ HypergridInventoryService = "OpenSim.Services.Connectors.dll:HGInventoryServiceConnector" [AvatarService] - ; For the InventoryServiceInConnector LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" [LibraryService] @@ -117,3 +114,8 @@ PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" GridService = "OpenSim.Services.GridService.dll:GridService" +;; The interface that local users get when they are in other grids +;; This greatly restricts the inventory operations while in other grids +[HGInventoryService] + ; For the InventoryServiceInConnector + LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService"