diff options
author | UbitUmarov | 2017-01-20 14:26:24 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-20 14:26:24 +0000 |
commit | dac32c4e5acd76a3b42dede1c573dbef1a98c7e1 (patch) | |
tree | e438948fdf10696c2dc98632c18849a76828fe00 | |
parent | remove redundant IsGod, rename some GOD as Administrator (both only on permis... (diff) | |
download | opensim-SC_OLD-dac32c4e5acd76a3b42dede1c573dbef1a98c7e1.zip opensim-SC_OLD-dac32c4e5acd76a3b42dede1c573dbef1a98c7e1.tar.gz opensim-SC_OLD-dac32c4e5acd76a3b42dede1c573dbef1a98c7e1.tar.bz2 opensim-SC_OLD-dac32c4e5acd76a3b42dede1c573dbef1a98c7e1.tar.xz |
change CanObjectEntry() to use a SOG
7 files changed, 40 insertions, 51 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6dc982b..92485a1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -2620,7 +2620,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2620 | { | 2620 | { |
2621 | // FIXME: It would be better to never add the scene object at all rather than add it and then delete | 2621 | // FIXME: It would be better to never add the scene object at all rather than add it and then delete |
2622 | // it | 2622 | // it |
2623 | if (!Scene.Permissions.CanObjectEntry(so.UUID, true, so.AbsolutePosition)) | 2623 | if (!Scene.Permissions.CanObjectEntry(so, true, so.AbsolutePosition)) |
2624 | { | 2624 | { |
2625 | // Deny non attachments based on parcel settings | 2625 | // Deny non attachments based on parcel settings |
2626 | // | 2626 | // |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 79308b4..95a007a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -1437,42 +1437,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1437 | return true; | 1437 | return true; |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | private bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) | 1440 | private bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene) |
1441 | { | 1441 | { |
1442 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1442 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1443 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1444 | |||
1445 | // allow outide region this mb needed for crossings ??? | ||
1446 | if (newPoint.X < -1f || newPoint.Y < -1f) | ||
1447 | return true; | ||
1448 | if (newPoint.X > scene.RegionInfo.RegionSizeX + 1.0f || newPoint.Y > scene.RegionInfo.RegionSizeY + 1.0f) | ||
1449 | return true; | ||
1450 | 1443 | ||
1451 | ILandObject parcel = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); | 1444 | if(sog == null || sog.IsDeleted) |
1452 | if (parcel == null) | ||
1453 | return false; | 1445 | return false; |
1454 | 1446 | ||
1455 | if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0) | 1447 | float newX = newPoint.X; |
1448 | float newY = newPoint.Y; | ||
1449 | |||
1450 | // allow outside region this mb needed for crossings | ||
1451 | if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) || | ||
1452 | newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) ) | ||
1456 | return true; | 1453 | return true; |
1457 | 1454 | ||
1458 | EntityBase ent = null; | 1455 | if (m_bypassPermissions) |
1459 | if (!m_scene.Entities.TryGetValue(objectID, out ent)) | 1456 | return m_bypassPermissionsValue; |
1460 | return false; | ||
1461 | 1457 | ||
1462 | if(ent == null || !(ent is SceneObjectGroup)) | 1458 | ILandObject parcel = scene.LandChannel.GetLandObject(newX, newY); |
1459 | if (parcel == null) | ||
1463 | return false; | 1460 | return false; |
1464 | 1461 | ||
1465 | SceneObjectGroup task = (SceneObjectGroup)ent; | 1462 | if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0) |
1463 | return true; | ||
1466 | 1464 | ||
1467 | if (!enteringRegion) | 1465 | if (!enteringRegion) |
1468 | { | 1466 | { |
1469 | ILandObject fromparcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); | 1467 | Vector3 oldPoint = sog.AbsolutePosition; |
1470 | 1468 | ILandObject fromparcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | |
1471 | if (fromparcel == parcel) // it already entered parcel ???? | 1469 | if (fromparcel != null && fromparcel.Equals(parcel)) // it already entered parcel ???? |
1472 | return true; | 1470 | return true; |
1473 | } | 1471 | } |
1474 | 1472 | ||
1475 | if (GenericParcelPermission(task.OwnerID, parcel, 0)) | 1473 | if (GenericParcelPermission(sog.OwnerID, parcel, 0)) |
1476 | return true; | 1474 | return true; |
1477 | 1475 | ||
1478 | //Otherwise, false! | 1476 | //Otherwise, false! |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 9845418..6925b6c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
52 | public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp); | 52 | public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
53 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); | 53 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); |
54 | public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); | 54 | public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
55 | public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); | 55 | public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene); |
56 | public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene); | 56 | public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene); |
57 | public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene); | 57 | public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene); |
58 | public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene); | 58 | public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene); |
@@ -504,7 +504,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
504 | #endregion | 504 | #endregion |
505 | 505 | ||
506 | #region OBJECT ENTRY | 506 | #region OBJECT ENTRY |
507 | public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint) | 507 | public bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint) |
508 | { | 508 | { |
509 | ObjectEntryHandler handler = OnObjectEntry; | 509 | ObjectEntryHandler handler = OnObjectEntry; |
510 | if (handler != null) | 510 | if (handler != null) |
@@ -512,7 +512,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
512 | Delegate[] list = handler.GetInvocationList(); | 512 | Delegate[] list = handler.GetInvocationList(); |
513 | foreach (ObjectEntryHandler h in list) | 513 | foreach (ObjectEntryHandler h in list) |
514 | { | 514 | { |
515 | if (h(objectID, enteringRegion, newPoint, m_scene) == false) | 515 | if (h(sog, enteringRegion, newPoint, m_scene) == false) |
516 | return false; | 516 | return false; |
517 | } | 517 | } |
518 | } | 518 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 9264138..8fc438d 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1579,7 +1579,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1579 | else | 1579 | else |
1580 | { | 1580 | { |
1581 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) | 1581 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) |
1582 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) | 1582 | && m_parentScene.Permissions.CanObjectEntry(group, false, pos)) |
1583 | { | 1583 | { |
1584 | group.UpdateGroupPosition(pos); | 1584 | group.UpdateGroupPosition(pos); |
1585 | } | 1585 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d14c450..83c5db4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -4656,7 +4656,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4656 | } | 4656 | } |
4657 | if ((change & ObjectChangeType.Position) != 0) | 4657 | if ((change & ObjectChangeType.Position) != 0) |
4658 | { | 4658 | { |
4659 | if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position)) | 4659 | if (IsAttachment || m_scene.Permissions.CanObjectEntry(group, false, data.position)) |
4660 | UpdateGroupPosition(data.position); | 4660 | UpdateGroupPosition(data.position); |
4661 | updateType = updatetype.groupterse; | 4661 | updateType = updatetype.groupterse; |
4662 | } | 4662 | } |
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 4875a61..9c0d801 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | |||
@@ -135,50 +135,41 @@ namespace OpenSim.Region.OptionalModules | |||
135 | return true; | 135 | return true; |
136 | } | 136 | } |
137 | 137 | ||
138 | private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) | 138 | private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene) |
139 | { | 139 | { |
140 | if (newPoint.X < -1f || newPoint.X > (scene.RegionInfo.RegionSizeX + 1) || | 140 | float newX = newPoint.X; |
141 | newPoint.Y < -1f || newPoint.Y > (scene.RegionInfo.RegionSizeY) ) | 141 | float newY = newPoint.Y; |
142 | if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) || | ||
143 | newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) ) | ||
142 | return true; | 144 | return true; |
143 | 145 | ||
144 | SceneObjectPart obj = scene.GetSceneObjectPart(objectID); | 146 | if (sog == null) |
145 | |||
146 | if (obj == null) | ||
147 | return false; | 147 | return false; |
148 | 148 | ||
149 | // Prim counts are determined by the location of the root prim. if we're | 149 | ILandObject newParcel = scene.LandChannel.GetLandObject(newX, newY); |
150 | // moving a child prim, just let it pass | ||
151 | if (!obj.IsRoot) | ||
152 | { | ||
153 | return true; | ||
154 | } | ||
155 | |||
156 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); | ||
157 | 150 | ||
158 | if (newParcel == null) | 151 | if (newParcel == null) |
159 | return true; | 152 | return true; |
160 | 153 | ||
161 | Vector3 oldPoint = obj.GroupPosition; | 154 | if(!enteringRegion) |
162 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | ||
163 | |||
164 | // The prim hasn't crossed a region boundry so we don't need to worry | ||
165 | // about prim counts here | ||
166 | if(oldParcel != null && oldParcel.Equals(newParcel)) | ||
167 | { | 155 | { |
168 | return true; | 156 | Vector3 oldPoint = sog.AbsolutePosition; |
157 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | ||
158 | if(oldParcel != null && oldParcel.Equals(newParcel)) | ||
159 | return true; | ||
169 | } | 160 | } |
170 | 161 | ||
171 | int objectCount = obj.ParentGroup.PrimCount; | 162 | int objectCount = sog.PrimCount; |
172 | int usedPrims = newParcel.PrimCounts.Total; | 163 | int usedPrims = newParcel.PrimCounts.Total; |
173 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); | 164 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); |
174 | 165 | ||
175 | // TODO: Add Special Case here for temporary prims | 166 | // TODO: Add Special Case here for temporary prims |
176 | 167 | ||
177 | string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene); | 168 | string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel, scene); |
178 | 169 | ||
179 | if (response != null) | 170 | if (response != null) |
180 | { | 171 | { |
181 | m_dialogModule.SendAlertToUser(obj.OwnerID, response); | 172 | m_dialogModule.SendAlertToUser(sog.OwnerID, response); |
182 | return false; | 173 | return false; |
183 | } | 174 | } |
184 | return true; | 175 | return true; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 45bdb41..3cdf49c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2722,7 +2722,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2722 | if (part.ParentGroup.RootPart == part) | 2722 | if (part.ParentGroup.RootPart == part) |
2723 | { | 2723 | { |
2724 | SceneObjectGroup parent = part.ParentGroup; | 2724 | SceneObjectGroup parent = part.ParentGroup; |
2725 | if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent.UUID, false, (Vector3)toPos)) | 2725 | if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent, false, (Vector3)toPos)) |
2726 | return; | 2726 | return; |
2727 | parent.UpdateGroupPosition((Vector3)toPos); | 2727 | parent.UpdateGroupPosition((Vector3)toPos); |
2728 | } | 2728 | } |