From 32785921d0a4a074b92da0f4ec322cf451a4642f Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 13 May 2008 16:22:57 +0000 Subject: *Complete redo of the permissions module *Removed hardcoded permissions checks *Added permissions checks where needed --- .../Environment/Interfaces/IScenePermissions.cs | 1 + .../Environment/Modules/World/Land/LandChannel.cs | 17 +- .../Modules/World/Land/LandManagementModule.cs | 4 +- .../Environment/Modules/World/Land/LandObject.cs | 82 ++- .../Environment/Modules/World/NPC/NPCAvatar.cs | 2 +- .../Modules/World/Permissions/PermissionsModule.cs | 818 ++++++++++++--------- OpenSim/Region/Environment/Scenes/InnerScene.cs | 29 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 30 +- OpenSim/Region/Environment/Scenes/Scene.cs | 13 +- .../Environment/Scenes/SceneExternalChecks.cs | 378 ++++++---- 10 files changed, 806 insertions(+), 568 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs index 06c6611..bef6b44 100644 --- a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs +++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs @@ -32,6 +32,7 @@ namespace OpenSim.Region.Environment.Interfaces public interface IScenePermissions { bool BypassPermissions { get; set; } + bool BypassPermissionsValue { get; set; } uint GenerateClientFlags(LLUUID user, LLUUID objID); } } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs index 2a28283..b5d5e6e 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs @@ -400,7 +400,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land //If we are still here, then they are subdividing within one piece of land //Check owner - if (startLandObject.landData.ownerID != attempting_user_id) + if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id,startLandObject)) { return; } @@ -469,7 +469,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land { return; } - if (masterLandObject.landData.ownerID != attempting_user_id) + if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id, masterLandObject)) { return; } @@ -655,6 +655,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) { + landList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); } @@ -663,6 +664,18 @@ namespace OpenSim.Region.Environment.Modules.World.Land landList[local_id].sendLandObjectOwners(remote_client); } + public void handleParcelAbandonRequest(int local_id, IClientAPI remote_client) + { + if (landList.ContainsKey(local_id)) + { + if (m_scene.ExternalChecks.ExternalChecksCanAbandonParcel(remote_client.AgentId, landList[local_id])) + { + landList[local_id].landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; + m_scene.Broadcast(SendParcelOverlay); + } + } + + } #endregion #region ILandChannel Members diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index a339ebf..2719a20 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -52,7 +52,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); m_scene.EventManager.OnSignificantClientMovement += landChannel.handleSignificantClientMovement; - lock (m_scene) { m_scene.LandChannel = (ILandChannel) landChannel; @@ -70,8 +69,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(landChannel.handleParcelObjectOwnersRequest); client.OnParcelAccessListRequest += new ParcelAccessListRequest(landChannel.handleParcelAccessRequest); client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(landChannel.handleParcelAccessUpdateRequest); + client.OnParcelAbandonRequest += new ParcelAbandonRequest(landChannel.handleParcelAbandonRequest); } + + public void PostInitialise() { } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 2d3359c..0236e5f 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs @@ -127,12 +127,19 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client) { - if (remote_client.AgentId == landData.ownerID) + if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId,this)) { //Needs later group support LandData newData = landData.Copy(); - newData.authBuyerID = args.AuthBuyerID; + if (args.AuthBuyerID != newData.authBuyerID || args.SalePrice != newData.salePrice) + { + if (m_scene.ExternalChecks.ExternalChecksCanSellParcel(remote_client.AgentId, this)) + { + newData.authBuyerID = args.AuthBuyerID; + newData.salePrice = args.SalePrice; + } + } newData.category = args.Category; newData.landDesc = args.Desc; newData.groupID = args.GroupID; @@ -145,7 +152,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land newData.landFlags = args.ParcelFlags; newData.passHours = args.PassHours; newData.passPrice = args.PassPrice; - newData.salePrice = args.SalePrice; newData.snapshotID = args.SnapshotID; newData.userLocation = args.UserLocation; newData.userLookAt = args.UserLookAt; @@ -587,27 +593,30 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) { - List resultLocalIDs = new List(); - foreach (SceneObjectGroup obj in primsOverMe) + if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this)) { - if (obj.LocalId > 0) + List resultLocalIDs = new List(); + foreach (SceneObjectGroup obj in primsOverMe) { - if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) + if (obj.LocalId > 0) { - resultLocalIDs.Add(obj.LocalId); - } + if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) + { + resultLocalIDs.Add(obj.LocalId); + } // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support // { // } - else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && - obj.OwnerID != remote_client.AgentId) - { - resultLocalIDs.Add(obj.LocalId); + else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && + obj.OwnerID != remote_client.AgentId) + { + resultLocalIDs.Add(obj.LocalId); + } } } - } - remote_client.sendForceClientSelectObjects(resultLocalIDs); + remote_client.sendForceClientSelectObjects(resultLocalIDs); + } } /// @@ -620,32 +629,35 @@ namespace OpenSim.Region.Environment.Modules.World.Land /// public void sendLandObjectOwners(IClientAPI remote_client) { - Dictionary primCount = new Dictionary(); - - foreach (SceneObjectGroup obj in primsOverMe) + if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this)) { - try + Dictionary primCount = new Dictionary(); + + foreach (SceneObjectGroup obj in primsOverMe) { - if (!primCount.ContainsKey(obj.OwnerID)) + try { - primCount.Add(obj.OwnerID, 0); + if (!primCount.ContainsKey(obj.OwnerID)) + { + primCount.Add(obj.OwnerID, 0); + } + } + catch (NullReferenceException) + { + m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); + } + try + { + primCount[obj.OwnerID] += obj.PrimCount; + } + catch (KeyNotFoundException) + { + m_log.Error("[LAND]: Unable to match a prim with it's owner."); } } - catch (NullReferenceException) - { - m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); - } - try - { - primCount[obj.OwnerID] += obj.PrimCount; - } - catch (KeyNotFoundException) - { - m_log.Error("[LAND]: Unable to match a prim with it's owner."); - } - } - remote_client.sendLandObjectOwners(primCount); + remote_client.sendLandObjectOwners(primCount); + } } public Dictionary getLandObjectOwners() diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 64b4079..632b7a6 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event ParcelDivideRequest OnParcelDivideRequest; public event ParcelJoinRequest OnParcelJoinRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; - + public event ParcelAbandonRequest OnParcelAbandonRequest; public event ParcelAccessListRequest OnParcelAccessListRequest; public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; public event ParcelSelectObjects OnParcelSelectObjects; diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 4e31ae6..cead2d8 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs @@ -27,16 +27,23 @@ using libsecondlife; using Nini.Config; - +using System; +using System.Reflection; +using log4net; using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Environment.Modules.Framework; +using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander; using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Modules.World.Permissions { - public class PermissionsModule : IRegionModule, IScenePermissions + public class PermissionsModule : IRegionModule, IScenePermissions, ICommandableModule { protected Scene m_scene; + private readonly Commander m_commander = new Commander("Permissions"); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + #region Constants // These are here for testing. They will be taken out //private uint PERM_ALL = (uint)2147483647; @@ -45,16 +52,89 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions private uint PERM_MOVE = (uint)524288; //private uint PERM_TRANS = (uint)8192; private uint PERM_LOCKED = (uint)540672; - + + #endregion + + #region Bypass Permissions / Debug Permissions Stuff + // Bypasses the permissions engine private bool m_bypassPermissions = false; - + private bool m_bypassPermissionsValue = true; + private bool m_debugPermissions = false; public bool BypassPermissions { get { return m_bypassPermissions; } set { m_bypassPermissions = value; } } + public bool BypassPermissionsValue + { + get { return m_bypassPermissionsValue; } + set { m_bypassPermissionsValue = value; } + } + + public bool DebugPermissions + { + get { return m_debugPermissions; } + set { m_debugPermissions = value; } + } + #endregion + + #region ICommandableModule Members + + public ICommander CommandInterface + { + get { throw new System.NotImplementedException(); } + } + + + private void InterfaceDebugPermissions(Object[] args) + { + if ((bool)args[0] == true) + { + m_debugPermissions = true; + m_log.Info("[PERMISSIONS]: Permissions Debugging Enabled."); + } + else + { + m_debugPermissions = false; + m_log.Info("[PERMISSIONS]: Permissions Debugging Disabled."); + } + } + + private void InterfaceBypassPermissions(Object[] args) + { + if ((bool)args[0] == true) + { + m_log.Info("[PERMISSIONS]: Permissions Bypass Enabled."); + m_bypassPermissionsValue = (bool)args[1]; + } + else + { + m_bypassPermissions = false; + m_log.Info("[PERMISSIONS]: Permissions Bypass Disabled. Normal Operation."); + } + } + + /// + /// Processes commandline input. Do not call directly. + /// + /// Commandline arguments + private void EventManager_OnPluginConsole(string[] args) + { + if (args[0] == "permissions") + { + string[] tmpArgs = new string[args.Length - 2]; + int i; + for (i = 2; i < args.Length; i++) + tmpArgs[i - 2] = args[i]; + + m_commander.ProcessConsoleCommand(args[1], tmpArgs); + } + } + + #endregion + #region IRegionModule Members public void Initialise(Scene scene, IConfigSource config) @@ -67,29 +147,52 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions m_scene.RegisterModuleInterface(this); - //Register External Permission Checks! - m_scene.ExternalChecks.addCheckAbandonParcel(this.CanAbandonParcel); - m_scene.ExternalChecks.addCheckCopyObject(this.CanCopyObject); - m_scene.ExternalChecks.addCheckDeRezObject(this.CanDeRezObject); - m_scene.ExternalChecks.addCheckEditEstateTerrain(this.CanEditEstateTerrain); - m_scene.ExternalChecks.addCheckEditObject(this.CanEditObject); - m_scene.ExternalChecks.addCheckEditParcel(this.CanEditParcel); - m_scene.ExternalChecks.addCheckEditScript(this.CanEditScript); - m_scene.ExternalChecks.addCheckInstantMessage(this.CanInstantMessage); - m_scene.ExternalChecks.addCheckInventoryTransfer(this.CanInventoryTransfer); - m_scene.ExternalChecks.addCheckMoveObject(this.CanEditObjectPosition); - m_scene.ExternalChecks.addCheckRestartSim(this.CanRestartSim); - m_scene.ExternalChecks.addCheckReturnObject(this.CanReturnObject); - m_scene.ExternalChecks.addCheckRezObject(this.CanRezObject); - m_scene.ExternalChecks.addCheckBeGodLike(this.CanBeGodLike); - m_scene.ExternalChecks.addCheckRunConsoleCommand(this.CanRunConsoleCommand); - m_scene.ExternalChecks.addCheckRunScript(this.CanRunScript); - m_scene.ExternalChecks.addCheckSellParcel(this.CanSellParcel); - //m_scene.ExternalChecks.addCheckTakeObject; -- NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckTerraformLandCommand(this.CanTerraform); + //Register functions with Scene External Checks! + m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED + m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED + m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckMoveObject(CanMoveObject); //HOPEFULLY FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckObjectEntry(CanObjectEntry); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckReturnObject(CanReturnObject); //NOT YET IMPLEMENTED + m_scene.ExternalChecks.addCheckRezObject(CanRezObject); //HOPEFULLY FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckRunConsoleCommand(CanRunConsoleCommand); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckRunScript(CanRunScript); //NOT YET IMPLEMENTED + m_scene.ExternalChecks.addCheckSellParcel(CanSellParcel); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckTakeObject(CanTakeObject); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!) + m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED + + //NEEDED PERMS: + //CanLinkObject + //CanDelinkObject + //CanBuyLand + + + //Register Debug Commands + Command bypassCommand = new Command("bypass", InterfaceBypassPermissions, "Force the permissions a specific way to test permissions"); + bypassCommand.AddArgument("enable_bypass_perms", "true to enable bypassing all perms", "Boolean"); + bypassCommand.AddArgument("bypass_perms_value", "true/false: true will ignore all perms; false will restrict everything", "Boolean"); + + m_commander.RegisterCommand("bypass", bypassCommand); + + Command debugCommand = new Command("debug", InterfaceDebugPermissions, "Force the permissions a specific way to test permissions"); + debugCommand.AddArgument("enable_debug_perms", "true to enable debugging to console all perms", "Boolean"); + + m_commander.RegisterCommand("debug", debugCommand); + m_scene.RegisterModuleCommander("CommanderPermissions", m_commander); + m_scene.EventManager.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(EventManager_OnPluginConsole); } + public void PostInitialise() { } @@ -110,18 +213,19 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions #endregion + #region Helper Functions protected void SendPermissionError(LLUUID user, string reason) { m_scene.EventManager.TriggerPermissionError(user, reason); } + protected void DebugPermissionInformation(string permissionCalled) + { + if(m_debugPermissions) + m_log.Info("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName); + } protected bool IsAdministrator(LLUUID user) { - if (m_bypassPermissions) - { - return true; - } - // If there is no master avatar, return false if (m_scene.RegionInfo.MasterAvatarAssignedUUID != LLUUID.Zero) { @@ -133,117 +237,19 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions protected bool IsEstateManager(LLUUID user) { - if (m_bypassPermissions) - { - return true; - } - if (user != LLUUID.Zero) { LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers; - for (int i = 0; i < estatemanagers.Length; i++) + foreach(LLUUID estatemanager in estatemanagers) { - if (estatemanagers[i] == user) + if (estatemanager == user) return true; } } return false; } - - protected bool IsGridUser(LLUUID user) - { - return true; - } - - protected bool IsGuest(LLUUID user) - { - return false; - } - - public bool CanRezObject(int objectCount, LLUUID user, LLVector3 position,Scene scene) - { - bool permission = false; - - - - string reason = "Insufficient permission"; - - ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y); - if (land == null) return false; - - if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == - (int)Parcel.ParcelFlags.CreateObjects) - permission = true; - - //TODO: check for group rights - - if (IsAdministrator(user)) - { - permission = true; - } - else - { - reason = "Not an administrator"; - } - - if (GenericParcelPermission(user, position)) - { - permission = true; - } - else - { - reason = "Not the parcel owner"; - } - - if (!permission) - SendPermissionError(user, reason); - - return permission; - } - - /// 255) - X = 255; - if (Y > 255) - Y = 255; - if (X < 0) - X = 0; - if (Y < 0) - Y = 0; - - // Land owner can terraform too - ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y); - if (parcel != null && GenericParcelPermission(user, parcel)) - permission = true; - if (!permission) - SendPermissionError(user, "Not authorized to terraform at this location."); + // This is an exception to the generic object permission. + // Administrators who lock their objects should not be able to move them, + // however generic object permission should return true. + // This keeps locked objects from being affected by random click + drag actions by accident + // and allows the administrator to grab or delete a locked object. - return permission; - } + // Administrators and estate managers are still able to click+grab locked objects not + // owned by them in the scene + // This is by design. - #region Estate Permissions + if (locked && (moverID == objectOwner)) + return false; + } + return permission; + } - public bool GenericEstatePermission(LLUUID user) - { - // Default: deny - bool permission = false; + private bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; - // Estate admins should be able to use estate tools - if (IsEstateManager(user)) - permission = true; + if ((newPoint.X > 257f || newPoint.X < -1f || newPoint.Y > 257f || newPoint.Y < -1f)) + { + return true; + } - // Administrators always have permission - if (IsAdministrator(user)) - permission = true; + ILandObject land = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); - return permission; - } + if (land == null) + { + return false; + } - public bool CanEditEstateTerrain(LLUUID user, Scene scene) - { - return GenericEstatePermission(user); - } + if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0) + { + return true; + } - public bool CanRestartSim(LLUUID user, Scene scene) - { - // Since this is potentially going on a grid... + //TODO: check for group rights - return GenericEstatePermission(user); - //return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; - } + if (!m_scene.Entities.ContainsKey(objectID)) + { + return false; + } - public bool CanBeGodLike(LLUUID user, Scene scene) - { - return GenericEstatePermission(user); - } + // If it's not an object, we cant edit it. + if (!(m_scene.Entities[objectID] is SceneObjectGroup)) + { + return false; + } - #endregion + SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID]; - #region Parcel Permissions + if (GenericParcelPermission(task.OwnerID, newPoint)) + { + return true; + } - protected bool GenericParcelPermission(LLUUID user, ILandObject parcel) - { - bool permission = false; + //Otherwise, false! + return false; + } - if (parcel.landData.ownerID == user) + private bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene) { - permission = true; + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + return GenericObjectPermission(returnerID, objectID); } - if (parcel.landData.isGroupOwned) + private bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene) { - // TODO: Need to do some extra checks here. Requires group code. + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + bool permission = false; + + ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); + if (land == null) return false; + + if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == + (int)Parcel.ParcelFlags.CreateObjects) + permission = true; + + //TODO: check for group rights + + if (IsAdministrator(owner)) + { + permission = true; + } + + if (GenericParcelPermission(owner, objectPosition)) + { + permission = true; + } + + return permission; } - if (IsEstateManager(user)) + private bool CanRunConsoleCommand(LLUUID user, Scene requestFromScene) { - permission = true; + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + + return IsAdministrator(user); } - if (IsAdministrator(user)) + private bool CanRunScript(LLUUID script, LLUUID user, Scene scene) { - permission = true; + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + return true; } - return permission; - } + private bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; - protected bool GenericParcelPermission(LLUUID user, LLVector3 pos) - { - ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); - if (parcel == null) return false; - return GenericParcelPermission(user, parcel); - } + return GenericParcelPermission(user, parcel); + } - public bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene) - { - return GenericParcelPermission(user, parcel); - } + private bool CanTakeObject(LLUUID objectID, LLUUID stealer, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; - public bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene) - { - return GenericParcelPermission(user, parcel); - } + return GenericObjectPermission(stealer,objectID); + } - public bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene) - { - return GenericParcelPermission(user, parcel); - } + private bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + bool permission = GenericObjectPermission(userID, objectID); + if (permission) + { + if (!m_scene.Entities.ContainsKey(objectID)) + { + return false; + } + + // If it's not an object, we cant edit it. + if (!(m_scene.Entities[objectID] is SceneObjectGroup)) + { + return false; + } + + SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID]; + LLUUID taskOwner = null; + // Added this because at this point in time it wouldn't be wise for + // the administrator object permissions to take effect. + LLUUID objectOwner = task.OwnerID; + + + if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) + permission = true; + } + return permission; + } + + private bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + bool permission = false; + + // Estate override + if (GenericEstatePermission(user)) + permission = true; + float X = position.X; + float Y = position.Y; + + if (X > 255) + X = 255; + if (Y > 255) + Y = 255; + if (X < 0) + X = 0; + if (Y < 0) + Y = 0; + + // Land owner can terraform too + ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y); + if (parcel != null && GenericParcelPermission(user, parcel)) + permission = true; + + + return permission; + } + + private bool CanViewScript(LLUUID script, LLUUID user, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + return true; + } #endregion + + } + } diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 9dba398..8b9b888 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -288,8 +288,11 @@ namespace OpenSim.Region.Environment.Scenes { if (((SceneObjectGroup)obj).LocalId == localID) { - m_parentScene.RemoveEntity((SceneObjectGroup)obj); - m_numPrim--; + if (m_parentScene.ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)obj).UUID, avatar_deleter)) + { + m_parentScene.RemoveEntity((SceneObjectGroup)obj); + m_numPrim--; + } return; } } @@ -998,12 +1001,11 @@ namespace OpenSim.Region.Environment.Scenes if (group != null) { LLVector3 oldPos = group.AbsolutePosition; - //FIXME: ObjectEntry is not in ExternalChecks! - //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) - //{ + if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment) + { group.SendGroupTerseUpdate(); - //return; - //} + return; + } if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) { group.UpdateSinglePosition(pos, localID); @@ -1030,12 +1032,11 @@ namespace OpenSim.Region.Environment.Scenes } else { - //FIXME: ObjectEntry not in ExternalChecks! - //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) - //{ + if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment) + { group.SendGroupTerseUpdate(); - // return; - //} + return; + } if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment) { group.UpdateGroupPosition(pos); @@ -1055,7 +1056,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID,remoteClient.AgentId)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,remoteClient.AgentId)) { group.UpdateTextureEntry(localID, texture); } @@ -1378,7 +1379,7 @@ namespace OpenSim.Region.Environment.Scenes if (originPrim != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanCopyObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) + if (m_parentScene.ExternalChecks.ExternalChecksCanDuplicateObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) { SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); copy.AbsolutePosition = copy.AbsolutePosition + offset; diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 782d5b4..cbb3a7d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -988,17 +988,28 @@ namespace OpenSim.Region.Environment.Scenes } if (selectedEnt != null) { - bool permission; - if (DeRezPacket.AgentBlock.Destination == 1) - { // Take Copy - permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + bool permissionToTake = false; + bool permissionToDelete = false; + if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy + { + permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + permissionToDelete = false; //Just taking copy! + } - else - { // Take - permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + else if(DeRezPacket.AgentBlock.Destination == 4) //Take + { + // Take + permissionToTake = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + permissionToDelete = permissionToTake; //If they can take, they can delete! + } + + else if (DeRezPacket.AgentBlock.Destination == 6) //Delete + { + permissionToTake = false; + permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); } - if (permission) + if (permissionToTake) { SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt; string sceneObjectXml = objectGroup.ToXmlString(); @@ -1044,8 +1055,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendInventoryItemCreateUpdate(item); } - // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy - if (DeRezPacket.AgentBlock.Destination != 1) + if (permissionToDelete) { DeleteSceneObjectGroup(objectGroup); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f0a0921..faa595f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1146,13 +1146,20 @@ namespace OpenSim.Region.Environment.Scenes m_log.Info("[SCENE]: Loading land objects from storage"); List landData = m_storageManager.DataStore.LoadLandObjects(regionID); - if (landData.Count == 0) + if (LandChannel != null) { - LandChannel.NoLandDataFromStorage(); + if (landData.Count == 0) + { + LandChannel.NoLandDataFromStorage(); + } + else + { + LandChannel.IncomingLandObjectsFromStorage(landData); + } } else { - LandChannel.IncomingLandObjectsFromStorage(landData); + m_log.Error("[SCENE]: Land Channel is not defined. Cannot load from storage!"); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index e7e4caf..285ee0d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs @@ -74,24 +74,24 @@ namespace OpenSim.Region.Environment.Scenes #endregion - #region DEREZ OBJECT - public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene); - private List CanDeRezObjectCheckFunctions = new List(); + #region DELETE OBJECT + public delegate bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene); + private List CanDeleteObjectCheckFunctions = new List(); - public void addCheckDeRezObject(CanDeRezObject delegateFunc) + public void addCheckDeleteObject(CanDeleteObject delegateFunc) { - if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc)) - CanDeRezObjectCheckFunctions.Add(delegateFunc); + if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectCheckFunctions.Add(delegateFunc); } - public void removeCheckDeRezObject(CanDeRezObject delegateFunc) + public void removeCheckDeleteObject(CanDeleteObject delegateFunc) { - if (CanDeRezObjectCheckFunctions.Contains(delegateFunc)) - CanDeRezObjectCheckFunctions.Remove(delegateFunc); + if (CanDeleteObjectCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectCheckFunctions.Remove(delegateFunc); } - public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter) + public bool ExternalChecksCanDeleteObject(LLUUID objectID, LLUUID deleter) { - foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions) + foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions) { if (check(objectID,deleter,m_scene) == false) { @@ -132,24 +132,53 @@ namespace OpenSim.Region.Environment.Scenes #endregion - #region COPY OBJECT - public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); - private List CanCopyObjectCheckFunctions = new List(); + #region TAKE COPY OBJECT + public delegate bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene); + private List CanTakeCopyObjectCheckFunctions = new List(); - public void addCheckCopyObject(CanCopyObject delegateFunc) + public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc) { - if (!CanCopyObjectCheckFunctions.Contains(delegateFunc)) - CanCopyObjectCheckFunctions.Add(delegateFunc); + if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) + CanTakeCopyObjectCheckFunctions.Add(delegateFunc); } - public void removeCheckCopyObject(CanCopyObject delegateFunc) + public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc) { - if (CanCopyObjectCheckFunctions.Contains(delegateFunc)) - CanCopyObjectCheckFunctions.Remove(delegateFunc); + if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) + CanTakeCopyObjectCheckFunctions.Remove(delegateFunc); } - public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) + public bool ExternalChecksCanTakeCopyObject(LLUUID objectID, LLUUID userID) { - foreach (CanCopyObject check in CanCopyObjectCheckFunctions) + foreach (CanTakeCopyObject check in CanTakeCopyObjectCheckFunctions) + { + if (check(objectID,userID,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region DUPLICATE OBJECT + public delegate bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); + private List CanDuplicateObjectCheckFunctions = new List(); + + public void addCheckDuplicateObject(CanDuplicateObject delegateFunc) + { + if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) + CanDuplicateObjectCheckFunctions.Add(delegateFunc); + } + public void removeCheckDuplicateObject(CanDuplicateObject delegateFunc) + { + if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) + CanDuplicateObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) + { + foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions) { if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) { @@ -219,6 +248,35 @@ namespace OpenSim.Region.Environment.Scenes #endregion + #region OBJECT ENTRY + public delegate bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene); + private List CanObjectEntryCheckFunctions = new List(); + + public void addCheckObjectEntry(CanObjectEntry delegateFunc) + { + if (!CanObjectEntryCheckFunctions.Contains(delegateFunc)) + CanObjectEntryCheckFunctions.Add(delegateFunc); + } + public void removeCheckObjectEntry(CanObjectEntry delegateFunc) + { + if (CanObjectEntryCheckFunctions.Contains(delegateFunc)) + CanObjectEntryCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanObjectEntry(LLUUID objectID, LLVector3 newPoint) + { + foreach (CanObjectEntry check in CanObjectEntryCheckFunctions) + { + if (check(objectID, newPoint, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + #region RETURN OBJECT public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene); private List CanReturnObjectCheckFunctions = new List(); @@ -248,10 +306,6 @@ namespace OpenSim.Region.Environment.Scenes #endregion - #endregion - - #region Misc Permission Checks - #region INSTANT MESSAGE public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene); private List CanInstantMessageCheckFunctions = new List(); @@ -271,7 +325,7 @@ namespace OpenSim.Region.Environment.Scenes { foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) { - if (check(user,target,m_scene) == false) + if (check(user, target, m_scene) == false) { return false; } @@ -310,6 +364,35 @@ namespace OpenSim.Region.Environment.Scenes #endregion + #region VIEW SCRIPT + public delegate bool CanViewScript(LLUUID script, LLUUID user, Scene scene); + private List CanViewScriptCheckFunctions = new List(); + + public void addCheckViewScript(CanViewScript delegateFunc) + { + if (!CanViewScriptCheckFunctions.Contains(delegateFunc)) + CanViewScriptCheckFunctions.Add(delegateFunc); + } + public void removeCheckViewScript(CanViewScript delegateFunc) + { + if (CanViewScriptCheckFunctions.Contains(delegateFunc)) + CanViewScriptCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanViewScript(LLUUID script, LLUUID user) + { + foreach (CanViewScript check in CanViewScriptCheckFunctions) + { + if (check(script, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + #region EDIT SCRIPT public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene); private List CanEditScriptCheckFunctions = new List(); @@ -369,23 +452,23 @@ namespace OpenSim.Region.Environment.Scenes #endregion #region TERRAFORM LAND - public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene); - private List CanTerraformLandCommandCheckFunctions = new List(); + public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene); + private List CanTerraformLandCheckFunctions = new List(); - public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) + public void addCheckTerraformLand(CanTerraformLand delegateFunc) { - if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) - CanTerraformLandCommandCheckFunctions.Add(delegateFunc); + if (!CanTerraformLandCheckFunctions.Contains(delegateFunc)) + CanTerraformLandCheckFunctions.Add(delegateFunc); } - public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) + public void removeCheckTerraformLand(CanTerraformLand delegateFunc) { - if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) - CanTerraformLandCommandCheckFunctions.Remove(delegateFunc); + if (CanTerraformLandCheckFunctions.Contains(delegateFunc)) + CanTerraformLandCheckFunctions.Remove(delegateFunc); } public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos) { - foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions) + foreach (CanTerraformLand check in CanTerraformLandCheckFunctions) { if (check(user, pos, m_scene) == false) { @@ -426,6 +509,34 @@ namespace OpenSim.Region.Environment.Scenes #endregion + #region CAN ISSUE ESTATE COMMAND + public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene); + private List CanIssueEstateCommandCheckFunctions = new List(); + + public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc) + { + if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) + CanIssueEstateCommandCheckFunctions.Add(delegateFunc); + } + public void removeCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc) + { + if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) + CanIssueEstateCommandCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanIssueEstateCommand(LLUUID user) + { + foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions) + { + if (check(user, m_scene) == false) + { + return false; + } + } + return true; + } + #endregion + #region CAN BE GODLIKE public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene); private List CanBeGodLikeCheckFunctions = new List(); @@ -452,154 +563,95 @@ namespace OpenSim.Region.Environment.Scenes } return true; } - #endregion - #endregion - - #region Parcel and Estate Permission Checks - #region EDIT ESTATE TERRAIN - public delegate bool CanEditEstateTerrain(LLUUID user, Scene scene); - private List CanEditEstateTerrainCheckFunctions = new List(); - - public void addCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc) - { - if (!CanEditEstateTerrainCheckFunctions.Contains(delegateFunc)) - CanEditEstateTerrainCheckFunctions.Add(delegateFunc); - } - public void removeCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc) - { - if (CanEditEstateTerrainCheckFunctions.Contains(delegateFunc)) - CanEditEstateTerrainCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanEditEstateTerrain(LLUUID user) - { - foreach (CanEditEstateTerrain check in CanEditEstateTerrainCheckFunctions) - { - if (check(user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion + #region EDIT PARCEL + public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene); + private List CanEditParcelCheckFunctions = new List(); - #region RESTART SIM - public delegate bool CanRestartSim(LLUUID user, Scene scene); - private List CanRestartSimCheckFunctions = new List(); - - public void addCheckRestartSim(CanRestartSim delegateFunc) - { - if (!CanRestartSimCheckFunctions.Contains(delegateFunc)) - CanRestartSimCheckFunctions.Add(delegateFunc); - } - public void removeCheckRestartSim(CanRestartSim delegateFunc) - { - if (CanRestartSimCheckFunctions.Contains(delegateFunc)) - CanRestartSimCheckFunctions.Remove(delegateFunc); - } + public void addCheckEditParcel(CanEditParcel delegateFunc) + { + if (!CanEditParcelCheckFunctions.Contains(delegateFunc)) + CanEditParcelCheckFunctions.Add(delegateFunc); + } + public void removeCheckEditParcel(CanEditParcel delegateFunc) + { + if (CanEditParcelCheckFunctions.Contains(delegateFunc)) + CanEditParcelCheckFunctions.Remove(delegateFunc); + } - public bool ExternalChecksCanRestartSim(LLUUID user) + public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel) + { + foreach (CanEditParcel check in CanEditParcelCheckFunctions) { - foreach (CanRestartSim check in CanRestartSimCheckFunctions) + if (check(user, parcel, m_scene) == false) { - if (check(user, m_scene) == false) - { - return false; - } + return false; } - return true; } + return true; + } #endregion - #region EDIT PARCEL - public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene); - private List CanEditParcelCheckFunctions = new List(); - - public void addCheckEditParcel(CanEditParcel delegateFunc) - { - if (!CanEditParcelCheckFunctions.Contains(delegateFunc)) - CanEditParcelCheckFunctions.Add(delegateFunc); - } - public void removeCheckEditParcel(CanEditParcel delegateFunc) - { - if (CanEditParcelCheckFunctions.Contains(delegateFunc)) - CanEditParcelCheckFunctions.Remove(delegateFunc); - } + #region SELL PARCEL + public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene); + private List CanSellParcelCheckFunctions = new List(); - public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel) - { - foreach (CanEditParcel check in CanEditParcelCheckFunctions) - { - if (check(user, parcel, m_scene) == false) - { - return false; - } - } - return true; - } - #endregion - - #region SELL PARCEL - public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene); - private List CanSellParcelCheckFunctions = new List(); - - public void addCheckSellParcel(CanSellParcel delegateFunc) - { - if (!CanSellParcelCheckFunctions.Contains(delegateFunc)) - CanSellParcelCheckFunctions.Add(delegateFunc); - } - public void removeCheckSellParcel(CanSellParcel delegateFunc) - { - if (CanSellParcelCheckFunctions.Contains(delegateFunc)) - CanSellParcelCheckFunctions.Remove(delegateFunc); - } + public void addCheckSellParcel(CanSellParcel delegateFunc) + { + if (!CanSellParcelCheckFunctions.Contains(delegateFunc)) + CanSellParcelCheckFunctions.Add(delegateFunc); + } + public void removeCheckSellParcel(CanSellParcel delegateFunc) + { + if (CanSellParcelCheckFunctions.Contains(delegateFunc)) + CanSellParcelCheckFunctions.Remove(delegateFunc); + } - public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) + public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) + { + foreach (CanSellParcel check in CanSellParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) { - foreach (CanSellParcel check in CanSellParcelCheckFunctions) - { - if (check(user, parcel, m_scene) == false) - { - return false; - } - } - return true; + return false; } - #endregion + } + return true; + } + #endregion - #region ABANDON PARCEL - public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene); - private List CanAbandonParcelCheckFunctions = new List(); + #region ABANDON PARCEL + public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene); + private List CanAbandonParcelCheckFunctions = new List(); - public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) - { - if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) - CanAbandonParcelCheckFunctions.Add(delegateFunc); - } - public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) - { - if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) - CanAbandonParcelCheckFunctions.Remove(delegateFunc); - } + public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) + { + if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) + CanAbandonParcelCheckFunctions.Add(delegateFunc); + } + public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) + { + if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) + CanAbandonParcelCheckFunctions.Remove(delegateFunc); + } - public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) + public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) + { + foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) { - foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) - { - if (check(user, parcel, m_scene) == false) - { - return false; - } - } - return true; + return false; } - #endregion + } + return true; + } #endregion + #endregion + } } + \ No newline at end of file -- cgit v1.1