From 696b6c727ffc15c47b6be06e6fb4ae750fe61e6b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 29 Jul 2010 16:33:20 +0200 Subject: [PATCH] Allow gods and estate managers/owners to be unaffected by parcel bans --- .../Region/CoreModules/World/Land/LandObject.cs | 6 ++++++ .../World/Permissions/PermissionsModule.cs | 1 + .../Framework/Scenes/Scene.Permissions.cs | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 2a87da28bb..6864629bb2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -283,6 +283,9 @@ namespace OpenSim.Region.CoreModules.World.Land public bool IsBannedFromLand(UUID avatar) { + if (m_scene.Permissions.IsAdministrator(avatar)) + return false; + if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); @@ -301,6 +304,9 @@ namespace OpenSim.Region.CoreModules.World.Land public bool IsRestrictedFromLand(UUID avatar) { + if (m_scene.Permissions.IsAdministrator(avatar)) + return false; + if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 69b247c350..1d705460c9 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -209,6 +209,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnDeedParcel += CanDeedParcel; m_scene.Permissions.OnDeedObject += CanDeedObject; m_scene.Permissions.OnIsGod += IsGod; + m_scene.Permissions.OnIsAdministrator += IsAdministrator; m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 7dab04fbd2..a52335116c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); 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 SellParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); @@ -122,6 +123,7 @@ namespace OpenSim.Region.Framework.Scenes public event RunConsoleCommandHandler OnRunConsoleCommand; public event IssueEstateCommandHandler OnIssueEstateCommand; public event IsGodHandler OnIsGod; + public event IsAdministratorHandler OnIsAdministrator; public event EditParcelHandler OnEditParcel; public event SellParcelHandler OnSellParcel; public event AbandonParcelHandler OnAbandonParcel; @@ -652,6 +654,21 @@ namespace OpenSim.Region.Framework.Scenes } return true; } + + public bool IsAdministrator(UUID user) + { + IsAdministratorHandler handler = OnIsAdministrator; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (IsAdministratorHandler h in list) + { + if (h(user) == false) + return false; + } + } + return true; + } #endregion #region EDIT PARCEL