From 321de1f2636b5c83c43d03d9364efc325db0a6b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 22 Mar 2012 20:25:20 +0000 Subject: [PATCH] Rework Diva's patch to simplify it --- OpenSim/Framework/ILandObject.cs | 1 + .../CoreModules/World/Land/LandObject.cs | 33 +++++++++++-------- .../World/Permissions/PermissionsModule.cs | 12 +++++-- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index dd73b3fe01..4f98d7bb30 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -71,6 +71,7 @@ namespace OpenSim.Framework bool IsEitherBannedOrRestricted(UUID avatar); bool IsBannedFromLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar); + bool IsInLandAccessList(UUID avatar); void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); List CreateAccessListArrayByFlag(AccessList flag); diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index cc42f7f493..27f0052572 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -448,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land public bool IsRestrictedFromLand(UUID avatar) { - ExpireAccessList(); - if (m_scene.Permissions.IsAdministrator(avatar)) return false; @@ -459,20 +457,27 @@ namespace OpenSim.Region.CoreModules.World.Land if (avatar == LandData.OwnerID) return false; - if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) + if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) + return true; + + return (!IsInLandAccessList(avatar)); + } + + public bool IsInLandAccessList(UUID avatar) + { + ExpireAccessList(); + + if (LandData.ParcelAccessList.FindIndex( + delegate(LandAccessEntry e) + { + if (e.AgentID == avatar && e.Flags == AccessList.Access) + return true; + return false; + }) == -1) { - if (LandData.ParcelAccessList.FindIndex( - delegate(LandAccessEntry e) - { - if (e.AgentID == avatar && e.Flags == AccessList.Access) - return true; - return false; - }) == -1) - { - return true; - } + return false; } - return false; + return true; } public void SendLandUpdateToClient(IClientAPI remote_client) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 702398481e..cd5ed2391a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions private bool m_RegionOwnerIsGod = false; private bool m_RegionManagerIsGod = false; private bool m_ParcelOwnerIsGod = false; - + + private bool m_SimpleBuildPermissions = false; + /// /// The set of users that are allowed to create scripts. This is only active if permissions are not being /// bypassed. This overrides normal permissions. @@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); - + + m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); + m_allowedScriptCreators = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); m_allowedScriptEditors @@ -824,6 +828,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions permission = true; } + if (m_SimpleBuildPermissions && + (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user)) + permission = true; + return permission; }