From 32ac388363c42a069f6dbc9650c030675da36a83 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 12 May 2009 13:29:38 +0000 Subject: Add permission mechanisms for group deeding land --- .../CoreModules/World/Permissions/PermissionsModule.cs | 18 ++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 874e8b7..46a0da2 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -128,6 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags; m_scene.Permissions.OnAbandonParcel += CanAbandonParcel; m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; + m_scene.Permissions.OnDeedParcel += CanDeedParcel; m_scene.Permissions.OnIsGod += IsGod; m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED @@ -683,6 +684,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions return GenericParcelPermission(user, parcel); } + private bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + if (parcel.landData.OwnerID != user) // Only the owner can deed! + return false; + + ScenePresence sp = scene.GetScenePresence(user); + IClientAPI client = sp.ControllingClient; + + if ((client.GetGroupPowers(parcel.landData.GroupID) & (long)GroupPowers.LandDeed) == 0) + return false; + + return GenericParcelPermission(user, parcel); + } + private bool IsGod(UUID user, Scene scene) { DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 985179c..29a6cd2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -67,6 +67,7 @@ namespace OpenSim.Region.Framework.Scenes 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); + public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool LinkObjectHandler(UUID user, UUID objectID); public delegate bool DelinkObjectHandler(UUID user, UUID objectID); @@ -122,6 +123,7 @@ namespace OpenSim.Region.Framework.Scenes public event SellParcelHandler OnSellParcel; public event AbandonParcelHandler OnAbandonParcel; public event ReclaimParcelHandler OnReclaimParcel; + public event DeedParcelHandler OnDeedParcel; public event BuyLandHandler OnBuyLand; public event LinkObjectHandler OnLinkObject; public event DelinkObjectHandler OnDelinkObject; @@ -696,6 +698,21 @@ namespace OpenSim.Region.Framework.Scenes return true; } + public bool CanDeedParcel(UUID user, ILandObject parcel) + { + DeedParcelHandler handler = OnDeedParcel; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (DeedParcelHandler h in list) + { + if (h(user, parcel, m_scene) == false) + return false; + } + } + return true; + } + public bool CanBuyLand(UUID user, ILandObject parcel) { BuyLandHandler handler = OnBuyLand; -- cgit v1.1