aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2017-01-19 12:35:00 +0000
committerUbitUmarov2017-01-19 12:35:00 +0000
commit673bd3721948b376d6be14e346d616863ca943cf (patch)
treec6ddbb14830cffd04122d5c90cdc929a88c8e8ab /OpenSim/Region
parentobject Take and TakeCopy are for in scene SOPs and SPs and permitions module ... (diff)
downloadopensim-SC-673bd3721948b376d6be14e346d616863ca943cf.zip
opensim-SC-673bd3721948b376d6be14e346d616863ca943cf.tar.gz
opensim-SC-673bd3721948b376d6be14e346d616863ca943cf.tar.bz2
opensim-SC-673bd3721948b376d6be14e346d616863ca943cf.tar.xz
object CanMove is for in scene SOGs Icleints and SPs and permitions module is NOT a shared module
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs13
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs61
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs37
5 files changed, 57 insertions, 81 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 3f310c7..4f62827 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1420,28 +1420,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1420 return GenericEstatePermission(user); 1420 return GenericEstatePermission(user);
1421 } 1421 }
1422 1422
1423 private bool CanMoveObject(UUID objectID, UUID moverID, Scene scene) 1423 private bool CanMoveObject(SceneObjectGroup sog, ScenePresence sp)
1424 { 1424 {
1425 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1425 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1426
1427 if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
1428 return false;
1429
1426 if (m_bypassPermissions) 1430 if (m_bypassPermissions)
1427 { 1431 {
1428 SceneObjectPart part = scene.GetSceneObjectPart(objectID); 1432 if (sog.OwnerID != sp.UUID && sog.IsAttachment)
1429 if(part == null)
1430 return false; 1433 return false;
1431
1432 if (part.OwnerID != moverID)
1433 {
1434 if (part.ParentGroup.IsDeleted || part.ParentGroup.IsAttachment)
1435 return false;
1436 }
1437 return m_bypassPermissionsValue; 1434 return m_bypassPermissionsValue;
1438 } 1435 }
1439 1436
1440 SceneObjectGroup sog = scene.GetGroupByPrim(objectID); 1437 uint perms = GetObjectPermissions(sp, sog, true);
1441 if (sog == null)
1442 return false;
1443
1444 uint perms = GetObjectPermissions(moverID, sog, true);
1445 if((perms & (uint)PermissionMask.Move) == 0) 1438 if((perms & (uint)PermissionMask.Move) == 0)
1446 return false; 1439 return false;
1447 return true; 1440 return true;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index f2d853d..940f80c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -325,7 +325,7 @@ namespace OpenSim.Region.Framework.Scenes
325 if(group == null || group.IsDeleted) 325 if(group == null || group.IsDeleted)
326 return; 326 return;
327 327
328 if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) 328 if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
329 { 329 {
330 group.GrabMovement(objectID, offset, pos, remoteClient); 330 group.GrabMovement(objectID, offset, pos, remoteClient);
331 } 331 }
@@ -386,7 +386,7 @@ namespace OpenSim.Region.Framework.Scenes
386 SceneObjectGroup group = GetGroupByPrim(objectID); 386 SceneObjectGroup group = GetGroupByPrim(objectID);
387 if (group != null) 387 if (group != null)
388 { 388 {
389 if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) 389 if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
390 { 390 {
391 group.SpinStart(remoteClient); 391 group.SpinStart(remoteClient);
392 } 392 }
@@ -404,7 +404,7 @@ namespace OpenSim.Region.Framework.Scenes
404 SceneObjectGroup group = GetGroupByPrim(objectID); 404 SceneObjectGroup group = GetGroupByPrim(objectID);
405 if (group != null) 405 if (group != null)
406 { 406 {
407 if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) 407 if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
408 { 408 {
409 group.SpinMovement(rotation, remoteClient); 409 group.SpinMovement(rotation, remoteClient);
410 } 410 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 8194606..b2801ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes
50 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); 50 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
51 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene); 51 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
52 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); 52 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
53 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene); 53 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
54 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); 54 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
55 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene); 55 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene);
56 public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene); 56 public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
@@ -450,15 +450,22 @@ namespace OpenSim.Region.Framework.Scenes
450 #endregion 450 #endregion
451 451
452 #region MOVE OBJECT 452 #region MOVE OBJECT
453 public bool CanMoveObject(UUID objectID, UUID moverID) 453 public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
454 { 454 {
455 if(sog == null || client == null)
456 return false;
457
458 ScenePresence sp = client.SceneAgent as ScenePresence;
459 if(sp == null)
460 return false;
461
455 MoveObjectHandler handler = OnMoveObject; 462 MoveObjectHandler handler = OnMoveObject;
456 if (handler != null) 463 if (handler != null)
457 { 464 {
458 Delegate[] list = handler.GetInvocationList(); 465 Delegate[] list = handler.GetInvocationList();
459 foreach (MoveObjectHandler h in list) 466 foreach (MoveObjectHandler h in list)
460 { 467 {
461 if (h(objectID, moverID, m_scene) == false) 468 if (h(sog, sp) == false)
462 return false; 469 return false;
463 } 470 }
464 } 471 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 7a97bfc..ba2ee04 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1379,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes
1379 if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0) 1379 if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0)
1380 { 1380 {
1381 // Are we allowed to move it? 1381 // Are we allowed to move it?
1382 if (m_parentScene.Permissions.CanMoveObject(grp.UUID, remoteClient.AgentId)) 1382 if (m_parentScene.Permissions.CanMoveObject(grp, remoteClient))
1383 { 1383 {
1384 // Strip all but move and rotation from request 1384 // Strip all but move and rotation from request
1385 data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation); 1385 data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation);
@@ -1474,7 +1474,7 @@ namespace OpenSim.Region.Framework.Scenes
1474 SceneObjectGroup group = GetGroupByPrim(localID); 1474 SceneObjectGroup group = GetGroupByPrim(localID);
1475 if (group != null) 1475 if (group != null)
1476 { 1476 {
1477 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1477 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1478 { 1478 {
1479 group.UpdateSingleRotation(rot, localID); 1479 group.UpdateSingleRotation(rot, localID);
1480 } 1480 }
@@ -1492,7 +1492,7 @@ namespace OpenSim.Region.Framework.Scenes
1492 SceneObjectGroup group = GetGroupByPrim(localID); 1492 SceneObjectGroup group = GetGroupByPrim(localID);
1493 if (group != null) 1493 if (group != null)
1494 { 1494 {
1495 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1495 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1496 { 1496 {
1497 group.UpdateSingleRotation(rot, pos, localID); 1497 group.UpdateSingleRotation(rot, pos, localID);
1498 } 1498 }
@@ -1510,7 +1510,7 @@ namespace OpenSim.Region.Framework.Scenes
1510 SceneObjectGroup group = GetGroupByPrim(localID); 1510 SceneObjectGroup group = GetGroupByPrim(localID);
1511 if (group != null) 1511 if (group != null)
1512 { 1512 {
1513 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1513 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1514 { 1514 {
1515 group.UpdateGroupRotationR(rot); 1515 group.UpdateGroupRotationR(rot);
1516 } 1516 }
@@ -1529,7 +1529,7 @@ namespace OpenSim.Region.Framework.Scenes
1529 SceneObjectGroup group = GetGroupByPrim(localID); 1529 SceneObjectGroup group = GetGroupByPrim(localID);
1530 if (group != null) 1530 if (group != null)
1531 { 1531 {
1532 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1532 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1533 { 1533 {
1534 group.UpdateGroupRotationPR(pos, rot); 1534 group.UpdateGroupRotationPR(pos, rot);
1535 } 1535 }
@@ -1547,7 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes
1547 SceneObjectGroup group = GetGroupByPrim(localID); 1547 SceneObjectGroup group = GetGroupByPrim(localID);
1548 if (group != null) 1548 if (group != null)
1549 { 1549 {
1550 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) 1550 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) || group.IsAttachment)
1551 { 1551 {
1552 group.UpdateSinglePosition(pos, localID); 1552 group.UpdateSinglePosition(pos, localID);
1553 } 1553 }
@@ -1562,17 +1562,6 @@ namespace OpenSim.Region.Framework.Scenes
1562 /// <param name="remoteClient"></param> 1562 /// <param name="remoteClient"></param>
1563 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) 1563 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient)
1564 { 1564 {
1565 UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId);
1566 }
1567
1568 /// <summary>
1569 /// Update the position of the given group.
1570 /// </summary>
1571 /// <param name="localId"></param>
1572 /// <param name="pos"></param>
1573 /// <param name="updatingAgentId"></param>
1574 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId)
1575 {
1576 SceneObjectGroup group = GetGroupByPrim(localId); 1565 SceneObjectGroup group = GetGroupByPrim(localId);
1577 1566
1578 if (group != null) 1567 if (group != null)
@@ -1589,7 +1578,7 @@ namespace OpenSim.Region.Framework.Scenes
1589 } 1578 }
1590 else 1579 else
1591 { 1580 {
1592 if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId) 1581 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)
1593 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) 1582 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
1594 { 1583 {
1595 group.UpdateGroupPosition(pos); 1584 group.UpdateGroupPosition(pos);
@@ -2025,27 +2014,9 @@ namespace OpenSim.Region.Framework.Scenes
2025 2014
2026 protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) 2015 protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
2027 { 2016 {
2028 UUID user = remoteClient.AgentId; 2017 SceneObjectGroup sog = GetGroupByPrim(localID);
2029 UUID objid = UUID.Zero; 2018 if(sog == null)
2030 SceneObjectPart obj = null; 2019 return;
2031
2032 EntityBase[] entityList = GetEntities();
2033 foreach (EntityBase ent in entityList)
2034 {
2035 if (ent is SceneObjectGroup)
2036 {
2037 SceneObjectGroup sog = ent as SceneObjectGroup;
2038
2039 foreach (SceneObjectPart part in sog.Parts)
2040 {
2041 if (part.LocalId == localID)
2042 {
2043 objid = part.UUID;
2044 obj = part;
2045 }
2046 }
2047 }
2048 }
2049 2020
2050 //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints 2021 //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
2051 //aka ObjectFlags.JointWheel = IncludeInSearch 2022 //aka ObjectFlags.JointWheel = IncludeInSearch
@@ -2062,15 +2033,15 @@ namespace OpenSim.Region.Framework.Scenes
2062 // libomv will complain about PrimFlags.JointWheel being 2033 // libomv will complain about PrimFlags.JointWheel being
2063 // deprecated, so we 2034 // deprecated, so we
2064 #pragma warning disable 0612 2035 #pragma warning disable 0612
2065 if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(objid, user)) 2036 if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog.UUID, remoteClient.AgentId))
2066 { 2037 {
2067 obj.ParentGroup.RootPart.AddFlag(PrimFlags.JointWheel); 2038 sog.RootPart.AddFlag(PrimFlags.JointWheel);
2068 obj.ParentGroup.HasGroupChanged = true; 2039 sog.HasGroupChanged = true;
2069 } 2040 }
2070 else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(objid,user)) 2041 else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(sog, remoteClient))
2071 { 2042 {
2072 obj.ParentGroup.RootPart.RemFlag(PrimFlags.JointWheel); 2043 sog.RootPart.RemFlag(PrimFlags.JointWheel);
2073 obj.ParentGroup.HasGroupChanged = true; 2044 sog.HasGroupChanged = true;
2074 } 2045 }
2075 #pragma warning restore 0612 2046 #pragma warning restore 0612
2076 } 2047 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
index e1e973c..abf8c48 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
@@ -157,29 +157,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests
157 157
158 // Cross 158 // Cross
159 sceneA.SceneGraph.UpdatePrimGroupPosition( 159 sceneA.SceneGraph.UpdatePrimGroupPosition(
160 so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId); 160 so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient);
161 161
162 // crossing is async 162 // crossing is async
163 Thread.Sleep(500); 163 Thread.Sleep(500);
164 164
165 SceneObjectGroup so1PostCross; 165 SceneObjectGroup so1PostCross;
166 166
167 { 167 ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId);
168 ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId); 168 Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false");
169 Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false");
170 169
171 ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId); 170 ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId);
172 TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); 171 TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient);
173 sceneBTc.CompleteMovement(); 172 sceneBTc.CompleteMovement();
174 173
175 Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); 174 Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true");
176 Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); 175 Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject);
176
177 Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck");
178 so1PostCross = sceneB.GetSceneObjectGroup(so1Id);
179 Assert.NotNull(so1PostCross);
180 Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount());
177 181
178 Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck");
179 so1PostCross = sceneB.GetSceneObjectGroup(so1Id);
180 Assert.NotNull(so1PostCross);
181 Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount());
182 }
183 182
184 Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition; 183 Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition;
185 184
@@ -187,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
187 186
188 // Recross 187 // Recross
189 sceneB.SceneGraph.UpdatePrimGroupPosition( 188 sceneB.SceneGraph.UpdatePrimGroupPosition(
190 so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId); 189 so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient);
191 190
192 // crossing is async 191 // crossing is async
193 Thread.Sleep(500); 192 Thread.Sleep(500);
@@ -255,13 +254,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
255 lmmA.EventManagerOnNoLandDataFromStorage(); 254 lmmA.EventManagerOnNoLandDataFromStorage();
256 lmmB.EventManagerOnNoLandDataFromStorage(); 255 lmmB.EventManagerOnNoLandDataFromStorage();
257 256
257 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
258 TestClient tc = new TestClient(acd, sceneA);
259 List<TestClient> destinationTestClients = new List<TestClient>();
260 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
261 ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd);
262
258 SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); 263 SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
259 UUID so1Id = so1.UUID; 264 UUID so1Id = so1.UUID;
260 so1.AbsolutePosition = new Vector3(128, 10, 20); 265 so1.AbsolutePosition = new Vector3(128, 10, 20);
261 266
262 // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly 267 // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly
263 // because only this will execute permission checks in the source region. 268 // because only this will execute permission checks in the source region.
264 sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId); 269 sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), sp1SceneA.ControllingClient);
265 270
266 // crossing is async 271 // crossing is async
267 Thread.Sleep(500); 272 Thread.Sleep(500);