From d36b880022b5efcd1c6d98d94a868575d2f6f184 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 13 Dec 2010 11:13:34 +0100 Subject: [PATCH] Change some lookups in he Land Management module to make group permissions work better. Add a generic group permissions hoot to the scene permissions system. --- .../World/Land/LandManagementModule.cs | 8 ++++---- .../Framework/Scenes/Scene.Permissions.cs | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 9779c684d0..2554995041 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1624,7 +1624,7 @@ namespace OpenSim.Region.CoreModules.World.Land ScenePresence SP; ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); List returns = new List(); - if (SP.GodLevel != 0) + if (SP.UserLevel != 0) { if (flags == 0) //All parcels, scripted or not { @@ -1692,7 +1692,7 @@ namespace OpenSim.Region.CoreModules.World.Land ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); System.Threading.Timer Timer; - if (targetAvatar.GodLevel == 0) + if (targetAvatar.UserLevel == 0) { ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.CoreModules.World.Land //Just eject if (flags == 0) { - if (targetAvatar.GodLevel == 0) + if (targetAvatar.UserLevel == 0) { ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) @@ -1816,7 +1816,7 @@ namespace OpenSim.Region.CoreModules.World.Land //Eject and ban if (flags == 1) { - if (targetAvatar.GodLevel == 0) + if (targetAvatar.UserLevel == 0) { ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index d67638ad1f..ab0eed8449 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -68,6 +68,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool IsGodHandler(UUID user, Scene requestFromScene); public delegate bool IsAdministratorHandler(UUID user); public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); + public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); @@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Scenes public event IsGodHandler OnIsGod; public event IsAdministratorHandler OnIsAdministrator; public event EditParcelHandler OnEditParcel; + public event EditParcelPropertiesHandler OnEditParcelProperties; public event SellParcelHandler OnSellParcel; public event AbandonParcelHandler OnAbandonParcel; public event ReclaimParcelHandler OnReclaimParcel; @@ -734,6 +736,21 @@ namespace OpenSim.Region.Framework.Scenes } return true; } + + public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p) + { + EditParcelPropertiesHandler handler = OnEditParcelProperties; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (EditParcelPropertiesHandler h in list) + { + if (h(user, parcel, p, m_scene) == false) + return false; + } + } + return true; + } #endregion #region SELL PARCEL @@ -1043,4 +1060,4 @@ namespace OpenSim.Region.Framework.Scenes return true; } } -} \ No newline at end of file +}