diff options
Diffstat (limited to 'OpenSim/Region')
3 files changed, 181 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1aecce5..558f108 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1326,12 +1326,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1326 | /// <summary> | 1326 | /// <summary> |
1327 | /// Update the position of the given group. | 1327 | /// Update the position of the given group. |
1328 | /// </summary> | 1328 | /// </summary> |
1329 | /// <param name="localID"></param> | 1329 | /// <param name="localId"></param> |
1330 | /// <param name="pos"></param> | 1330 | /// <param name="pos"></param> |
1331 | /// <param name="remoteClient"></param> | 1331 | /// <param name="remoteClient"></param> |
1332 | public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient) | 1332 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) |
1333 | { | 1333 | { |
1334 | SceneObjectGroup group = GetGroupByPrim(localID); | 1334 | UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId); |
1335 | } | ||
1336 | |||
1337 | /// <summary> | ||
1338 | /// Update the position of the given group. | ||
1339 | /// </summary> | ||
1340 | /// <param name="localId"></param> | ||
1341 | /// <param name="pos"></param> | ||
1342 | /// <param name="updatingAgentId"></param> | ||
1343 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId) | ||
1344 | { | ||
1345 | SceneObjectGroup group = GetGroupByPrim(localId); | ||
1335 | 1346 | ||
1336 | if (group != null) | 1347 | if (group != null) |
1337 | { | 1348 | { |
@@ -1342,7 +1353,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1342 | } | 1353 | } |
1343 | else | 1354 | else |
1344 | { | 1355 | { |
1345 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) | 1356 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId) |
1346 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) | 1357 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) |
1347 | { | 1358 | { |
1348 | group.UpdateGroupPosition(pos); | 1359 | group.UpdateGroupPosition(pos); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs new file mode 100644 index 0000000..43ac558 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using Nini.Config; | ||
30 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
34 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
35 | using OpenSim.Region.CoreModules.World.Land; | ||
36 | using OpenSim.Region.OptionalModules; | ||
37 | using OpenSim.Tests.Common; | ||
38 | using OpenSim.Tests.Common.Mock; | ||
39 | |||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
41 | { | ||
42 | public class SceneObjectCrossingTests : OpenSimTestCase | ||
43 | { | ||
44 | [TestFixtureSetUp] | ||
45 | public void FixtureInit() | ||
46 | { | ||
47 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
48 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
49 | } | ||
50 | |||
51 | [TestFixtureTearDown] | ||
52 | public void TearDown() | ||
53 | { | ||
54 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
55 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
56 | // tests really shouldn't). | ||
57 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Test cross with no prim limit module. | ||
62 | /// </summary> | ||
63 | [Test] | ||
64 | public void TestCrossOnSameSimulator() | ||
65 | { | ||
66 | TestHelpers.InMethod(); | ||
67 | TestHelpers.EnableLogging(); | ||
68 | |||
69 | UUID userId = TestHelpers.ParseTail(0x1); | ||
70 | int sceneObjectIdTail = 0x2; | ||
71 | |||
72 | EntityTransferModule etmA = new EntityTransferModule(); | ||
73 | EntityTransferModule etmB = new EntityTransferModule(); | ||
74 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
75 | |||
76 | IConfigSource config = new IniConfigSource(); | ||
77 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
78 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
79 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
80 | // IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | ||
81 | |||
82 | SceneHelpers sh = new SceneHelpers(); | ||
83 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
84 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999); | ||
85 | |||
86 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
87 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
88 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
89 | |||
90 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); | ||
91 | UUID so1Id = so1.UUID; | ||
92 | so1.AbsolutePosition = new Vector3(128, 10, 20); | ||
93 | |||
94 | // Cross with a negative value | ||
95 | so1.AbsolutePosition = new Vector3(128, -10, 20); | ||
96 | |||
97 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id)); | ||
98 | Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id)); | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// Test cross with no prim limit module. | ||
103 | /// </summary> | ||
104 | /// <remarks> | ||
105 | /// XXX: This test may be better off in a specific PrimLimitsModuleTest class in optional module tests in the | ||
106 | /// future (though it is configured as active by default, so not really optional). | ||
107 | /// </remarks> | ||
108 | [Test] | ||
109 | public void TestCrossOnSameSimulatorPrimLimitsOkay() | ||
110 | { | ||
111 | TestHelpers.InMethod(); | ||
112 | TestHelpers.EnableLogging(); | ||
113 | |||
114 | UUID userId = TestHelpers.ParseTail(0x1); | ||
115 | int sceneObjectIdTail = 0x2; | ||
116 | |||
117 | EntityTransferModule etmA = new EntityTransferModule(); | ||
118 | EntityTransferModule etmB = new EntityTransferModule(); | ||
119 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
120 | LandManagementModule lmmA = new LandManagementModule(); | ||
121 | LandManagementModule lmmB = new LandManagementModule(); | ||
122 | |||
123 | IConfigSource config = new IniConfigSource(); | ||
124 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
125 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
126 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
127 | |||
128 | // Remove? | ||
129 | // IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | ||
130 | |||
131 | IConfig permissionsConfig = config.AddConfig("Permissions"); | ||
132 | permissionsConfig.Set("permissionmodules", "PrimLimitsModule"); | ||
133 | |||
134 | SceneHelpers sh = new SceneHelpers(); | ||
135 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
136 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999); | ||
137 | |||
138 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
139 | SceneHelpers.SetupSceneModules( | ||
140 | sceneA, config, etmA, lmmA, new PrimLimitsModule(), new PrimCountModule()); | ||
141 | SceneHelpers.SetupSceneModules( | ||
142 | sceneB, config, etmB, lmmB, new PrimLimitsModule(), new PrimCountModule()); | ||
143 | |||
144 | // We must set up the parcel for this to work. Normally this is taken care of by OpenSimulator startup | ||
145 | // code which is not yet easily invoked by tests. | ||
146 | lmmA.EventManagerOnNoLandDataFromStorage(); | ||
147 | lmmB.EventManagerOnNoLandDataFromStorage(); | ||
148 | |||
149 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); | ||
150 | UUID so1Id = so1.UUID; | ||
151 | so1.AbsolutePosition = new Vector3(128, 10, 20); | ||
152 | |||
153 | // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly | ||
154 | // because only this will execute permission checks in the source region. | ||
155 | sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId); | ||
156 | |||
157 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id)); | ||
158 | Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id)); | ||
159 | } | ||
160 | } | ||
161 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 8b4d231..18cec6c 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | |||
@@ -58,8 +58,6 @@ namespace OpenSim.Region.OptionalModules | |||
58 | 58 | ||
59 | public void Initialise(IConfigSource config) | 59 | public void Initialise(IConfigSource config) |
60 | { | 60 | { |
61 | //IConfig myConfig = config.Configs["Startup"]; | ||
62 | |||
63 | string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules", | 61 | string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules", |
64 | new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); | 62 | new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); |
65 | 63 | ||
@@ -129,6 +127,11 @@ namespace OpenSim.Region.OptionalModules | |||
129 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | 127 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); |
130 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); | 128 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); |
131 | 129 | ||
130 | // newParcel will be null only if it outside of our current region. If this is the case, then the | ||
131 | // receiving permissions will perform the check. | ||
132 | if (newParcel == null) | ||
133 | return true; | ||
134 | |||
132 | int usedPrims = newParcel.PrimCounts.Total; | 135 | int usedPrims = newParcel.PrimCounts.Total; |
133 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); | 136 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); |
134 | 137 | ||