From 2e397d1514175bde7f802515e8c5f41e50712803 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 24 Apr 2012 22:17:10 -0700 Subject: [PATCH] HG: Moved User-level code down to the HGEntityTransferModule where it belongs. --- .../EntityTransfer/EntityTransferModule.cs | 6 ++++-- .../EntityTransfer/HGEntityTransferModule.cs | 13 +++++++++++++ .../Scenes/Tests/SceneObjectStatusTests.cs | 19 ------------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b3a5464403..f45039a376 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -236,7 +236,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.ControllingClient.SendTeleportFailed("Problem at destination"); return; } - + + destinationRegionName = finalDestination.RegionName; + uint curX = 0, curY = 0; Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); int curCellX = (int)(curX / Constants.RegionSize); @@ -407,7 +409,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer bool logout = false; if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) { - sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", + sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); return; } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index bf2a63fc32..02cc759c2a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -49,6 +49,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private bool m_Initialized = false; + private int m_levelHGTeleport = 0; private GatekeeperServiceConnector m_GatekeeperConnector; @@ -67,6 +68,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string name = moduleConfig.GetString("EntityTransferModule", ""); if (name == Name) { + IConfig transferConfig = source.Configs["EntityTransfer"]; + if (transferConfig != null) + m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); + InitialiseCommon(source); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); @@ -163,6 +168,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) { // this user is going to another grid + // check if HyperGrid teleport is allowed, based on user level + if (sp.UserLevel < m_levelHGTeleport) + { + m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent."); + reason = "HyperGrid teleport not permitted"; + return false; + } + if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) { string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 87580003a6..7159dccde4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -123,25 +123,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); } - /// - /// Test that linking results in the correct physical status for all linkees. - /// -// [Test] - public void TestLinkPhysicsChildPhysicalOnly() - { - TestHelpers.InMethod(); - - m_scene.AddSceneObject(m_so1); - m_scene.AddSceneObject(m_so2); - - m_so2.ScriptSetPhysicsStatus(true); - - m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List() { m_so2.LocalId }); - - Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); - Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None)); - } - /// /// Test that linking results in the correct physical status for all linkees. ///