From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001 From: teravus Date: Thu, 15 Nov 2012 10:05:16 -0500 Subject: Revert "Merge master into teravuswork", it should have been avination, not master. This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64. --- OpenSim/Services/AssetService/AssetService.cs | 17 +++- OpenSim/Services/AssetService/AssetServiceBase.cs | 4 +- OpenSim/Services/AssetService/XAssetService.cs | 18 +++- .../Connectors/Asset/AssetServicesConnector.cs | 8 +- .../Connectors/Friends/FriendsSimConnector.cs | 6 +- .../GridUser/GridUserServicesConnector.cs | 9 +- .../SimianGrid/SimianGridServiceConnector.cs | 8 +- OpenSim/Services/GridService/GridService.cs | 99 ++++++++++--------- OpenSim/Services/GridService/HypergridLinker.cs | 6 +- .../Services/HypergridService/GatekeeperService.cs | 93 +++--------------- .../Services/HypergridService/HGAssetService.cs | 26 +---- .../Services/HypergridService/HGFriendsService.cs | 2 +- .../HypergridService/HGSuitcaseInventoryService.cs | 76 ++------------- .../Services/HypergridService/UserAgentService.cs | 105 +-------------------- OpenSim/Services/Interfaces/IAssetService.cs | 6 +- OpenSim/Services/Interfaces/IGridService.cs | 13 --- OpenSim/Services/Interfaces/IGridUserService.cs | 3 +- OpenSim/Services/Interfaces/IPresenceService.cs | 38 +------- .../Services/InventoryService/XInventoryService.cs | 65 +++---------- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 +- .../Services/UserAccountService/GridUserService.cs | 13 ++- 21 files changed, 153 insertions(+), 464 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index f1bffa4..96b430d 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -70,7 +70,7 @@ namespace OpenSim.Services.AssetService if (assetLoaderEnabled) { - m_log.DebugFormat("[ASSET SERVICE]: Loading default asset set from {0}", loaderArgs); + m_log.DebugFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); m_AssetLoader.ForEachDefaultXmlAsset( loaderArgs, @@ -200,7 +200,20 @@ namespace OpenSim.Services.AssetService if (!UUID.TryParse(id, out assetID)) return false; - return m_Database.Delete(id); + AssetBase asset = m_Database.GetAsset(assetID); + if (asset == null) + return false; + + if ((int)(asset.Flags & AssetFlags.Maptile) != 0) + { + return m_Database.Delete(id); + } + else + { + m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id); + } + + return false; } } } \ No newline at end of file diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 58ab052..177c565 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -84,7 +84,7 @@ namespace OpenSim.Services.AssetService m_Database = LoadPlugin(dllName); if (m_Database == null) - throw new Exception(string.Format("Could not find a storage interface in the module {0}", dllName)); + throw new Exception("Could not find a storage interface in the given module"); m_Database.Initialise(connString); @@ -96,7 +96,7 @@ namespace OpenSim.Services.AssetService m_AssetLoader = LoadPlugin(loaderName); if (m_AssetLoader == null) - throw new Exception(string.Format("Asset loader could not be loaded from {0}", loaderName)); + throw new Exception("Asset loader could not be loaded"); } } } diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs index a1d10ed..e62bcb5 100644 --- a/OpenSim/Services/AssetService/XAssetService.cs +++ b/OpenSim/Services/AssetService/XAssetService.cs @@ -194,7 +194,21 @@ namespace OpenSim.Services.AssetService if (!UUID.TryParse(id, out assetID)) return false; - return m_Database.Delete(id); + AssetBase asset = m_Database.GetAsset(assetID); + if (asset == null) + return false; + + if ((int)(asset.Flags & AssetFlags.Maptile) != 0) + { + return m_Database.Delete(id); + } + else + { + m_log.DebugFormat("[XASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id); + } + + return false; } } -} \ No newline at end of file +} + diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 4b502b7..7f32ad3 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -52,8 +52,6 @@ namespace OpenSim.Services.Connectors private int m_retryCounter; private Dictionary> m_retryQueue = new Dictionary>(); private System.Timers.Timer m_retryTimer; - private int m_maxAssetRequestConcurrency = 30; - private delegate void AssetRetrievedEx(AssetBase asset); // Keeps track of concurrent requests for the same asset, so that it's only loaded once. @@ -82,10 +80,6 @@ namespace OpenSim.Services.Connectors public virtual void Initialise(IConfigSource source) { - IConfig netconfig = source.Configs["Network"]; - if (netconfig != null) - m_maxAssetRequestConcurrency = netconfig.GetInt("MaxRequestConcurrency",m_maxAssetRequestConcurrency); - IConfig assetConfig = source.Configs["AssetService"]; if (assetConfig == null) { @@ -210,7 +204,7 @@ namespace OpenSim.Services.Connectors if (asset == null || asset.Data == null || asset.Data.Length == 0) { asset = SynchronousRestObjectRequester. - MakeRequest("GET", uri, 0, m_maxAssetRequestConcurrency); + MakeRequest("GET", uri, 0, 30); if (m_Cache != null) m_Cache.Cache(asset); diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index 45f4514..6cd21d1 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs @@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors.Friends return Call(region, sendData); } - public bool StatusNotify(GridRegion region, UUID userID, string friendID, bool online) + public bool StatusNotify(GridRegion region, UUID userID, UUID friendID, bool online) { Dictionary sendData = new Dictionary(); //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); @@ -136,7 +136,7 @@ namespace OpenSim.Services.Connectors.Friends sendData["METHOD"] = "status"; sendData["FromID"] = userID.ToString(); - sendData["ToID"] = friendID; + sendData["ToID"] = friendID.ToString(); sendData["Online"] = online.ToString(); return Call(region, sendData); @@ -154,7 +154,7 @@ namespace OpenSim.Services.Connectors.Friends if (!region.ServerURI.EndsWith("/")) path = "/" + path; string uri = region.ServerURI + path; - // m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); + m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); try { diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index 94bda82..20d7eaf 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs @@ -207,7 +207,7 @@ namespace OpenSim.Services.Connectors if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) { if (replyData["result"] is Dictionary) - guinfo = Create((Dictionary)replyData["result"]); + guinfo = new GridUserInfo((Dictionary)replyData["result"]); } return guinfo; @@ -273,7 +273,7 @@ namespace OpenSim.Services.Connectors { if (griduser is Dictionary) { - GridUserInfo pinfo = Create((Dictionary)griduser); + GridUserInfo pinfo = new GridUserInfo((Dictionary)griduser); rinfos.Add(pinfo); } else @@ -286,10 +286,5 @@ namespace OpenSim.Services.Connectors return rinfos.ToArray(); } - - protected virtual GridUserInfo Create(Dictionary griduser) - { - return new GridUserInfo(griduser); - } } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 20eaa3a..0e4d794 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -112,7 +112,7 @@ namespace OpenSim.Services.Connectors.SimianGrid // m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); - Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); + Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); OSDMap extraData = new OSDMap { @@ -297,7 +297,7 @@ namespace OpenSim.Services.Connectors.SimianGrid List foundRegions = new List(); Vector3d minPosition = new Vector3d(xmin, ymin, 0.0); - Vector3d maxPosition = new Vector3d(xmax, ymax, Constants.RegionHeight); + Vector3d maxPosition = new Vector3d(xmax, ymax, 4096.0); NameValueCollection requestArgs = new NameValueCollection { @@ -395,8 +395,8 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean()) { OSDMap extraData = response["ExtraData"] as OSDMap; - int enabled = response["Enabled"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.RegionOnline : 0; - int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.Hyperlink : 0; + int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; + int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; int flags = enabled | hypergrid; m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); return flags; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ee3b858..aab403a 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -137,25 +137,20 @@ namespace OpenSim.Services.GridService if (regionInfos.RegionID == UUID.Zero) return "Invalid RegionID - cannot be zero UUID"; + // This needs better sanity testing. What if regionInfo is registering in + // overlapping coords? RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); - if ((region != null) && (region.RegionID != regionInfos.RegionID)) - { - m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", - regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); - return "Region overlaps another region"; - } - if (region != null) { // There is a preexisting record // // Get it's flags // - OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(region.Data["flags"]); + OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]); // Is this a reservation? // - if ((rflags & OpenSim.Framework.RegionFlags.Reservation) != 0) + if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) { // Regions reserved for the null key cannot be taken. if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) @@ -166,10 +161,10 @@ namespace OpenSim.Services.GridService // NOTE: Fudging the flags value here, so these flags // should not be used elsewhere. Don't optimize // this with the later retrieval of the same flags! - rflags |= OpenSim.Framework.RegionFlags.Authenticate; + rflags |= OpenSim.Data.RegionFlags.Authenticate; } - if ((rflags & OpenSim.Framework.RegionFlags.Authenticate) != 0) + if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) { // Can we authenticate at all? // @@ -181,36 +176,19 @@ namespace OpenSim.Services.GridService } } - // If we get here, the destination is clear. Now for the real check. - - if (!m_AllowDuplicateNames) + if ((region != null) && (region.RegionID != regionInfos.RegionID)) { - List dupe = m_Database.Get(regionInfos.RegionName, scopeID); - if (dupe != null && dupe.Count > 0) - { - foreach (RegionData d in dupe) - { - if (d.RegionID != regionInfos.RegionID) - { - m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", - regionInfos.RegionName, regionInfos.RegionID); - return "Duplicate region name"; - } - } - } + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", + regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); + return "Region overlaps another region"; } - // If there is an old record for us, delete it if it is elsewhere. - region = m_Database.Get(regionInfos.RegionID, scopeID); if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) { - if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.NoMove) != 0) + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) return "Can't move this region"; - if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.LockedOut) != 0) - return "Region locked out"; - // Region reregistering in other coordinates. Delete the old entry m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); @@ -225,6 +203,23 @@ namespace OpenSim.Services.GridService } } + if (!m_AllowDuplicateNames) + { + List dupe = m_Database.Get(regionInfos.RegionName, scopeID); + if (dupe != null && dupe.Count > 0) + { + foreach (RegionData d in dupe) + { + if (d.RegionID != regionInfos.RegionID) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", + regionInfos.RegionName, regionInfos.RegionID); + return "Duplicate region name"; + } + } + } + } + // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; @@ -232,8 +227,10 @@ namespace OpenSim.Services.GridService if (region != null) { int oldFlags = Convert.ToInt32(region.Data["flags"]); + if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) + return "Region locked out"; - oldFlags &= ~(int)OpenSim.Framework.RegionFlags.Reservation; + oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags } @@ -252,7 +249,7 @@ namespace OpenSim.Services.GridService } int flags = Convert.ToInt32(rdata.Data["flags"]); - flags |= (int)OpenSim.Framework.RegionFlags.RegionOnline; + flags |= (int)OpenSim.Data.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); try @@ -283,9 +280,9 @@ namespace OpenSim.Services.GridService int flags = Convert.ToInt32(region.Data["flags"]); - if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) + if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) { - flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; + flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; region.Data["flags"] = flags.ToString(); region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); try @@ -320,7 +317,7 @@ namespace OpenSim.Services.GridService if (rdata.RegionID != regionID) { int flags = Convert.ToInt32(rdata.Data["flags"]); - if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours + if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours rinfos.Add(RegionData2RegionInfo(rdata)); } } @@ -470,7 +467,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -486,7 +483,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -502,7 +499,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -629,7 +626,7 @@ namespace OpenSim.Services.GridService private void OutputRegionToConsole(RegionData r) { - OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); ConsoleDisplayList dispList = new ConsoleDisplayList(); dispList.AddRow("Region Name", r.RegionName); @@ -659,7 +656,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); dispTable.AddRow( r.RegionName, r.RegionID.ToString(), @@ -673,7 +670,7 @@ namespace OpenSim.Services.GridService private int ParseFlags(int prev, string flags) { - OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)prev; + OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); @@ -685,18 +682,18 @@ namespace OpenSim.Services.GridService { if (p.StartsWith("+")) { - val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); - f |= (OpenSim.Framework.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); + f |= (OpenSim.Data.RegionFlags)val; } else if (p.StartsWith("-")) { - val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); - f &= ~(OpenSim.Framework.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); + f &= ~(OpenSim.Data.RegionFlags)val; } else { - val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p); - f |= (OpenSim.Framework.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p); + f |= (OpenSim.Data.RegionFlags)val; } } catch (Exception) @@ -728,7 +725,7 @@ namespace OpenSim.Services.GridService int flags = Convert.ToInt32(r.Data["flags"]); flags = ParseFlags(flags, cmd[4]); r.Data["flags"] = flags.ToString(); - OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)flags; + OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags; MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f)); m_Database.Store(r); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 743d089..78eab3d 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -390,8 +390,8 @@ namespace OpenSim.Services.GridService List regions = m_Database.Get(mapName, m_ScopeID); if (regions != null && regions.Count > 0) { - OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); - if ((rflags & OpenSim.Framework.RegionFlags.Hyperlink) != 0) + OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); + if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) { regInfo = new GridRegion(); regInfo.RegionID = regions[0].RegionID; @@ -460,7 +460,7 @@ namespace OpenSim.Services.GridService private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); - int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline; + int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); m_Database.Store(rdata); diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 004311f..47d22b9 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -57,13 +57,10 @@ namespace OpenSim.Services.HypergridService private static IUserAccountService m_UserAccountService; private static IUserAgentService m_UserAgentService; private static ISimulationService m_SimulationService; - private static IGridUserService m_GridUserService; - private static string m_AllowedClients = string.Empty; - private static string m_DeniedClients = string.Empty; + protected string m_AllowedClients = string.Empty; + protected string m_DeniedClients = string.Empty; private static bool m_ForeignAgentsAllowed = true; - private static List m_ForeignsAllowedExceptions = new List(); - private static List m_ForeignsDisallowedExceptions = new List(); private static UUID m_ScopeID; private static bool m_AllowTeleportsToAnyRegion; @@ -85,9 +82,8 @@ namespace OpenSim.Services.HypergridService string gridService = serverConfig.GetString("GridService", String.Empty); string presenceService = serverConfig.GetString("PresenceService", String.Empty); string simulationService = serverConfig.GetString("SimulationService", String.Empty); - string gridUserService = serverConfig.GetString("GridUserService", String.Empty); - // These are mandatory, the others aren't + // These 3 are mandatory, the others aren't if (gridService == string.Empty || presenceService == string.Empty) throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); @@ -107,8 +103,6 @@ namespace OpenSim.Services.HypergridService m_UserAccountService = ServerUtils.LoadPlugin(accountService, args); if (homeUsersService != string.Empty) m_UserAgentService = ServerUtils.LoadPlugin(homeUsersService, args); - if (gridUserService != string.Empty) - m_GridUserService = ServerUtils.LoadPlugin(gridUserService, args); if (simService != null) m_SimulationService = simService; @@ -119,9 +113,6 @@ namespace OpenSim.Services.HypergridService m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); - LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); - LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions); - if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); @@ -134,15 +125,6 @@ namespace OpenSim.Services.HypergridService { } - protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List exceptions) - { - string value = config.GetString(variable, string.Empty); - string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - - foreach (string s in parts) - exceptions.Add(s.Trim()); - } - public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) { regionID = UUID.Zero; @@ -278,27 +260,18 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); // - // Foreign agents allowed? Exceptions? + // Foreign agents allowed // - if (account == null) + if (account == null && !m_ForeignAgentsAllowed) { - bool allowed = m_ForeignAgentsAllowed; - - if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) - allowed = false; - - if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions)) - allowed = true; - - if (!allowed) - { - reason = "Destination does not allow visitors from your world"; - m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.", - aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]); - return false; - } + reason = "Unauthorized"; + m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1}. Refusing service.", + aCircuit.firstname, aCircuit.lastname); + return false; } + // May want to authorize + bool isFirstLogin = false; // // Login the presence, if it's not there yet (by the login service) @@ -307,8 +280,7 @@ namespace OpenSim.Services.HypergridService if (presence != null) // it has been placed there by the login service isFirstLogin = true; - else - { + else if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) { reason = "Unable to login presence"; @@ -318,26 +290,6 @@ namespace OpenSim.Services.HypergridService } m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); - // Also login foreigners with GridUser service - if (m_GridUserService != null && account == null) - { - string userId = aCircuit.AgentID.ToString(); - string first = aCircuit.firstname, last = aCircuit.lastname; - if (last.StartsWith("@")) - { - string[] parts = aCircuit.firstname.Split('.'); - if (parts.Length >= 2) - { - first = parts[0]; - last = parts[1]; - } - } - - userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; - m_GridUserService.LoggedIn(userId); - } - } - // // Get the region // @@ -441,27 +393,6 @@ namespace OpenSim.Services.HypergridService #region Misc - private bool IsException(AgentCircuitData aCircuit, List exceptions) - { - bool exception = false; - if (exceptions.Count > 0) // we have exceptions - { - // Retrieve the visitor's origin - string userURL = aCircuit.ServiceURLs["HomeURI"].ToString(); - if (!userURL.EndsWith("/")) - userURL += "/"; - - if (exceptions.Find(delegate(string s) - { - if (!s.EndsWith("/")) - s += "/"; - return s == userURL; - }) != null) - exception = true; - } - - return exception; - } #endregion } diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index 84dec8d..db98166 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs @@ -58,8 +58,6 @@ namespace OpenSim.Services.HypergridService private UserAccountCache m_Cache; - private AssetPermissions m_AssetPerms; - public HGAssetService(IConfigSource config, string configName) : base(config, configName) { m_log.Debug("[HGAsset Service]: Starting"); @@ -82,10 +80,6 @@ namespace OpenSim.Services.HypergridService m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); - - // Permissions - m_AssetPerms = new AssetPermissions(assetConfig); - } #region IAssetService overrides @@ -96,9 +90,6 @@ namespace OpenSim.Services.HypergridService if (asset == null) return null; - if (!m_AssetPerms.AllowedExport(asset.Type)) - return null; - if (asset.Metadata.Type == (sbyte)AssetType.Object) asset.Data = AdjustIdentifiers(asset.Data); ; @@ -121,27 +112,16 @@ namespace OpenSim.Services.HypergridService public override byte[] GetData(string id) { - AssetBase asset = Get(id); - - if (asset == null) - return null; + byte[] data = base.GetData(id); - if (!m_AssetPerms.AllowedExport(asset.Type)) + if (data == null) return null; - return asset.Data; + return AdjustIdentifiers(data); } //public virtual bool Get(string id, Object sender, AssetRetrieved handler) - public override string Store(AssetBase asset) - { - if (!m_AssetPerms.AllowedImport(asset.Type)) - return string.Empty; - - return base.Store(asset); - } - public override bool Delete(string id) { // NOGO diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index a8bcfb2..98423d7 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs @@ -397,7 +397,7 @@ namespace OpenSim.Services.HypergridService if (region != null) { m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); - m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online); + m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); } } } diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 784f136..6e4b68c 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -56,12 +56,10 @@ namespace OpenSim.Services.HypergridService private string m_HomeURL; private IUserAccountService m_UserAccountService; - private IAvatarService m_AvatarService; // private UserAccountCache m_Cache; private ExpiringCache> m_SuitcaseTrees = new ExpiringCache>(); - private ExpiringCache m_Appearances = new ExpiringCache(); public HGSuitcaseInventoryService(IConfigSource config, string configName) : base(config, configName) @@ -71,7 +69,7 @@ namespace OpenSim.Services.HypergridService m_ConfigName = configName; if (m_Database == null) - m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: m_Database is null!"); + m_log.WarnFormat("[XXX]: m_Database is null!"); // // Try reading the [InventoryService] section, if it exists @@ -79,6 +77,7 @@ namespace OpenSim.Services.HypergridService IConfig invConfig = config.Configs[m_ConfigName]; if (invConfig != null) { + // realm = authConfig.GetString("Realm", realm); string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); if (userAccountsDll == string.Empty) throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); @@ -88,14 +87,8 @@ namespace OpenSim.Services.HypergridService if (m_UserAccountService == null) throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); - string avatarDll = invConfig.GetString("AvatarService", string.Empty); - if (avatarDll == string.Empty) - throw new Exception("Please specify AvatarService in HGInventoryService configuration"); - - m_AvatarService = ServerUtils.LoadPlugin(avatarDll, args); - if (m_AvatarService == null) - throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); - + // legacy configuration [obsolete] + m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty); // Preferred m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); @@ -301,7 +294,7 @@ namespace OpenSim.Services.HypergridService public override bool AddFolder(InventoryFolderBase folder) { - //m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); + m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); // Let's do a bit of sanity checking, more than the base service does // make sure the given folder's parent folder exists under the suitcase tree of this user @@ -323,7 +316,7 @@ namespace OpenSim.Services.HypergridService public override bool UpdateFolder(InventoryFolderBase folder) { - //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); @@ -401,7 +394,7 @@ namespace OpenSim.Services.HypergridService return null; } - if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) + if (!IsWithinSuitcaseTree(it.Owner, it.Folder)) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", it.Name, it.Folder); @@ -460,15 +453,6 @@ namespace OpenSim.Services.HypergridService if (folders != null && folders.Length > 0) return folders[0]; - - // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero. - folders = m_Database.GetFolders( - new string[] { "agentID", "folderName", "parentFolderID" }, - new string[] { principalID.ToString(), "My Inventory", UUID.Zero.ToString() }); - - if (folders != null && folders.Length > 0) - return folders[0]; - return null; } @@ -565,52 +549,6 @@ namespace OpenSim.Services.HypergridService else return true; } #endregion - - #region Avatar Appearance - - private AvatarAppearance GetAppearance(UUID principalID) - { - AvatarAppearance a = null; - if (m_Appearances.TryGetValue(principalID, out a)) - return a; - - a = m_AvatarService.GetAppearance(principalID); - m_Appearances.AddOrUpdate(principalID, a, 5 * 60); // 5minutes - return a; - } - - private bool IsPartOfAppearance(UUID principalID, UUID itemID) - { - AvatarAppearance a = GetAppearance(principalID); - - if (a == null) - return false; - - // Check wearables (body parts and clothes) - for (int i = 0; i < a.Wearables.Length; i++) - { - for (int j = 0; j < a.Wearables[i].Count; j++) - { - if (a.Wearables[i][j].ItemID == itemID) - { - //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); - return true; - } - } - } - - // Check attachments - if (a.GetAttachmentForItem(itemID) != null) - { - //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); - return true; - } - - return false; - } - - #endregion - } } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 416ad16..a49993c 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -77,10 +77,6 @@ namespace OpenSim.Services.HypergridService protected static bool m_BypassClientVerification; - private static Dictionary m_ForeignTripsAllowed = new Dictionary(); - private static Dictionary> m_TripsAllowedExceptions = new Dictionary>(); - private static Dictionary> m_TripsDisallowedExceptions = new Dictionary>(); - public UserAgentService(IConfigSource config) : this(config, null) { } @@ -125,12 +121,6 @@ namespace OpenSim.Services.HypergridService m_PresenceService = ServerUtils.LoadPlugin(presenceService, args); m_UserAccountService = ServerUtils.LoadPlugin(userAccountService, args); - m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); - - LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed"); - LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions); - LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions); - m_GridName = serverConfig.GetString("ExternalName", string.Empty); if (m_GridName == string.Empty) { @@ -140,43 +130,10 @@ namespace OpenSim.Services.HypergridService if (!m_GridName.EndsWith("/")) m_GridName = m_GridName + "/"; + m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); } } - protected void LoadTripPermissionsFromConfig(IConfig config, string variable) - { - foreach (string keyName in config.GetKeys()) - { - if (keyName.StartsWith(variable + "_Level_")) - { - int level = 0; - if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level)) - m_ForeignTripsAllowed.Add(level, config.GetBoolean(keyName, true)); - } - } - } - - protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, Dictionary> exceptions) - { - foreach (string keyName in config.GetKeys()) - { - if (keyName.StartsWith(variable + "_Level_")) - { - int level = 0; - if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level) && !exceptions.ContainsKey(level)) - { - exceptions.Add(level, new List()); - string value = config.GetString(keyName, string.Empty); - string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - - foreach (string s in parts) - exceptions[level].Add(s.Trim()); - } - } - } - } - - public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) { position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; @@ -209,39 +166,13 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); - string gridName = gatekeeper.ServerURI; - - UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID); - if (account == null) + if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null) { m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname); reason = "Forbidden to launch your agents from here"; return false; } - // Is this user allowed to go there? - if (m_GridName != gridName) - { - if (m_ForeignTripsAllowed.ContainsKey(account.UserLevel)) - { - bool allowed = m_ForeignTripsAllowed[account.UserLevel]; - - if (m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsAllowedExceptions)) - allowed = false; - - if (!m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsDisallowedExceptions)) - allowed = true; - - if (!allowed) - { - reason = "Your world does not allow you to visit the destination"; - m_log.InfoFormat("[USER AGENT SERVICE]: Agents not permitted to visit {0}. Refusing service.", gridName); - return false; - } - } - } - - // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); region.ServerURI = gatekeeper.ServerURI; @@ -258,6 +189,7 @@ namespace OpenSim.Services.HypergridService bool success = false; string myExternalIP = string.Empty; + string gridName = gatekeeper.ServerURI; m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); @@ -502,7 +434,7 @@ namespace OpenSim.Services.HypergridService if (region != null) { m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); - m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online); + m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); } } } @@ -654,35 +586,6 @@ namespace OpenSim.Services.HypergridService else return UUID.Zero; } - - #region Misc - - private bool IsException(string dest, int level, Dictionary> exceptions) - { - if (!exceptions.ContainsKey(level)) - return false; - - bool exception = false; - if (exceptions[level].Count > 0) // we have exceptions - { - string destination = dest; - if (!destination.EndsWith("/")) - destination += "/"; - - if (exceptions[level].Find(delegate(string s) - { - if (!s.EndsWith("/")) - s += "/"; - return s == destination; - }) != null) - exception = true; - } - - return exception; - } - - #endregion - } class TravelingAgentInfo diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index 3c469c6..80494f1 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs @@ -68,11 +68,7 @@ namespace OpenSim.Services.Interfaces /// /// The asset id /// Represents the requester. Passed back via the handler - /// - /// The handler to call back once the asset has been retrieved. This will be called back with a null AssetBase - /// if the asset could not be found for some reason (e.g. if it does not exist, if a remote asset service - /// was not contactable, if it is not in the database, etc.). - /// + /// The handler to call back once the asset has been retrieved /// True if the id was parseable, false otherwise bool Get(string id, Object sender, AssetRetrieved handler); diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 3f4c958..cdcb961 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -100,19 +100,6 @@ namespace OpenSim.Services.Interfaces List GetFallbackRegions(UUID scopeID, int x, int y); List GetHyperlinks(UUID scopeID); - /// - /// Get internal OpenSimulator region flags. - /// - /// - /// See OpenSimulator.Framework.RegionFlags. These are not returned in the GridRegion structure - - /// they currently need to be requested separately. Possibly this should change to avoid multiple service calls - /// in some situations. - /// - /// - /// The region flags. - /// - /// - /// int GetRegionFlags(UUID scopeID, UUID regionID); } diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs index 2e7237e..0a52bfa 100644 --- a/OpenSim/Services/Interfaces/IGridUserService.cs +++ b/OpenSim/Services/Interfaces/IGridUserService.cs @@ -80,7 +80,7 @@ namespace OpenSim.Services.Interfaces } - public virtual Dictionary ToKeyValuePairs() + public Dictionary ToKeyValuePairs() { Dictionary result = new Dictionary(); result["UserID"] = UserID; @@ -96,6 +96,7 @@ namespace OpenSim.Services.Interfaces result["Online"] = Online.ToString(); result["Login"] = Login.ToString(); result["Logout"] = Logout.ToString(); + return result; } diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index 90f9842..8d583ff 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs @@ -61,49 +61,13 @@ namespace OpenSim.Services.Interfaces public interface IPresenceService { - /// - /// Store session information. - /// - /// /returns> - /// - /// - /// bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID); - - /// - /// Remove session information. - /// - /// - /// bool LogoutAgent(UUID sessionID); - - /// - /// Remove session information for all agents in the given region. - /// - /// - /// bool LogoutRegionAgents(UUID regionID); - /// - /// Update data for an existing session. - /// - /// - /// - /// bool ReportAgent(UUID sessionID, UUID regionID); - /// - /// Get session information for a given session ID. - /// - /// - /// PresenceInfo GetAgent(UUID sessionID); - - /// - /// Get session information for a collection of users. - /// - /// Session information for the users. - /// PresenceInfo[] GetAgents(string[] userIDs); } -} \ No newline at end of file +} diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 309dab4..7518b86 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -94,7 +94,6 @@ namespace OpenSim.Services.InventoryService 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"); } @@ -230,28 +229,10 @@ namespace OpenSim.Services.InventoryService public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); - - InventoryFolderBase rootFolder = GetRootFolder(principalID); - - if (rootFolder == null) - { - m_log.WarnFormat( - "[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}", - principalID, type); - - return null; - } - - return GetSystemFolderForType(rootFolder, type); - } - - private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) - { -// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); XInventoryFolder[] folders = m_Database.GetFolders( - new string[] { "agentID", "parentFolderID", "type"}, - new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); + new string[] { "agentID", "type"}, + new string[] { principalID.ToString(), ((int)type).ToString() }); if (folders.Length == 0) { @@ -327,38 +308,22 @@ namespace OpenSim.Services.InventoryService if (check != null) return false; - if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) + if (folder.Type == (short)AssetType.Folder + || folder.Type == (short)AssetType.Unknown + || folder.Type == (short)AssetType.OutfitFolder + || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null) { - InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); - - if (rootFolder == null) - { - m_log.WarnFormat( - "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}", - folder.Owner, folder.Type); - - return false; - } - - // Check we're not trying to add this as a system folder. - if (folder.ParentID == rootFolder.ID) - { - InventoryFolderBase existingSystemFolder - = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); - - if (existingSystemFolder != null) - { - m_log.WarnFormat( - "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}", - folder.Type, folder.Name, folder.ParentID, folder.Owner); - - return false; - } - } + XInventoryFolder xFolder = ConvertFromOpenSim(folder); + return m_Database.StoreFolder(xFolder); + } + else + { + m_log.WarnFormat( + "[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}", + folder.Type, folder.Name, folder.ParentID, folder.Owner); } - XInventoryFolder xFolder = ConvertFromOpenSim(folder); - return m_Database.StoreFolder(xFolder); + return false; } public virtual bool UpdateFolder(InventoryFolderBase folder) diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index cbb6e6c..988a9b9 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -300,7 +300,7 @@ namespace OpenSim.Services.LLLoginService { m_log.InfoFormat( "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}", - firstName, lastName, account.UserLevel, m_MinLoginLevel); + firstName, lastName, m_MinLoginLevel, account.UserLevel); return LLFailedLoginResponse.LoginBlockedProblem; } diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index 43fa04b..ac3d8fd 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs @@ -49,7 +49,7 @@ namespace OpenSim.Services.UserAccountService m_log.Debug("[USER GRID SERVICE]: Starting user grid service"); } - public virtual GridUserInfo GetGridUserInfo(string userID) + public GridUserInfo GetGridUserInfo(string userID) { GridUserData d = m_Database.Get(userID); @@ -122,6 +122,17 @@ namespace OpenSim.Services.UserAccountService return m_Database.Store(d); } + protected bool StoreGridUserInfo(GridUserInfo info) + { + GridUserData d = new GridUserData(); + + d.Data["HomeRegionID"] = info.HomeRegionID.ToString(); + d.Data["HomePosition"] = info.HomePosition.ToString(); + d.Data["HomeLookAt"] = info.HomeLookAt.ToString(); + + return m_Database.Store(d); + } + public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) { GridUserData d = m_Database.Get(userID); -- cgit v1.1