diff options
author | UbitUmarov | 2017-04-03 16:10:05 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-03 16:10:05 +0100 |
commit | eb11505d19be8c2b22776d927ac5b836bd5493c3 (patch) | |
tree | 03da3c94975e7be7ba6760e64d7687afd565d53e /OpenSim | |
parent | store the physics inertia override in SQlite (diff) | |
download | opensim-SC_OLD-eb11505d19be8c2b22776d927ac5b836bd5493c3.zip opensim-SC_OLD-eb11505d19be8c2b22776d927ac5b836bd5493c3.tar.gz opensim-SC_OLD-eb11505d19be8c2b22776d927ac5b836bd5493c3.tar.bz2 opensim-SC_OLD-eb11505d19be8c2b22776d927ac5b836bd5493c3.tar.xz |
add bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject land) permissions check
Diffstat (limited to '')
3 files changed, 91 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index ab8fb51..8eee864 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -286,6 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
286 | 286 | ||
287 | scenePermissions.OnRezObject += CanRezObject; | 287 | scenePermissions.OnRezObject += CanRezObject; |
288 | scenePermissions.OnObjectEntry += CanObjectEntry; | 288 | scenePermissions.OnObjectEntry += CanObjectEntry; |
289 | scenePermissions.OnObjectEnterWithScripts += OnObjectEnterWithScripts; | ||
289 | 290 | ||
290 | scenePermissions.OnDuplicateObject += CanDuplicateObject; | 291 | scenePermissions.OnDuplicateObject += CanDuplicateObject; |
291 | scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs; | 292 | scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs; |
@@ -381,6 +382,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
381 | 382 | ||
382 | scenePermissions.OnRezObject -= CanRezObject; | 383 | scenePermissions.OnRezObject -= CanRezObject; |
383 | scenePermissions.OnObjectEntry -= CanObjectEntry; | 384 | scenePermissions.OnObjectEntry -= CanObjectEntry; |
385 | scenePermissions.OnObjectEnterWithScripts -= OnObjectEnterWithScripts; | ||
386 | |||
384 | scenePermissions.OnReturnObjects -= CanReturnObjects; | 387 | scenePermissions.OnReturnObjects -= CanReturnObjects; |
385 | 388 | ||
386 | scenePermissions.OnDuplicateObject -= CanDuplicateObject; | 389 | scenePermissions.OnDuplicateObject -= CanDuplicateObject; |
@@ -1627,6 +1630,55 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1627 | return false; | 1630 | return false; |
1628 | } | 1631 | } |
1629 | 1632 | ||
1633 | private bool OnObjectEnterWithScripts(SceneObjectGroup sog, ILandObject parcel) | ||
1634 | { | ||
1635 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1636 | |||
1637 | if(sog == null || sog.IsDeleted) | ||
1638 | return false; | ||
1639 | |||
1640 | if (m_bypassPermissions) | ||
1641 | return m_bypassPermissionsValue; | ||
1642 | |||
1643 | if (parcel == null) | ||
1644 | return true; | ||
1645 | |||
1646 | int checkflags = ((int)ParcelFlags.AllowAPrimitiveEntry); | ||
1647 | bool scripts = (sog.ScriptCount() > 0); | ||
1648 | if(scripts) | ||
1649 | checkflags |= ((int)ParcelFlags.AllowOtherScripts); | ||
1650 | |||
1651 | if ((parcel.LandData.Flags & checkflags) == checkflags) | ||
1652 | return true; | ||
1653 | |||
1654 | UUID userID = sog.OwnerID; | ||
1655 | LandData landdata = parcel.LandData; | ||
1656 | |||
1657 | if (landdata.OwnerID == userID) | ||
1658 | return true; | ||
1659 | |||
1660 | if (IsAdministrator(userID)) | ||
1661 | return true; | ||
1662 | |||
1663 | UUID landGroupID = landdata.GroupID; | ||
1664 | if (landGroupID != UUID.Zero) | ||
1665 | { | ||
1666 | checkflags = (int)ParcelFlags.AllowGroupObjectEntry; | ||
1667 | if(scripts) | ||
1668 | checkflags |= ((int)ParcelFlags.AllowGroupScripts); | ||
1669 | |||
1670 | if ((parcel.LandData.Flags & checkflags) == checkflags) | ||
1671 | return IsGroupMember(landGroupID, userID, 0); | ||
1672 | |||
1673 | if (landdata.IsGroupOwned && IsGroupMember(landGroupID, userID, (ulong)GroupPowers.AllowRez)) | ||
1674 | return true; | ||
1675 | } | ||
1676 | |||
1677 | //Otherwise, false! | ||
1678 | return false; | ||
1679 | } | ||
1680 | |||
1681 | |||
1630 | private bool CanReturnObjects(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects) | 1682 | private bool CanReturnObjects(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects) |
1631 | { | 1683 | { |
1632 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1684 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 7d69a9b..c55a7a6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -56,6 +56,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
56 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID); | 56 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID); |
57 | public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); | 57 | public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
58 | public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint); | 58 | public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint); |
59 | public delegate bool ObjectEnterWithScriptsHandler(SceneObjectGroup sog, ILandObject land); | ||
59 | public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects); | 60 | public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects); |
60 | public delegate bool InstantMessageHandler(UUID user, UUID target); | 61 | public delegate bool InstantMessageHandler(UUID user, UUID target); |
61 | public delegate bool InventoryTransferHandler(UUID user, UUID target); | 62 | public delegate bool InventoryTransferHandler(UUID user, UUID target); |
@@ -135,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
135 | public event EditObjectInventoryHandler OnEditObjectInventory; | 136 | public event EditObjectInventoryHandler OnEditObjectInventory; |
136 | public event MoveObjectHandler OnMoveObject; | 137 | public event MoveObjectHandler OnMoveObject; |
137 | public event ObjectEntryHandler OnObjectEntry; | 138 | public event ObjectEntryHandler OnObjectEntry; |
139 | public event ObjectEnterWithScriptsHandler OnObjectEnterWithScripts; | ||
138 | public event ReturnObjectsHandler OnReturnObjects; | 140 | public event ReturnObjectsHandler OnReturnObjects; |
139 | public event InstantMessageHandler OnInstantMessage; | 141 | public event InstantMessageHandler OnInstantMessage; |
140 | public event InventoryTransferHandler OnInventoryTransfer; | 142 | public event InventoryTransferHandler OnInventoryTransfer; |
@@ -565,6 +567,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
565 | return true; | 567 | return true; |
566 | } | 568 | } |
567 | 569 | ||
570 | public bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject land) | ||
571 | { | ||
572 | ObjectEnterWithScriptsHandler handler = OnObjectEnterWithScripts; | ||
573 | if (handler != null) | ||
574 | { | ||
575 | Delegate[] list = handler.GetInvocationList(); | ||
576 | foreach (ObjectEnterWithScriptsHandler h in list) | ||
577 | { | ||
578 | if (h(sog, land) == false) | ||
579 | return false; | ||
580 | } | ||
581 | } | ||
582 | return true; | ||
583 | } | ||
584 | |||
568 | #endregion | 585 | #endregion |
569 | 586 | ||
570 | #region RETURN OBJECT | 587 | #region RETURN OBJECT |
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index af32d05..61b6d68 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | |||
@@ -83,6 +83,7 @@ namespace OpenSim.Region.OptionalModules | |||
83 | m_scene = scene; | 83 | m_scene = scene; |
84 | scene.Permissions.OnRezObject += CanRezObject; | 84 | scene.Permissions.OnRezObject += CanRezObject; |
85 | scene.Permissions.OnObjectEntry += CanObjectEnter; | 85 | scene.Permissions.OnObjectEntry += CanObjectEnter; |
86 | scene.Permissions.OnObjectEnterWithScripts += CanObjectEnterWithScripts; | ||
86 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 87 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; |
87 | 88 | ||
88 | m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); | 89 | m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); |
@@ -95,6 +96,7 @@ namespace OpenSim.Region.OptionalModules | |||
95 | 96 | ||
96 | m_scene.Permissions.OnRezObject -= CanRezObject; | 97 | m_scene.Permissions.OnRezObject -= CanRezObject; |
97 | m_scene.Permissions.OnObjectEntry -= CanObjectEnter; | 98 | m_scene.Permissions.OnObjectEntry -= CanObjectEnter; |
99 | scene.Permissions.OnObjectEnterWithScripts -= CanObjectEnterWithScripts; | ||
98 | m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject; | 100 | m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject; |
99 | } | 101 | } |
100 | 102 | ||
@@ -173,6 +175,26 @@ namespace OpenSim.Region.OptionalModules | |||
173 | return true; | 175 | return true; |
174 | } | 176 | } |
175 | 177 | ||
178 | private bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject newParcel) | ||
179 | { | ||
180 | if (sog == null) | ||
181 | return false; | ||
182 | |||
183 | if (newParcel == null) | ||
184 | return true; | ||
185 | |||
186 | int objectCount = sog.PrimCount; | ||
187 | |||
188 | // TODO: Add Special Case here for temporary prims | ||
189 | |||
190 | string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel); | ||
191 | |||
192 | if (response != null) | ||
193 | return false; | ||
194 | |||
195 | return true; | ||
196 | } | ||
197 | |||
176 | private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo) | 198 | private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo) |
177 | { | 199 | { |
178 | string response = null; | 200 | string response = null; |