diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 51c71849cc..5bd2e6cddf 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5070,13 +5070,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP { case "getinfo": - if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) { OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); } break; case "setregioninfo": - if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) { OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter), convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), @@ -5089,7 +5089,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; case "texturebase": - if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) { foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) { @@ -5104,7 +5104,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; case "texturedetail": - if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) { foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) { @@ -5122,7 +5122,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; case "textureheights": - if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) { foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) { @@ -5143,7 +5143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OnCommitEstateTerrainTextureRequest(this); break; case "setregionterrain": - if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) { if (messagePacket.ParamList.Length != 9) { @@ -5178,7 +5178,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; case "restart": - if (((Scene)m_scene).Permissions.CanRestartSim(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanRestartSim(this.AgentId)) { // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) @@ -5192,7 +5192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; case "estatechangecovenantid": - if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) { foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) { @@ -5202,7 +5202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. - if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) { int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter)); OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter))); @@ -5210,7 +5210,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; case "simulatormessage": - if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) { LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); @@ -5221,7 +5221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; case "instantmessage": - if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) { LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); @@ -5232,7 +5232,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; case "setregiondebug": - if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) { LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID SenderID = messagePacket.AgentData.AgentID; @@ -5244,7 +5244,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; case "teleporthomeuser": - if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId)) + if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) { LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID SenderID = messagePacket.AgentData.AgentID; diff --git a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs index 5d161bbc91..06c66116ee 100644 --- a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs +++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs @@ -32,72 +32,6 @@ namespace OpenSim.Region.Environment.Interfaces public interface IScenePermissions { bool BypassPermissions { get; set; } - - #region Object Permissions - - bool CanRezObject(LLUUID user, LLVector3 position, int count); - - /// - /// Permissions check - can user delete an object? - /// - /// User attempting the delete - /// Target object - /// Has permission? - bool CanDeRezObject(LLUUID user, LLUUID obj); - - bool CanCopyObject(LLUUID user, LLUUID obj); - - bool CanEditObject(LLUUID user, LLUUID obj); - - bool CanEditObjectPosition(LLUUID user, LLUUID obj); - - /// - /// Permissions check - can user enter an object? - /// - /// User attempting move an object - /// Source object-position - /// Target object-position - /// Has permission? - bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos); - - bool CanReturnObject(LLUUID user, LLUUID obj); - - #endregion - - #region Uncategorized permissions - - bool CanInstantMessage(LLUUID user, LLUUID target); - - bool CanInventoryTransfer(LLUUID user, LLUUID target); - - bool CanEditScript(LLUUID user, LLUUID script); - - bool CanRunScript(LLUUID user, LLUUID script); - - bool CanRunConsoleCommand(LLUUID user); - - bool CanTerraform(LLUUID user, LLVector3 position); - - #endregion - - #region Estate Permissions - - bool IsEstateManager(LLUUID user); - - bool GenericEstatePermission(LLUUID user); - - bool CanEditEstateTerrain(LLUUID user); - - bool CanRestartSim(LLUUID user); - - bool CanEditParcel(LLUUID user, ILandObject parcel); - - bool CanSellParcel(LLUUID user, ILandObject parcel); - - bool CanAbandonParcel(LLUUID user, ILandObject parcel); - - #endregion - uint GenerateClientFlags(LLUUID user, LLUUID objID); } } diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 7bd1bb3012..16cd2113d6 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs @@ -61,12 +61,33 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions { m_scene = scene; - // FIXME: Possibly move all permissions related stuff to its own section IConfig myConfig = config.Configs["Startup"]; - m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false); + m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); 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); + } public void PostInitialise() @@ -89,12 +110,12 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions #endregion - protected virtual void SendPermissionError(LLUUID user, string reason) + protected void SendPermissionError(LLUUID user, string reason) { m_scene.EventManager.TriggerPermissionError(user, reason); } - protected virtual bool IsAdministrator(LLUUID user) + protected bool IsAdministrator(LLUUID user) { if (m_bypassPermissions) { @@ -110,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return false; } - public virtual bool IsEstateManager(LLUUID user) + public bool IsEstateManager(LLUUID user) { if (m_bypassPermissions) { @@ -130,17 +151,17 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return false; } - protected virtual bool IsGridUser(LLUUID user) + protected bool IsGridUser(LLUUID user) { return true; } - protected virtual bool IsGuest(LLUUID user) + protected bool IsGuest(LLUUID user) { return false; } - public virtual bool CanRezObject(LLUUID user, LLVector3 position, int objectCount) + public bool CanRezObject(int objectCount, LLUUID user, LLVector3 position,Scene scene) { bool permission = false; @@ -148,13 +169,6 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions string reason = "Insufficient permission"; - //Perform ExternalChecks first! - bool results = m_scene.ExternalChecks.ExternalChecksCanRezObject(objectCount, user, position); - if (results == false) - { - return false; - } - ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y); if (land == null) return false; @@ -189,7 +203,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions } /// - public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) + public bool CanDeRezObject(LLUUID obj,LLUUID user, Scene scene) { return GenericObjectPermission(user, obj); } - public virtual bool CanEditObject(LLUUID user, LLUUID obj) + public bool CanEditObject(LLUUID obj, LLUUID user, Scene scene) { return GenericObjectPermission(user, obj); } - public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj) + public bool CanEditObjectPosition(LLUUID obj, LLUUID user, Scene scene) { bool permission = GenericObjectPermission(user, obj); if (!permission) @@ -499,7 +513,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return permission; } - public virtual bool CanCopyObject(LLUUID user, LLUUID obj) + public bool CanCopyObject(int objectCount, LLUUID obj, LLUUID user, Scene scene, LLVector3 objectPosition) { bool permission = GenericObjectPermission(user, obj); if (permission) @@ -521,15 +535,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions // the administrator object permissions to take effect. LLUUID objectOwner = task.OwnerID; - //Check ExternalChecks! - if (m_scene.ExternalChecks.ExternalChecksCanRezObject(task.Children.Count, objectOwner, task.GroupCentrePoint) == false) return false; + if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) permission = true; } return permission; } - public virtual bool CanReturnObject(LLUUID user, LLUUID obj) + public bool CanReturnObject(LLUUID obj, LLUUID user, Scene scene) { return GenericObjectPermission(user, obj); } @@ -538,7 +551,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions #region Communication Permissions - protected virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) + protected bool GenericCommunicationPermission(LLUUID user, LLUUID target) { bool permission = false; string reason = "Only registered users may communicate with another account."; @@ -563,36 +576,34 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return permission; } - public virtual bool CanInstantMessage(LLUUID user, LLUUID target) + public bool CanInstantMessage(LLUUID user, LLUUID target, Scene scene) { return GenericCommunicationPermission(user, target); } - public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target) + public bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene scene) { return GenericCommunicationPermission(user, target); } #endregion - public virtual bool CanEditScript(LLUUID user, LLUUID script) + public bool CanEditScript(LLUUID script, LLUUID user, Scene scene) { return IsAdministrator(user); } - public virtual bool CanRunScript(LLUUID user, LLUUID script) - { - //External Checks! - if (!m_scene.ExternalChecks.ExternalChecksCanRunScript(script, user)) return false; - return IsAdministrator(user); - } - - public virtual bool CanRunConsoleCommand(LLUUID user) + public bool CanRunScript(LLUUID script, LLUUID user, Scene scene) { return IsAdministrator(user); } - public virtual bool CanTerraform(LLUUID user, LLVector3 position) + public bool CanRunConsoleCommand(LLUUID user, Scene scene) + { + return IsAdministrator(user); + } + + public bool CanTerraform(LLUUID user, LLVector3 position, Scene scene) { bool permission = false; @@ -625,7 +636,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions #region Estate Permissions - public virtual bool GenericEstatePermission(LLUUID user) + public bool GenericEstatePermission(LLUUID user) { // Default: deny bool permission = false; @@ -641,12 +652,12 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return permission; } - public virtual bool CanEditEstateTerrain(LLUUID user) + public bool CanEditEstateTerrain(LLUUID user, Scene scene) { return GenericEstatePermission(user); } - public virtual bool CanRestartSim(LLUUID user) + public bool CanRestartSim(LLUUID user, Scene scene) { // Since this is potentially going on a grid... @@ -654,11 +665,16 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions //return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; } + public bool CanBeGodLike(LLUUID user, Scene scene) + { + return GenericEstatePermission(user); + } + #endregion #region Parcel Permissions - protected virtual bool GenericParcelPermission(LLUUID user, ILandObject parcel) + protected bool GenericParcelPermission(LLUUID user, ILandObject parcel) { bool permission = false; @@ -685,24 +701,24 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return permission; } - protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) + 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); } - public virtual bool CanEditParcel(LLUUID user, ILandObject parcel) + public bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene) { return GenericParcelPermission(user, parcel); } - public virtual bool CanSellParcel(LLUUID user, ILandObject parcel) + public bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene) { return GenericParcelPermission(user, parcel); } - public virtual bool CanAbandonParcel(LLUUID user, ILandObject parcel) + public bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene) { return GenericParcelPermission(user, parcel); } diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 91a28e4bce..4562fb6b98 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -449,7 +449,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain float south, float east, IClientAPI remoteClient) { // Not a good permissions check, if in area mode, need to check the entire area. - if (m_scene.Permissions.CanTerraform(remoteClient.AgentId, new LLVector3(north, west, 0))) + if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(remoteClient.AgentId, new LLVector3(north, west, 0))) { if (north == south && east == west) { diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 7ffddb3a63..2c8c323749 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -394,7 +394,7 @@ namespace OpenSim.Region.Environment.Scenes if (((SceneObjectGroup)obj).LocalId == objectLocalID) { SceneObjectGroup group = (SceneObjectGroup)obj; - if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, obj.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditScript(obj.UUID, remoteClient.AgentId)) { // If the attachment point isn't the same as the one previously used // set it's offset position = 0 so that it appears on the attachment point @@ -1051,7 +1051,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) { group.Resize(scale, localID); } @@ -1062,7 +1062,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) { group.GroupResize(scale, localID); } @@ -1098,7 +1098,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId)) { group.UpdateSingleRotation(rot, localID); } @@ -1116,7 +1116,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId)) { group.UpdateGroupRotation(rot); } @@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId)) { group.UpdateGroupRotation(pos, rot); } @@ -1148,12 +1148,13 @@ namespace OpenSim.Region.Environment.Scenes if (group != null) { LLVector3 oldPos = group.AbsolutePosition; - if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) - { + //FIXME: ObjectEntry is not in ExternalChecks! + //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) + //{ group.SendGroupTerseUpdate(); - return; - } - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) + //return; + //} + if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) { group.UpdateSinglePosition(pos, localID); } @@ -1179,12 +1180,13 @@ namespace OpenSim.Region.Environment.Scenes } else { - if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) - { + //FIXME: ObjectEntry not in ExternalChecks! + //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) + //{ group.SendGroupTerseUpdate(); - return; - } - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) + // return; + //} + if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment) { group.UpdateGroupPosition(pos); } @@ -1203,7 +1205,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID,remoteClient.AgentId)) { group.UpdateTextureEntry(localID, texture); } @@ -1221,7 +1223,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) { group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); } @@ -1233,7 +1235,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(objectID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.) + if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) { group.GrabMovement(offset, pos, remoteClient); } @@ -1255,7 +1257,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) { group.SetPartName(Util.CleanString(name), primLocalID); } @@ -1272,7 +1274,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) { group.SetPartDescription(Util.CleanString(description), primLocalID); } @@ -1285,7 +1287,7 @@ namespace OpenSim.Region.Environment.Scenes if (group != null) { - if (m_parentScene.Permissions.CanEditObject(agentID, group.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,agentID)) { group.UpdateExtraParam(primLocalID, type, inUse, data); } @@ -1302,7 +1304,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.Permissions.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID))) + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.GetPartsFullID(primLocalID), agentID)) { ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; @@ -1489,11 +1491,11 @@ namespace OpenSim.Region.Environment.Scenes // * Asset/DRM permission bit "modify" is enabled //use CanEditObjectPosition - if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(user, objid)) + if (IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanEditObject(objid, user)) { obj.AddFlag(LLObject.ObjectFlags.JointWheel); } - else if (!IncludeInSearch && m_parentScene.Permissions.CanEditObjectPosition(user, objid)) + else if (!IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(objid,user)) { obj.RemFlag(LLObject.ObjectFlags.JointWheel); } @@ -1526,7 +1528,7 @@ namespace OpenSim.Region.Environment.Scenes if (originPrim != null) { - if (m_parentScene.Permissions.CanCopyObject(AgentID, originPrim.UUID)) + if (m_parentScene.ExternalChecks.ExternalChecksCanCopyObject(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 b5360485f0..e78ad2b077 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendInventoryItemCreateUpdate(item); int userlevel = 0; - if (Permissions.IsEstateManager(remoteClient.AgentId)) + if (ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId)) { userlevel = 1; } @@ -988,13 +988,11 @@ namespace OpenSim.Region.Environment.Scenes bool permission; if (DeRezPacket.AgentBlock.Destination == 1) { // Take Copy - permission = Permissions.CanCopyObject(remoteClient.AgentId, - ((SceneObjectGroup) selectedEnt).UUID); + permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); } else { // Take - permission = Permissions.CanDeRezObject(remoteClient.AgentId, - ((SceneObjectGroup) selectedEnt).UUID); + permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); } if (permission) @@ -1285,7 +1283,7 @@ namespace OpenSim.Region.Environment.Scenes { string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); - if (!Permissions.CanRezObject(remoteClient.AgentId, pos, group.Children.Count) && !attachment) + if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count,remoteClient.AgentId, pos) && !attachment) { return null; } @@ -1371,7 +1369,7 @@ namespace OpenSim.Region.Environment.Scenes string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); - if (!Permissions.CanRezObject(ownerID, pos, group.Children.Count)) + if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count, ownerID, pos)) { return null; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index fb043b77e9..f55d822ca4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Scenes if (((SceneObjectGroup) ent).LocalId == primLocalID) { // A prim is only tainted if it's allowed to be edited by the person clicking it. - if (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) + if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) { ((SceneObjectGroup) ent).GetProperties(remoteClient); ((SceneObjectGroup) ent).IsSelected = true; @@ -112,7 +112,7 @@ namespace OpenSim.Region.Environment.Scenes { if (((SceneObjectGroup) ent).LocalId == primLocalID) { - if (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) + if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) { ((SceneObjectGroup) ent).IsSelected = false; LandChannel.SetPrimsTainted(); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ebbfeced8b..5ce3c7b708 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1245,7 +1245,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false); - if (Permissions.CanRezObject(ownerID, pos, 1)) + if ( ExternalChecks.ExternalChecksCanRezObject(1,ownerID,pos)) { // rez ON the ground, not IN the ground pos.Z += 0.25F; @@ -2519,7 +2519,7 @@ namespace OpenSim.Region.Environment.Scenes if (m_scenePresences.ContainsKey(agentID)) { // First check that this is the sim owner - if (Permissions.GenericEstatePermission(agentID)) + if (ExternalChecks.ExternalChecksCanBeGodLike(agentID)) { // Next we check for spoofing..... LLUUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; @@ -2597,7 +2597,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) { - if (Permissions.GenericEstatePermission(godID)) + if (ExternalChecks.ExternalChecksCanBeGodLike(godID)) { if (agentID == kickUserID) { @@ -2918,7 +2918,7 @@ namespace OpenSim.Region.Environment.Scenes } else if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0) { - if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || Permissions.GenericEstatePermission(part.OwnerID)) + if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || ExternalChecks.ExternalChecksCanBeGodLike(part.OwnerID)) { return true; } diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 2d3e8e419c..4e579b6679 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Text; using libsecondlife; using OpenSim.Framework; +using OpenSim.Region.Environment.Interfaces; namespace OpenSim.Region.Environment.Scenes { @@ -42,63 +43,563 @@ namespace OpenSim.Region.Environment.Scenes m_scene = scene; } - #region REZ OBJECT - public delegate bool CanRezObject(int objectCount, LLUUID owner, IScene scene, LLVector3 objectPosition); - private List CanRezObjectCheckFunctions = new List(); + #region Object Permission Checks - public void addCheckRezObject(CanRezObject delegateFunc) - { - if(!CanRezObjectCheckFunctions.Contains(delegateFunc)) - CanRezObjectCheckFunctions.Add(delegateFunc); - } - public void removeCheckRezObject(CanRezObject delegateFunc) - { - if (CanRezObjectCheckFunctions.Contains(delegateFunc)) - CanRezObjectCheckFunctions.Remove(delegateFunc); - } + #region REZ OBJECT + public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene); + private List CanRezObjectCheckFunctions = new List(); - public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition) - { - foreach (CanRezObject check in CanRezObjectCheckFunctions) + public void addCheckRezObject(CanRezObject delegateFunc) { - if (check(objectCount, owner, m_scene, objectPosition) == false) - { - return false; - } + if(!CanRezObjectCheckFunctions.Contains(delegateFunc)) + CanRezObjectCheckFunctions.Add(delegateFunc); } - return true; - } + public void removeCheckRezObject(CanRezObject delegateFunc) + { + if (CanRezObjectCheckFunctions.Contains(delegateFunc)) + CanRezObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition) + { + foreach (CanRezObject check in CanRezObjectCheckFunctions) + { + if (check(objectCount, owner,objectPosition, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region DEREZ OBJECT + public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene); + private List CanDeRezObjectCheckFunctions = new List(); + + public void addCheckDeRezObject(CanDeRezObject delegateFunc) + { + if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc)) + CanDeRezObjectCheckFunctions.Add(delegateFunc); + } + public void removeCheckDeRezObject(CanDeRezObject delegateFunc) + { + if (CanDeRezObjectCheckFunctions.Contains(delegateFunc)) + CanDeRezObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter) + { + foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions) + { + if (check(objectID,deleter,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region TAKE OBJECT + public delegate bool CanTakeObject(LLUUID objectID, LLUUID stealer, Scene scene); + private List CanTakeObjectCheckFunctions = new List(); + + public void addCheckTakeObject(CanTakeObject delegateFunc) + { + if (!CanTakeObjectCheckFunctions.Contains(delegateFunc)) + CanTakeObjectCheckFunctions.Add(delegateFunc); + } + public void removeCheckTakeObject(CanTakeObject delegateFunc) + { + if (CanTakeObjectCheckFunctions.Contains(delegateFunc)) + CanTakeObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanTakeObject(LLUUID objectID, LLUUID stealer) + { + foreach (CanTakeObject check in CanTakeObjectCheckFunctions) + { + if (check(objectID, stealer, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region COPY OBJECT + public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); + private List CanCopyObjectCheckFunctions = new List(); + + public void addCheckCopyObject(CanCopyObject delegateFunc) + { + if (!CanCopyObjectCheckFunctions.Contains(delegateFunc)) + CanCopyObjectCheckFunctions.Add(delegateFunc); + } + public void removeCheckCopyObject(CanCopyObject delegateFunc) + { + if (CanCopyObjectCheckFunctions.Contains(delegateFunc)) + CanCopyObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) + { + foreach (CanCopyObject check in CanCopyObjectCheckFunctions) + { + if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region EDIT OBJECT + public delegate bool CanEditObject(LLUUID objectID, LLUUID editorID, Scene scene); + private List CanEditObjectCheckFunctions = new List(); + + public void addCheckEditObject(CanEditObject delegateFunc) + { + if (!CanEditObjectCheckFunctions.Contains(delegateFunc)) + CanEditObjectCheckFunctions.Add(delegateFunc); + } + public void removeCheckEditObject(CanEditObject delegateFunc) + { + if (CanEditObjectCheckFunctions.Contains(delegateFunc)) + CanEditObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanEditObject(LLUUID objectID, LLUUID editorID) + { + foreach (CanEditObject check in CanEditObjectCheckFunctions) + { + if (check(objectID, editorID, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region MOVE OBJECT + public delegate bool CanMoveObject(LLUUID objectID, LLUUID moverID, Scene scene); + private List CanMoveObjectCheckFunctions = new List(); + + public void addCheckMoveObject(CanMoveObject delegateFunc) + { + if (!CanMoveObjectCheckFunctions.Contains(delegateFunc)) + CanMoveObjectCheckFunctions.Add(delegateFunc); + } + public void removeCheckMoveObject(CanMoveObject delegateFunc) + { + if (CanMoveObjectCheckFunctions.Contains(delegateFunc)) + CanMoveObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanMoveObject(LLUUID objectID, LLUUID moverID) + { + foreach (CanMoveObject check in CanMoveObjectCheckFunctions) + { + if (check(objectID,moverID,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(); + + public void addCheckReturnObject(CanReturnObject delegateFunc) + { + if (!CanReturnObjectCheckFunctions.Contains(delegateFunc)) + CanReturnObjectCheckFunctions.Add(delegateFunc); + } + public void removeCheckReturnObject(CanReturnObject delegateFunc) + { + if (CanReturnObjectCheckFunctions.Contains(delegateFunc)) + CanReturnObjectCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanReturnObject(LLUUID objectID, LLUUID returnerID) + { + foreach (CanReturnObject check in CanReturnObjectCheckFunctions) + { + if (check(objectID,returnerID,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion #endregion - #region RUN SCRIPT - public delegate bool CanRunScript(LLUUID script, LLUUID owner, IScene scene); - private List CanRunScriptCheckFunctions = new List(); + #region Misc Permission Checks - public void addCheckRunScript(CanRunScript delegateFunc) - { - if (!CanRunScriptCheckFunctions.Contains(delegateFunc)) - CanRunScriptCheckFunctions.Add(delegateFunc); - } - public void removeCheckRunScript(CanRunScript delegateFunc) - { - if (CanRunScriptCheckFunctions.Contains(delegateFunc)) - CanRunScriptCheckFunctions.Remove(delegateFunc); - } + #region INSTANT MESSAGE + public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene); + private List CanInstantMessageCheckFunctions = new List(); - public bool ExternalChecksCanRunScript(LLUUID script, LLUUID owner) - { - foreach (CanRunScript check in CanRunScriptCheckFunctions) + public void addCheckInstantMessage(CanInstantMessage delegateFunc) { - if (check(script,owner,m_scene) == false) - { - return false; - } + if (!CanInstantMessageCheckFunctions.Contains(delegateFunc)) + CanInstantMessageCheckFunctions.Add(delegateFunc); } - return true; - } + public void removeCheckInstantMessage(CanInstantMessage delegateFunc) + { + if (CanInstantMessageCheckFunctions.Contains(delegateFunc)) + CanInstantMessageCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanInstantMessage(LLUUID user, LLUUID target) + { + foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) + { + if (check(user,target,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region INVENTORY TRANSFER + public delegate bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene startScene); + private List CanInventoryTransferCheckFunctions = new List(); + + public void addCheckInventoryTransfer(CanInventoryTransfer delegateFunc) + { + if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc)) + CanInventoryTransferCheckFunctions.Add(delegateFunc); + } + public void removeCheckInventoryTransfer(CanInventoryTransfer delegateFunc) + { + if (CanInventoryTransferCheckFunctions.Contains(delegateFunc)) + CanInventoryTransferCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanInventoryTransfer(LLUUID user, LLUUID target) + { + foreach (CanInventoryTransfer check in CanInventoryTransferCheckFunctions) + { + if (check(user, target, 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(); + + public void addCheckEditScript(CanEditScript delegateFunc) + { + if (!CanEditScriptCheckFunctions.Contains(delegateFunc)) + CanEditScriptCheckFunctions.Add(delegateFunc); + } + public void removeCheckEditScript(CanEditScript delegateFunc) + { + if (CanEditScriptCheckFunctions.Contains(delegateFunc)) + CanEditScriptCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanEditScript(LLUUID script, LLUUID user) + { + foreach (CanEditScript check in CanEditScriptCheckFunctions) + { + if (check(script, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region RUN SCRIPT + public delegate bool CanRunScript(LLUUID script, LLUUID user, Scene scene); + private List CanRunScriptCheckFunctions = new List(); + + public void addCheckRunScript(CanRunScript delegateFunc) + { + if (!CanRunScriptCheckFunctions.Contains(delegateFunc)) + CanRunScriptCheckFunctions.Add(delegateFunc); + } + public void removeCheckRunScript(CanRunScript delegateFunc) + { + if (CanRunScriptCheckFunctions.Contains(delegateFunc)) + CanRunScriptCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanRunScript(LLUUID script, LLUUID user) + { + foreach (CanRunScript check in CanRunScriptCheckFunctions) + { + if (check(script, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region TERRAFORM LAND + public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene); + private List CanTerraformLandCommandCheckFunctions = new List(); + + public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) + { + if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) + CanTerraformLandCommandCheckFunctions.Add(delegateFunc); + } + public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) + { + if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) + CanTerraformLandCommandCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos) + { + foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions) + { + if (check(user, pos, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region RUN CONSOLE COMMAND + public delegate bool CanRunConsoleCommand(LLUUID user, Scene requestFromScene); + private List CanRunConsoleCommandCheckFunctions = new List(); + + public void addCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc) + { + if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) + CanRunConsoleCommandCheckFunctions.Add(delegateFunc); + } + public void removeCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc) + { + if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) + CanRunConsoleCommandCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanRunConsoleCommand(LLUUID user) + { + foreach (CanRunConsoleCommand check in CanRunConsoleCommandCheckFunctions) + { + 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(); + + public void addCheckBeGodLike(CanBeGodLike delegateFunc) + { + if (!CanBeGodLikeCheckFunctions.Contains(delegateFunc)) + CanBeGodLikeCheckFunctions.Add(delegateFunc); + } + public void removeCheckBeGodLike(CanBeGodLike delegateFunc) + { + if (CanBeGodLikeCheckFunctions.Contains(delegateFunc)) + CanBeGodLikeCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanBeGodLike(LLUUID user) + { + foreach (CanBeGodLike check in CanBeGodLikeCheckFunctions) + { + if (check(user, m_scene) == false) + { + return false; + } + } + 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 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 bool ExternalChecksCanRestartSim(LLUUID user) + { + foreach (CanRestartSim check in CanRestartSimCheckFunctions) + { + 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(); + + 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 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 bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) + { + foreach (CanSellParcel check in CanSellParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } + #endregion + + #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 bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) + { + foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } + #endregion + #endregion + + } } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index e3bec9d91d..48b356a41d 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -181,7 +181,7 @@ namespace OpenSim.Region.ScriptEngine.Common m_host.AddScriptLPS(1); //Check to make sure that the script's owner is the estate manager/master //World.Permissions.GenericEstatePermission( - if (World.Permissions.GenericEstatePermission(m_host.OwnerID)) + if (World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID)) { World.EventManager.TriggerRequestChangeWaterHeight((float)height); } @@ -2647,7 +2647,7 @@ namespace OpenSim.Region.ScriptEngine.Common public void llModifyLand(int action, int brush) { m_host.AddScriptLPS(1); - if (World.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0))) + if (World.ExternalChecks.ExternalChecksCanTerraformLand(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0))) { NotImplemented("llModifyLand"); } @@ -3900,7 +3900,7 @@ namespace OpenSim.Region.ScriptEngine.Common { if (m_host.ObjectOwner == parcel.landData.ownerID || (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID - && parcel.landData.isGroupOwned) || World.Permissions.GenericEstatePermission(m_host.OwnerID)) + && parcel.landData.isGroupOwned) || World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID)) { av.StandUp(); } diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs index ddca617f06..401042ae91 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs @@ -258,7 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Common if (x > 255 || x < 0 || y > 255 || y < 0) LSLError("osTerrainSetHeight: Coordinate out of bounds"); - if (World.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0))) + if (World.ExternalChecks.ExternalChecksCanTerraformLand(m_host.OwnerID, new LLVector3(x, y, 0))) { World.Heightmap[x, y] = val; return 1; @@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Common public int osRegionRestart(double seconds) { m_host.AddScriptLPS(1); - if (World.Permissions.CanRestartSim(m_host.OwnerID)) + if (World.ExternalChecks.ExternalChecksCanRestartSim(m_host.OwnerID)) { World.Restart((float)seconds); return 1; @@ -406,7 +406,7 @@ namespace OpenSim.Region.ScriptEngine.Common if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false)) { - if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) + if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID)) { MainConsole.Instance.RunCommand(command); return true;