From f3f7d603675ac15d6397b50591b598aacc932862 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 24 May 2009 16:11:35 +0000 Subject: [PATCH] Add a new permissions check for bulk object returns. --- .../Region/CoreModules/World/Land/LandObject.cs | 3 +++ .../World/Permissions/PermissionsModule.cs | 9 +++++++++ .../Framework/Scenes/Scene.Permissions.cs | 17 +++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index ce66e463f9..ccb3a47dc4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -795,6 +795,9 @@ namespace OpenSim.Region.CoreModules.World.Land Dictionary> returns = new Dictionary>(); + if (!m_scene.Permissions.CanUseObjectReturn(this, type, remote_client)) + return; + lock (primsOverMe) { if (type == (uint)ObjectReturnType.Owner) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 46a0da2815..6beb6d37fd 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -168,6 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED + m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED m_scene.AddCommand(this, "bypass permissions", "bypass permissions ", @@ -1523,5 +1524,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions // You can reset the scripts in any object you can edit return GenericObjectPermission(agentID, prim, false); } + + private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + return GenericParcelPermission(client.AgentId, parcel); + } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 29a6cd2c46..731f12423c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -79,6 +79,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID); public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); public delegate bool TeleportHandler(UUID userID, Scene scene); + public delegate bool UseObjectReturnHandler(ILandObject landData, uint type, IClientAPI client, Scene scene); #endregion public class ScenePermissions @@ -135,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes public event CopyUserInventoryHandler OnCopyUserInventory; public event DeleteUserInventoryHandler OnDeleteUserInventory; public event TeleportHandler OnTeleport; + public event UseObjectReturnHandler OnUseObjectReturn; #endregion #region Object Permission Checks @@ -910,5 +912,20 @@ namespace OpenSim.Region.Framework.Scenes } return true; } + + public bool CanUseObjectReturn(ILandObject landData, uint type , IClientAPI client) + { + UseObjectReturnHandler handler = OnUseObjectReturn; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (UseObjectReturnHandler h in list) + { + if (h(landData, type, client, m_scene) == false) + return false; + } + } + return true; + } } }