From ba723a4cf65e7a82f5072eaab51dc008f4a2bfd9 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 21 Nov 2008 22:14:57 +0000 Subject: Refactor: Scene.ExternalChecks -> Scene.Permissions. Also make all the internals of the permissions module adapter sane --- .../Modules/World/Estate/EstateManagementModule.cs | 12 +- .../Modules/World/Land/LandManagementModule.cs | 12 +- .../Environment/Modules/World/Land/LandObject.cs | 8 +- .../Modules/World/Permissions/PermissionsModule.cs | 82 +- .../Modules/World/Terrain/TerrainModule.cs | 8 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 66 +- .../Environment/Scenes/Scene.PacketHandlers.cs | 10 +- .../Region/Environment/Scenes/Scene.Permissions.cs | 1334 ++++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 12 +- OpenSim/Region/Environment/Scenes/SceneBase.cs | 6 +- .../Scenes/SceneCommunicationService.cs | 2 +- .../Environment/Scenes/SceneExternalChecks.cs | 1334 -------------------- OpenSim/Region/Environment/Scenes/SceneGraph.cs | 44 +- OpenSim/Region/Environment/Scenes/SceneManager.cs | 2 +- .../Scenes/SceneObjectGroup.Inventory.cs | 2 +- .../Region/Environment/Scenes/SceneObjectGroup.cs | 6 +- .../Region/Environment/Scenes/SceneObjectPart.cs | 2 +- .../Environment/Scenes/SceneObjectPartInventory.cs | 2 +- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- 19 files changed, 1473 insertions(+), 1473 deletions(-) create mode 100644 OpenSim/Region/Environment/Scenes/Scene.Permissions.cs delete mode 100644 OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 4aad3b1..d4f53ff 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate else estateOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; - if (m_scene.ExternalChecks.ExternalChecksCanBeGodLike(remote_client.AgentId)) + if (m_scene.Permissions.IsGod(remote_client.AgentId)) estateOwner = remote_client.AgentId; remote_client.SendDetailedEstateData(invoice, @@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate switch (estateAccessType) { case 64: - if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, false) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) { EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; @@ -285,7 +285,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate } break; case 128: - if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, false) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) { EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; @@ -321,7 +321,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate break; case 256: - if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, true) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) { m_scene.RegionInfo.EstateSettings.AddEstateManager(user); m_scene.RegionInfo.EstateSettings.Save(); @@ -334,7 +334,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate break; case 512: - if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, true) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) { m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); m_scene.RegionInfo.EstateSettings.Save(); @@ -742,7 +742,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate args.SimOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; // Fudge estate owner - //if (m_scene.ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId)) + //if (m_scene.Permissions.IsGod(remoteClient.AgentId)) // args.SimOwner = remoteClient.AgentId; args.terrainBase0 = UUID.Zero; diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index 99128bc..fe2458c 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -729,7 +729,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 (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id, startLandObject)) + if (!m_scene.Permissions.CanEditParcel(attempting_user_id, startLandObject)) { return; } @@ -797,7 +797,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land { return; } - if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id, masterLandObject)) + if (!m_scene.Permissions.CanEditParcel(attempting_user_id, masterLandObject)) { return; } @@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land if (land != null) { - if (m_scene.ExternalChecks.ExternalChecksCanBeGodLike(remote_client.AgentId)) + if (m_scene.Permissions.IsGod(remote_client.AgentId)) { land.landData.OwnerID = ownerID; @@ -1029,7 +1029,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land if (land != null) { - if (m_scene.ExternalChecks.ExternalChecksCanAbandonParcel(remote_client.AgentId, land)) + if (m_scene.Permissions.CanAbandonParcel(remote_client.AgentId, land)) { if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) land.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; @@ -1051,7 +1051,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land if (land != null) { - if (m_scene.ExternalChecks.ExternalChecksCanReclaimParcel(remote_client.AgentId, land)) + if (m_scene.Permissions.CanReclaimParcel(remote_client.AgentId, land)) { if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) land.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; @@ -1321,7 +1321,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land if (land == null) return; - if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(remoteClient.AgentId, land)) + if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) return; land.landData.OtherCleanTime = otherCleanTime; diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 1483118..89256fa 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs @@ -181,14 +181,14 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client) { - if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId,this)) + if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) { //Needs later group support LandData newData = landData.Copy(); if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) { - if (m_scene.ExternalChecks.ExternalChecksCanSellParcel(remote_client.AgentId, this)) + if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) { newData.AuthBuyerID = args.AuthBuyerID; newData.SalePrice = args.SalePrice; @@ -647,7 +647,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void sendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client) { - if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this)) + if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) { List resultLocalIDs = new List(); try @@ -697,7 +697,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land /// public void sendLandObjectOwners(IClientAPI remote_client) { - if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this)) + if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) { Dictionary primCount = new Dictionary(); diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index d7865b2..9eeff0f 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs @@ -180,50 +180,50 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); //Register functions with Scene External Checks! - m_scene.ExternalChecks.addBypassPermissions(BypassPermissions); //FULLY IMPLEMENTED - m_scene.ExternalChecks.addSetBypassPermissions(SetBypassPermissions); //FULLY IMPLEMENTED - m_scene.ExternalChecks.addPropagatePermissions(PropagatePermissions); //FULLY IMPLEMENTED - m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED - m_scene.ExternalChecks.addCheckReclaimParcel(CanReclaimParcel); //FULLY IMPLEMENTED - m_scene.ExternalChecks.addGenerateClientFlags(GenerateClientFlags); //NOT YET 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.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.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED + m_scene.Permissions.AddBypassPermissionsHandler(BypassPermissions); //FULLY IMPLEMENTED + m_scene.Permissions.AddSetBypassPermissionsHandler(SetBypassPermissions); //FULLY IMPLEMENTED + m_scene.Permissions.AddPropagatePermissionsHandler(PropagatePermissions); //FULLY IMPLEMENTED + m_scene.Permissions.AddGenerateClientFlagsHandler(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED + m_scene.Permissions.AddAbandonParcelHandler(CanAbandonParcel); //FULLY IMPLEMENTED + m_scene.Permissions.AddReclaimParcelHandler(CanReclaimParcel); //FULLY IMPLEMENTED + m_scene.Permissions.AddIsGodHandler(IsGod); //FULLY IMPLEMENTED + m_scene.Permissions.AddDuplicateObjectHandler(CanDuplicateObject); //FULLY IMPLEMENTED + m_scene.Permissions.AddDeleteObjectHandler(CanDeleteObject); //MAYBE FULLY IMPLEMENTED + m_scene.Permissions.AddEditObjectHandler(CanEditObject);//MAYBE FULLY IMPLEMENTED + m_scene.Permissions.AddEditParcelHandler(CanEditParcel); //FULLY IMPLEMENTED + m_scene.Permissions.AddInstantMessageHandler(CanInstantMessage); //FULLY IMPLEMENTED + m_scene.Permissions.AddInventoryTransferHandler(CanInventoryTransfer); //NOT YET IMPLEMENTED + m_scene.Permissions.AddIssueEstateCommandHandler(CanIssueEstateCommand); //FULLY IMPLEMENTED + m_scene.Permissions.AddMoveObjectHandler(CanMoveObject); //HOPEFULLY FULLY IMPLEMENTED + m_scene.Permissions.AddObjectEntryHandler(CanObjectEntry); //FULLY IMPLEMENTED + m_scene.Permissions.AddReturnObjectHandler(CanReturnObject); //NOT YET IMPLEMENTED + m_scene.Permissions.AddRezObjectHandler(CanRezObject); //HOPEFULLY FULLY IMPLEMENTED + m_scene.Permissions.AddRunConsoleCommandHandler(CanRunConsoleCommand); //FULLY IMPLEMENTED + m_scene.Permissions.AddRunScriptHandler(CanRunScript); //NOT YET IMPLEMENTED + m_scene.Permissions.AddSellParcelHandler(CanSellParcel); //FULLY IMPLEMENTED + m_scene.Permissions.AddTakeObjectHandler(CanTakeObject); //FULLY IMPLEMENTED + m_scene.Permissions.AddTakeCopyObjectHandler(CanTakeCopyObject); //FULLY IMPLEMENTED + m_scene.Permissions.AddTerraformLandHandler(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!) + m_scene.Permissions.AddCanLinkObjectHandler(CanLinkObject); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanDelinkObjectHandler(CanDelinkObject); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanBuyLandHandler(CanBuyLand); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckViewNotecard(CanViewNotecard); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED + m_scene.Permissions.AddViewNotecardHandler(CanViewNotecard); //NOT YET IMPLEMENTED + m_scene.Permissions.AddViewScriptHandler(CanViewScript); //NOT YET IMPLEMENTED + m_scene.Permissions.AddEditNotecardHandler(CanEditNotecard); //NOT YET IMPLEMENTED + m_scene.Permissions.AddEditScriptHandler(CanEditScript); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanCreateObjectInventory(CanCreateObjectInventory); //NOT IMPLEMENTED HERE - m_scene.ExternalChecks.addCheckEditObjectInventory(CanEditObjectInventory);//MAYBE FULLY IMPLEMENTED - m_scene.ExternalChecks.addCheckCanCopyObjectInventory(CanCopyObjectInventory); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanDeleteObjectInventory(CanDeleteObjectInventory); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanCreateObjectInventoryHandler(CanCreateObjectInventory); //NOT IMPLEMENTED HERE + m_scene.Permissions.AddEditObjectInventoryHandler(CanEditObjectInventory);//MAYBE FULLY IMPLEMENTED + m_scene.Permissions.AddCanCopyObjectInventoryHandler(CanCopyObjectInventory); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanDeleteObjectInventoryHandler(CanDeleteObjectInventory); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanCreateUserInventory(CanCreateUserInventory); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanCopyUserInventory(CanCopyUserInventory); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanEditUserInventory(CanEditUserInventory); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanDeleteUserInventory(CanDeleteUserInventory); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanCreateUserInventoryHandler(CanCreateUserInventory); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanCopyUserInventoryHandler(CanCopyUserInventory); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanEditUserInventoryHandler(CanEditUserInventory); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanDeleteUserInventoryHandler(CanDeleteUserInventory); //NOT YET IMPLEMENTED - m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED + m_scene.Permissions.AddCanTeleportHandler(CanTeleport); //NOT YET IMPLEMENTED //Register Debug Commands Command bypassCommand = new Command("bypass", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBypassPermissions, "Force the permissions a specific way to test permissions"); @@ -651,7 +651,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return GenericParcelPermission(user, parcel); } - private bool CanBeGodLike(UUID user, Scene scene) + private bool IsGod(UUID user, Scene scene) { DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 3170724..5646de1 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -616,7 +616,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain private void client_OnModifyTerrain(UUID user, float height, float seconds, byte size, byte action, float north, float west, float south, float east, UUID agentId) { - bool god = m_scene.ExternalChecks.ExternalChecksCanBeGodLike(user); + bool god = m_scene.Permissions.IsGod(user); bool allowed = false; if (north == south && east == west) { @@ -641,7 +641,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain int y = zy + dy; if (x>=0 && y>=0 && x south) { - if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(agentId, new Vector3(x,y,0))) + if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x,y,0))) { fillArea[x, y] = true; allowed = true; @@ -709,7 +709,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain // Not a good permissions check (see client_OnModifyTerrain above), need to check the entire area. // for now check a point in the centre of the region - if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remoteClient.AgentId, true)) + if (m_scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, true)) { InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter } diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 686f4ba..9b30d87 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -105,7 +105,7 @@ namespace OpenSim.Region.Environment.Scenes userInfo.AddItem(item); int userlevel = 0; - if (ExternalChecks.ExternalChecksCanBeGodLike(AgentID)) + if (Permissions.IsGod(AgentID)) { userlevel = 1; } @@ -171,7 +171,7 @@ namespace OpenSim.Region.Environment.Scenes { if ((InventoryType) item.InvType == InventoryType.Notecard) { - if (!ExternalChecks.ExternalChecksCanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) + if (!Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) { remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); return UUID.Zero; @@ -180,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes } else if ((InventoryType) item.InvType == InventoryType.LSL) { - if (!ExternalChecks.ExternalChecksCanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) + if (!Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) { remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); return UUID.Zero; @@ -243,7 +243,7 @@ namespace OpenSim.Region.Environment.Scenes public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, UUID primId, bool isScriptRunning, byte[] data) { - if (!ExternalChecks.ExternalChecksCanEditScript(itemId, primId, remoteClient.AgentId)) + if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId)) { remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); return; @@ -432,7 +432,7 @@ namespace OpenSim.Region.Environment.Scenes if (item != null) { - if (!ExternalChecks.ExternalChecksBypassPermissions()) + if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) return null; @@ -458,7 +458,7 @@ namespace OpenSim.Region.Environment.Scenes itemCopy.AssetType = item.AssetType; itemCopy.InvType = item.InvType; itemCopy.Folder = UUID.Zero; - if (ExternalChecks.ExternalChecksPropagatePermissions()) + if (Permissions.PropagatePermissions()) { if (item.InvType == 6) { @@ -500,7 +500,7 @@ namespace OpenSim.Region.Environment.Scenes recipientUserInfo.AddItem(itemCopy); - if (!ExternalChecks.ExternalChecksBypassPermissions()) + if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) senderUserInfo.DeleteItem(itemId); @@ -764,7 +764,7 @@ namespace OpenSim.Region.Environment.Scenes { m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); - if (!ExternalChecks.ExternalChecksCanCreateUserInventory(invType, remoteClient.AgentId)) + if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; if (transactionID == UUID.Zero) @@ -975,7 +975,7 @@ namespace OpenSim.Region.Environment.Scenes agentItem.InvType = taskItem.InvType; agentItem.Flags = taskItem.Flags; - if ((destAgent != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) + if ((destAgent != taskItem.OwnerID) && Permissions.PropagatePermissions()) { agentItem.BasePermissions = taskItem.NextPermissions; agentItem.CurrentPermissions = taskItem.NextPermissions | 8; @@ -992,7 +992,7 @@ namespace OpenSim.Region.Environment.Scenes agentItem.GroupPermissions = taskItem.GroupPermissions; } - if (!ExternalChecks.ExternalChecksBypassPermissions()) + if (!Permissions.BypassPermissions()) { if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) part.Inventory.RemoveInventoryItem(itemId); @@ -1165,7 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes if (destPart.OwnerID != part.OwnerID) { - if (ExternalChecks.ExternalChecksPropagatePermissions()) + if (Permissions.PropagatePermissions()) { destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & srcTaskItem.NextPermissions; @@ -1262,7 +1262,7 @@ namespace OpenSim.Region.Environment.Scenes // AllowInventoryDrop flag has been set. Don't however let // them update an item unless they pass the external checks // - if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId) + if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId) && (currentItem != null || !allowInventoryDrop)) return; @@ -1291,7 +1291,7 @@ namespace OpenSim.Region.Environment.Scenes "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", item.Name, primLocalID, remoteClient.Name); part.GetProperties(remoteClient); - if (!ExternalChecks.ExternalChecksBypassPermissions()) + if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) RemoveInventoryItem(remoteClient, itemID); @@ -1358,7 +1358,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart part = GetSceneObjectPart(localID); if (part != null) { - if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) + if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) return; part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); @@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Environment.Scenes if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) return; - if (!ExternalChecks.ExternalChecksCanCreateObjectInventory( + if (!Permissions.CanCreateObjectInventory( itemBase.InvType, part.UUID, remoteClient.AgentId)) return; @@ -1506,7 +1506,7 @@ namespace OpenSim.Region.Environment.Scenes if (destPart.OwnerID != srcPart.OwnerID) { - if (ExternalChecks.ExternalChecksPropagatePermissions()) + if (Permissions.PropagatePermissions()) { destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & srcTaskItem.NextPermissions; @@ -1567,20 +1567,20 @@ namespace OpenSim.Region.Environment.Scenes if (destination == 1) // Take Copy { permissionToTake = - ExternalChecks.ExternalChecksCanTakeCopyObject( + Permissions.CanTakeCopyObject( grp.UUID, remoteClient.AgentId); } else if (destination == 5) // God take copy { permissionToTake = - ExternalChecks.ExternalChecksCanBeGodLike( + Permissions.IsGod( remoteClient.AgentId); } else if (destination == 4) // Take { permissionToTake = - ExternalChecks.ExternalChecksCanTakeObject( + Permissions.CanTakeObject( grp.UUID, remoteClient.AgentId); @@ -1590,11 +1590,11 @@ namespace OpenSim.Region.Environment.Scenes else if (destination == 6) //Delete { permissionToTake = - ExternalChecks.ExternalChecksCanDeleteObject( + Permissions.CanDeleteObject( grp.UUID, remoteClient.AgentId); permissionToDelete = - ExternalChecks.ExternalChecksCanDeleteObject( + Permissions.CanDeleteObject( grp.UUID, remoteClient.AgentId); } @@ -1603,11 +1603,11 @@ namespace OpenSim.Region.Environment.Scenes if (remoteClient != null) { permissionToTake = - ExternalChecks.ExternalChecksCanDeleteObject( + Permissions.CanDeleteObject( grp.UUID, remoteClient.AgentId); permissionToDelete = - ExternalChecks.ExternalChecksCanDeleteObject( + Permissions.CanDeleteObject( grp.UUID, remoteClient.AgentId); if (permissionToDelete) @@ -1722,7 +1722,7 @@ namespace OpenSim.Region.Environment.Scenes item.InvType = (int)InventoryType.Object; item.Folder = folderID; - if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) + if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) { uint perms=objectGroup.GetEffectivePermissions(); uint nextPerms=(perms & 7) << 13; @@ -1877,7 +1877,7 @@ namespace OpenSim.Region.Environment.Scenes item.Folder = UUID.Zero; // Objects folder! - if ((remoteClient.AgentId != grp.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) + if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) { item.BasePermissions = grp.RootPart.NextOwnerMask; item.CurrentPermissions = grp.RootPart.NextOwnerMask; @@ -1988,7 +1988,7 @@ namespace OpenSim.Region.Environment.Scenes { string xmlData = Utils.BytesToString(rezAsset.Data); SceneObjectGroup group = new SceneObjectGroup(xmlData, true); - if (!ExternalChecks.ExternalChecksCanRezObject( + if (!Permissions.CanRezObject( group.Children.Count, remoteClient.AgentId, pos) && !attachment) { @@ -2043,7 +2043,7 @@ namespace OpenSim.Region.Environment.Scenes rootPart.ObjectSaleType = 0; rootPart.SalePrice = 10; - if (ExternalChecks.ExternalChecksPropagatePermissions()) + if (Permissions.PropagatePermissions()) { if ((item.CurrentPermissions & 8) != 0) { @@ -2093,7 +2093,7 @@ namespace OpenSim.Region.Environment.Scenes if (!attachment) rootPart.ScheduleFullUpdate(); - if (!ExternalChecks.ExternalChecksBypassPermissions()) + if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) userInfo.DeleteItem(item.ID); @@ -2133,7 +2133,7 @@ namespace OpenSim.Region.Environment.Scenes string xmlData = Utils.BytesToString(rezAsset.Data); SceneObjectGroup group = new SceneObjectGroup(xmlData, true); - if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count, ownerID, pos)) + if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos)) { return null; } @@ -2158,7 +2158,7 @@ namespace OpenSim.Region.Environment.Scenes if (rootPart.OwnerID != item.OwnerID) { - if (ExternalChecks.ExternalChecksPropagatePermissions()) + if (Permissions.PropagatePermissions()) { if ((item.CurrentPermissions & 8) != 0) { @@ -2197,7 +2197,7 @@ namespace OpenSim.Region.Environment.Scenes group.CreateScriptInstances(param, true, DefaultScriptEngine, 2); rootPart.ScheduleFullUpdate(); - if (!ExternalChecks.ExternalChecksBypassPermissions()) + if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) sourcePart.Inventory.RemoveInventoryItem(item.ItemID); @@ -2315,7 +2315,7 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence presence; if (TryGetAvatar(remoteClient.AgentId, out presence)) { - if (!ExternalChecks.ExternalChecksCanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) + if (!Permissions.CanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) return; presence.Appearance.DetachAttachment(itemID); @@ -2359,7 +2359,7 @@ namespace OpenSim.Region.Environment.Scenes void ObjectOwner(IClientAPI remoteClient, UUID ownerID, UUID groupID, List localIDs) { - if (!ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId)) + if (!Permissions.IsGod(remoteClient.AgentId)) return; foreach (uint localID in localIDs) diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index c9c7bef..97846cf 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -113,8 +113,8 @@ namespace OpenSim.Region.Environment.Scenes ((SceneObjectGroup) ent).GetProperties(remoteClient); ((SceneObjectGroup) ent).IsSelected = true; // A prim is only tainted if it's allowed to be edited by the person clicking it. - if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) - || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) + if (Permissions.CanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) + || Permissions.CanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) { EventManager.TriggerParcelPrimCountTainted(); } @@ -181,9 +181,9 @@ namespace OpenSim.Region.Environment.Scenes // if (!isAttachment) { - if (ExternalChecks.ExternalChecksCanEditObject( + if (Permissions.CanEditObject( part.UUID, remoteClient.AgentId) - || ExternalChecks.ExternalChecksCanMoveObject( + || Permissions.CanMoveObject( part.UUID, remoteClient.AgentId)) EventManager.TriggerParcelPrimCountTainted(); } @@ -337,7 +337,7 @@ namespace OpenSim.Region.Environment.Scenes if (part == null) return; - if (ExternalChecks.ExternalChecksCanResetScript(itemID, remoteClient.AgentId)) + if (Permissions.CanResetScript(itemID, remoteClient.AgentId)) { EventManager.TriggerScriptReset(part.LocalId, itemID); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.Permissions.cs b/OpenSim/Region/Environment/Scenes/Scene.Permissions.cs new file mode 100644 index 0000000..3a5a3d1 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scene.Permissions.cs @@ -0,0 +1,1334 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Environment.Interfaces; + +namespace OpenSim.Region.Environment.Scenes +{ + public class ScenePermissions + { + private Scene m_scene; + + public ScenePermissions(Scene scene) + { + m_scene = scene; + } + + #region Object Permission Checks + + public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectIDID); + private List GenerateClientFlagsCheckFunctions = new List(); + + public void AddGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc) + { + if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) + GenerateClientFlagsCheckFunctions.Add(delegateFunc); + } + + public void RemoveGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc) + { + if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) + GenerateClientFlagsCheckFunctions.Remove(delegateFunc); + } + + public uint GenerateClientFlags(UUID userID, UUID objectID) + { + SceneObjectPart part=m_scene.GetSceneObjectPart(objectID); + + if (part == null) + return 0; + + // libomv will moan about PrimFlags.ObjectYouOfficer being + // obsolete... + #pragma warning disable 0612 + uint perms=part.GetEffectiveObjectFlags() | + (uint)PrimFlags.ObjectModify | + (uint)PrimFlags.ObjectCopy | + (uint)PrimFlags.ObjectMove | + (uint)PrimFlags.ObjectTransfer | + (uint)PrimFlags.ObjectYouOwner | + (uint)PrimFlags.ObjectAnyOwner | + (uint)PrimFlags.ObjectOwnerModify | + (uint)PrimFlags.ObjectYouOfficer; + #pragma warning restore 0612 + + foreach (GenerateClientFlagsHandler check in GenerateClientFlagsCheckFunctions) + { + perms &= check(userID, objectID); + } + return perms; + } + + public delegate void SetBypassPermissionsHandler(bool value); + private List SetBypassPermissionsCheckFunctions = new List(); + + public void AddSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc) + { + if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) + SetBypassPermissionsCheckFunctions.Add(delegateFunc); + } + + public void RemoveSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc) + { + if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) + SetBypassPermissionsCheckFunctions.Remove(delegateFunc); + } + + public void SetBypassPermissions(bool value) + { + foreach (SetBypassPermissionsHandler check in SetBypassPermissionsCheckFunctions) + { + check(value); + } + } + + public delegate bool BypassPermissionsHandler(); + private List BypassPermissionsCheckFunctions = new List(); + + public void AddBypassPermissionsHandler(BypassPermissionsHandler delegateFunc) + { + if (!BypassPermissionsCheckFunctions.Contains(delegateFunc)) + BypassPermissionsCheckFunctions.Add(delegateFunc); + } + + public void RemoveBypassPermissionsHandler(BypassPermissionsHandler delegateFunc) + { + if (BypassPermissionsCheckFunctions.Contains(delegateFunc)) + BypassPermissionsCheckFunctions.Remove(delegateFunc); + } + + public bool BypassPermissions() + { + foreach (BypassPermissionsHandler check in BypassPermissionsCheckFunctions) + { + if (check() == false) + { + return false; + } + } + return true; + } + + public delegate bool PropagatePermissionsHandler(); + private List PropagatePermissionsCheckFunctions = new List(); + + public void AddPropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc) + { + if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc)) + PropagatePermissionsCheckFunctions.Add(delegateFunc); + } + + public void RemovePropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc) + { + if (PropagatePermissionsCheckFunctions.Contains(delegateFunc)) + PropagatePermissionsCheckFunctions.Remove(delegateFunc); + } + + public bool PropagatePermissions() + { + foreach (PropagatePermissionsHandler check in PropagatePermissionsCheckFunctions) + { + if (check() == false) + { + return false; + } + } + return true; + } + + #region REZ OBJECT + public delegate bool CanRezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); + private List CanRezObjectCheckFunctions = new List(); + + public void AddRezObjectHandler(CanRezObjectHandler delegateFunc) + { + if (!CanRezObjectCheckFunctions.Contains(delegateFunc)) + CanRezObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveRezObjectHandler(CanRezObjectHandler delegateFunc) + { + if (CanRezObjectCheckFunctions.Contains(delegateFunc)) + CanRezObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition) + { + foreach (CanRezObjectHandler check in CanRezObjectCheckFunctions) + { + if (check(objectCount, owner,objectPosition, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region DELETE OBJECT + public delegate bool CanDeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); + private List CanDeleteObjectCheckFunctions = new List(); + + public void AddDeleteObjectHandler(CanDeleteObjectHandler delegateFunc) + { + if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveDeleteObjectHandler(CanDeleteObjectHandler delegateFunc) + { + if (CanDeleteObjectCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanDeleteObject(UUID objectID, UUID deleter) + { + foreach (CanDeleteObjectHandler check in CanDeleteObjectCheckFunctions) + { + if (check(objectID,deleter,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region TAKE OBJECT + public delegate bool CanTakeObjectHandler(UUID objectID, UUID stealer, Scene scene); + private List CanTakeObjectCheckFunctions = new List(); + + public void AddTakeObjectHandler(CanTakeObjectHandler delegateFunc) + { + if (!CanTakeObjectCheckFunctions.Contains(delegateFunc)) + CanTakeObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveTakeObjectHandler(CanTakeObjectHandler delegateFunc) + { + if (CanTakeObjectCheckFunctions.Contains(delegateFunc)) + CanTakeObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) + { + foreach (CanTakeObjectHandler check in CanTakeObjectCheckFunctions) + { + if (check(objectID, AvatarTakingUUID, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region TAKE COPY OBJECT + public delegate bool CanTakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); + private List CanTakeCopyObjectCheckFunctions = new List(); + + public void AddTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc) + { + if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) + CanTakeCopyObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc) + { + if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) + CanTakeCopyObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanTakeCopyObject(UUID objectID, UUID userID) + { + foreach (CanTakeCopyObjectHandler check in CanTakeCopyObjectCheckFunctions) + { + if (check(objectID,userID,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region DUPLICATE OBJECT + public delegate bool CanDuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); + private List CanDuplicateObjectCheckFunctions = new List(); + + public void AddDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc) + { + if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) + CanDuplicateObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc) + { + if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc)) + CanDuplicateObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition) + { + foreach (CanDuplicateObjectHandler check in CanDuplicateObjectCheckFunctions) + { + if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region EDIT OBJECT + public delegate bool CanEditObjectHandler(UUID objectID, UUID editorID, Scene scene); + private List CanEditObjectCheckFunctions = new List(); + + public void AddEditObjectHandler(CanEditObjectHandler delegateFunc) + { + if (!CanEditObjectCheckFunctions.Contains(delegateFunc)) + CanEditObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveEditObjectHandler(CanEditObjectHandler delegateFunc) + { + if (CanEditObjectCheckFunctions.Contains(delegateFunc)) + CanEditObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanEditObject(UUID objectID, UUID editorID) + { + foreach (CanEditObjectHandler check in CanEditObjectCheckFunctions) + { + if (check(objectID, editorID, m_scene) == false) + { + return false; + } + } + return true; + } + + public delegate bool CanEditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); + private List CanEditObjectInventoryCheckFunctions = new List(); + + public void AddEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc) + { + if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanEditObjectInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc) + { + if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanEditObjectInventoryCheckFunctions.Remove(delegateFunc); + } + + public bool CanEditObjectInventory(UUID objectID, UUID editorID) + { + foreach (CanEditObjectInventoryHandler check in CanEditObjectInventoryCheckFunctions) + { + if (check(objectID, editorID, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region MOVE OBJECT + public delegate bool CanMoveObjectHandler(UUID objectID, UUID moverID, Scene scene); + private List CanMoveObjectCheckFunctions = new List(); + + public void AddMoveObjectHandler(CanMoveObjectHandler delegateFunc) + { + if (!CanMoveObjectCheckFunctions.Contains(delegateFunc)) + CanMoveObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveMoveObjectHandler(CanMoveObjectHandler delegateFunc) + { + if (CanMoveObjectCheckFunctions.Contains(delegateFunc)) + CanMoveObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanMoveObject(UUID objectID, UUID moverID) + { + foreach (CanMoveObjectHandler check in CanMoveObjectCheckFunctions) + { + if (check(objectID,moverID,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region OBJECT ENTRY + public delegate bool CanObjectEntryHandler(UUID objectID, Vector3 newPoint, Scene scene); + private List CanObjectEntryCheckFunctions = new List(); + + public void AddObjectEntryHandler(CanObjectEntryHandler delegateFunc) + { + if (!CanObjectEntryCheckFunctions.Contains(delegateFunc)) + CanObjectEntryCheckFunctions.Add(delegateFunc); + } + + public void RemoveObjectEntryHandler(CanObjectEntryHandler delegateFunc) + { + if (CanObjectEntryCheckFunctions.Contains(delegateFunc)) + CanObjectEntryCheckFunctions.Remove(delegateFunc); + } + + public bool CanObjectEntry(UUID objectID, Vector3 newPoint) + { + foreach (CanObjectEntryHandler check in CanObjectEntryCheckFunctions) + { + if (check(objectID, newPoint, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region RETURN OBJECT + public delegate bool CanReturnObjectHandler(UUID objectID, UUID returnerID, Scene scene); + private List CanReturnObjectCheckFunctions = new List(); + + public void AddReturnObjectHandler(CanReturnObjectHandler delegateFunc) + { + if (!CanReturnObjectCheckFunctions.Contains(delegateFunc)) + CanReturnObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveReturnObjectHandler(CanReturnObjectHandler delegateFunc) + { + if (CanReturnObjectCheckFunctions.Contains(delegateFunc)) + CanReturnObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanReturnObject(UUID objectID, UUID returnerID) + { + foreach (CanReturnObjectHandler check in CanReturnObjectCheckFunctions) + { + if (check(objectID,returnerID,m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region INSTANT MESSAGE + public delegate bool CanInstantMessageHandler(UUID user, UUID target, Scene startScene); + private List CanInstantMessageCheckFunctions = new List(); + + public void AddInstantMessageHandler(CanInstantMessageHandler delegateFunc) + { + if (!CanInstantMessageCheckFunctions.Contains(delegateFunc)) + CanInstantMessageCheckFunctions.Add(delegateFunc); + } + + public void RemoveInstantMessageHandler(CanInstantMessageHandler delegateFunc) + { + if (CanInstantMessageCheckFunctions.Contains(delegateFunc)) + CanInstantMessageCheckFunctions.Remove(delegateFunc); + } + + public bool CanInstantMessage(UUID user, UUID target) + { + foreach (CanInstantMessageHandler check in CanInstantMessageCheckFunctions) + { + if (check(user, target, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region INVENTORY TRANSFER + public delegate bool CanInventoryTransferHandler(UUID user, UUID target, Scene startScene); + private List CanInventoryTransferCheckFunctions = new List(); + + public void AddInventoryTransferHandler(CanInventoryTransferHandler delegateFunc) + { + if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc)) + CanInventoryTransferCheckFunctions.Add(delegateFunc); + } + + public void RemoveInventoryTransferHandler(CanInventoryTransferHandler delegateFunc) + { + if (CanInventoryTransferCheckFunctions.Contains(delegateFunc)) + CanInventoryTransferCheckFunctions.Remove(delegateFunc); + } + + public bool CanInventoryTransfer(UUID user, UUID target) + { + foreach (CanInventoryTransferHandler check in CanInventoryTransferCheckFunctions) + { + if (check(user, target, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region VIEW SCRIPT + public delegate bool CanViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); + private List CanViewScriptCheckFunctions = new List(); + + public void AddViewScriptHandler(CanViewScriptHandler delegateFunc) + { + if (!CanViewScriptCheckFunctions.Contains(delegateFunc)) + CanViewScriptCheckFunctions.Add(delegateFunc); + } + + public void RemoveViewScriptHandler(CanViewScriptHandler delegateFunc) + { + if (CanViewScriptCheckFunctions.Contains(delegateFunc)) + CanViewScriptCheckFunctions.Remove(delegateFunc); + } + + public bool CanViewScript(UUID script, UUID objectID, UUID user) + { + foreach (CanViewScriptHandler check in CanViewScriptCheckFunctions) + { + if (check(script, objectID, user, m_scene) == false) + { + return false; + } + } + return true; + } + + public delegate bool CanViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene); + private List CanViewNotecardCheckFunctions = new List(); + + public void AddViewNotecardHandler(CanViewNotecardHandler delegateFunc) + { + if (!CanViewNotecardCheckFunctions.Contains(delegateFunc)) + CanViewNotecardCheckFunctions.Add(delegateFunc); + } + + public void RemoveViewNotecardHandler(CanViewNotecardHandler delegateFunc) + { + if (CanViewNotecardCheckFunctions.Contains(delegateFunc)) + CanViewNotecardCheckFunctions.Remove(delegateFunc); + } + + public bool CanViewNotecard(UUID script, UUID objectID, UUID user) + { + foreach (CanViewNotecardHandler check in CanViewNotecardCheckFunctions) + { + if (check(script, objectID, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region EDIT SCRIPT + public delegate bool CanEditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); + private List CanEditScriptCheckFunctions = new List(); + + public void AddEditScriptHandler(CanEditScriptHandler delegateFunc) + { + if (!CanEditScriptCheckFunctions.Contains(delegateFunc)) + CanEditScriptCheckFunctions.Add(delegateFunc); + } + + public void RemoveEditScriptHandler(CanEditScriptHandler delegateFunc) + { + if (CanEditScriptCheckFunctions.Contains(delegateFunc)) + CanEditScriptCheckFunctions.Remove(delegateFunc); + } + + public bool CanEditScript(UUID script, UUID objectID, UUID user) + { + foreach (CanEditScriptHandler check in CanEditScriptCheckFunctions) + { + if (check(script, objectID, user, m_scene) == false) + { + return false; + } + } + return true; + } + + public delegate bool CanEditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); + private List CanEditNotecardCheckFunctions = new List(); + + public void AddEditNotecardHandler(CanEditNotecardHandler delegateFunc) + { + if (!CanEditNotecardCheckFunctions.Contains(delegateFunc)) + CanEditNotecardCheckFunctions.Add(delegateFunc); + } + + public void RemoveEditNotecardHandler(CanEditNotecardHandler delegateFunc) + { + if (CanEditNotecardCheckFunctions.Contains(delegateFunc)) + CanEditNotecardCheckFunctions.Remove(delegateFunc); + } + + public bool CanEditNotecard(UUID script, UUID objectID, UUID user) + { + foreach (CanEditNotecardHandler check in CanEditNotecardCheckFunctions) + { + if (check(script, objectID, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region RUN SCRIPT (When Script Placed in Object) + public delegate bool CanRunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); + private List CanRunScriptCheckFunctions = new List(); + + public void AddRunScriptHandler(CanRunScriptHandler delegateFunc) + { + if (!CanRunScriptCheckFunctions.Contains(delegateFunc)) + CanRunScriptCheckFunctions.Add(delegateFunc); + } + + public void RemoveRunScriptHandler(CanRunScriptHandler delegateFunc) + { + if (CanRunScriptCheckFunctions.Contains(delegateFunc)) + CanRunScriptCheckFunctions.Remove(delegateFunc); + } + + public bool CanRunScript(UUID script, UUID objectID, UUID user) + { + foreach (CanRunScriptHandler check in CanRunScriptCheckFunctions) + { + if (check(script, objectID, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region START SCRIPT (When Script run box is Checked after placed in object) + public delegate bool CanStartScriptHandler(UUID script, UUID user, Scene scene); + private List CanStartScriptCheckFunctions = new List(); + + public void AddStartScriptHandler(CanStartScriptHandler delegateFunc) + { + if (!CanStartScriptCheckFunctions.Contains(delegateFunc)) + CanStartScriptCheckFunctions.Add(delegateFunc); + } + + public void RemoveStartScriptHandler(CanStartScriptHandler delegateFunc) + { + if (CanStartScriptCheckFunctions.Contains(delegateFunc)) + CanStartScriptCheckFunctions.Remove(delegateFunc); + } + + public bool CanStartScript(UUID script, UUID user) + { + foreach (CanStartScriptHandler check in CanStartScriptCheckFunctions) + { + if (check(script, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region STOP SCRIPT (When Script run box is unchecked after placed in object) + public delegate bool CanStopScriptHandler(UUID script, UUID user, Scene scene); + private List CanStopScriptCheckFunctions = new List(); + + public void AddStopScriptHandler(CanStopScriptHandler delegateFunc) + { + if (!CanStopScriptCheckFunctions.Contains(delegateFunc)) + CanStopScriptCheckFunctions.Add(delegateFunc); + } + + public void RemoveStopScriptHandler(CanStopScriptHandler delegateFunc) + { + if (CanStopScriptCheckFunctions.Contains(delegateFunc)) + CanStopScriptCheckFunctions.Remove(delegateFunc); + } + + public bool CanStopScript(UUID script, UUID user) + { + foreach (CanStopScriptHandler check in CanStopScriptCheckFunctions) + { + if (check(script, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region RESET SCRIPT + public delegate bool CanResetScriptHandler(UUID script, UUID user, Scene scene); + private List CanResetScriptCheckFunctions = new List(); + + public void AddResetScriptHandler(CanResetScriptHandler delegateFunc) + { + if (!CanResetScriptCheckFunctions.Contains(delegateFunc)) + CanResetScriptCheckFunctions.Add(delegateFunc); + } + + public void RemoveResetScriptHandler(CanResetScriptHandler delegateFunc) + { + if (CanResetScriptCheckFunctions.Contains(delegateFunc)) + CanResetScriptCheckFunctions.Remove(delegateFunc); + } + + public bool CanResetScript(UUID script, UUID user) + { + foreach (CanResetScriptHandler check in CanResetScriptCheckFunctions) + { + if (check(script, user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region TERRAFORM LAND + public delegate bool CanTerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene); + private List CanTerraformLandCheckFunctions = new List(); + + public void AddTerraformLandHandler(CanTerraformLandHandler delegateFunc) + { + if (!CanTerraformLandCheckFunctions.Contains(delegateFunc)) + CanTerraformLandCheckFunctions.Add(delegateFunc); + } + + public void RemoveTerraformLandHandler(CanTerraformLandHandler delegateFunc) + { + if (CanTerraformLandCheckFunctions.Contains(delegateFunc)) + CanTerraformLandCheckFunctions.Remove(delegateFunc); + } + + public bool CanTerraformLand(UUID user, Vector3 pos) + { + foreach (CanTerraformLandHandler check in CanTerraformLandCheckFunctions) + { + if (check(user, pos, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region RUN CONSOLE COMMAND + public delegate bool CanRunConsoleCommandHandler(UUID user, Scene requestFromScene); + private List CanRunConsoleCommandCheckFunctions = new List(); + + public void AddRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc) + { + if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) + CanRunConsoleCommandCheckFunctions.Add(delegateFunc); + } + + public void RemoveRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc) + { + if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc)) + CanRunConsoleCommandCheckFunctions.Remove(delegateFunc); + } + + public bool CanRunConsoleCommand(UUID user) + { + foreach (CanRunConsoleCommandHandler check in CanRunConsoleCommandCheckFunctions) + { + if (check(user, m_scene) == false) + { + return false; + } + } + return true; + } + + #endregion + + #region CAN ISSUE ESTATE COMMAND + public delegate bool CanIssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); + private List CanIssueEstateCommandCheckFunctions = new List(); + + public void AddIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc) + { + if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) + CanIssueEstateCommandCheckFunctions.Add(delegateFunc); + } + + public void RemoveIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc) + { + if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc)) + CanIssueEstateCommandCheckFunctions.Remove(delegateFunc); + } + + public bool CanIssueEstateCommand(UUID user, bool ownerCommand) + { + foreach (CanIssueEstateCommandHandler check in CanIssueEstateCommandCheckFunctions) + { + if (check(user, m_scene, ownerCommand) == false) + { + return false; + } + } + return true; + } + #endregion + + #region CAN BE GODLIKE + public delegate bool IsGodHandler(UUID user, Scene requestFromScene); + private List IsGodCheckFunctions = new List(); + + public void AddIsGodHandler(IsGodHandler delegateFunc) + { + if (!IsGodCheckFunctions.Contains(delegateFunc)) + IsGodCheckFunctions.Add(delegateFunc); + } + + public void RemoveIsGodHandler(IsGodHandler delegateFunc) + { + if (IsGodCheckFunctions.Contains(delegateFunc)) + IsGodCheckFunctions.Remove(delegateFunc); + } + + public bool IsGod(UUID user) + { + foreach (IsGodHandler check in IsGodCheckFunctions) + { + if (check(user, m_scene) == false) + { + return false; + } + } + return true; + } + #endregion + + #region EDIT PARCEL + public delegate bool CanEditParcelHandler(UUID user, ILandObject parcel, Scene scene); + private List CanEditParcelCheckFunctions = new List(); + + public void AddEditParcelHandler(CanEditParcelHandler delegateFunc) + { + if (!CanEditParcelCheckFunctions.Contains(delegateFunc)) + CanEditParcelCheckFunctions.Add(delegateFunc); + } + + public void RemoveEditParcelHandler(CanEditParcelHandler delegateFunc) + { + if (CanEditParcelCheckFunctions.Contains(delegateFunc)) + CanEditParcelCheckFunctions.Remove(delegateFunc); + } + + public bool CanEditParcel(UUID user, ILandObject parcel) + { + foreach (CanEditParcelHandler check in CanEditParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } + #endregion + + #region SELL PARCEL + public delegate bool CanSellParcelHandler(UUID user, ILandObject parcel, Scene scene); + private List CanSellParcelCheckFunctions = new List(); + + public void AddSellParcelHandler(CanSellParcelHandler delegateFunc) + { + if (!CanSellParcelCheckFunctions.Contains(delegateFunc)) + CanSellParcelCheckFunctions.Add(delegateFunc); + } + + public void RemoveSellParcelHandler(CanSellParcelHandler delegateFunc) + { + if (CanSellParcelCheckFunctions.Contains(delegateFunc)) + CanSellParcelCheckFunctions.Remove(delegateFunc); + } + + public bool CanSellParcel(UUID user, ILandObject parcel) + { + foreach (CanSellParcelHandler check in CanSellParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } + #endregion + + #region ABANDON PARCEL + public delegate bool CanAbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); + private List CanAbandonParcelCheckFunctions = new List(); + + public void AddAbandonParcelHandler(CanAbandonParcelHandler delegateFunc) + { + if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) + CanAbandonParcelCheckFunctions.Add(delegateFunc); + } + + public void RemoveAbandonParcelHandler(CanAbandonParcelHandler delegateFunc) + { + if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) + CanAbandonParcelCheckFunctions.Remove(delegateFunc); + } + + public bool CanAbandonParcel(UUID user, ILandObject parcel) + { + foreach (CanAbandonParcelHandler check in CanAbandonParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } + #endregion + + public delegate bool CanReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); + private List CanReclaimParcelCheckFunctions = new List(); + + public void AddReclaimParcelHandler(CanReclaimParcelHandler delegateFunc) + { + if (!CanReclaimParcelCheckFunctions.Contains(delegateFunc)) + CanReclaimParcelCheckFunctions.Add(delegateFunc); + } + + public void RemoveReclaimParcelHandler(CanReclaimParcelHandler delegateFunc) + { + if (CanReclaimParcelCheckFunctions.Contains(delegateFunc)) + CanReclaimParcelCheckFunctions.Remove(delegateFunc); + } + + public bool CanReclaimParcel(UUID user, ILandObject parcel) + { + foreach (CanReclaimParcelHandler check in CanReclaimParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } + public delegate bool CanBuyLandHandler(UUID user, ILandObject parcel, Scene scene); + private List CanBuyLandCheckFunctions = new List(); + + public void AddCanBuyLandHandler(CanBuyLandHandler delegateFunc) + { + if (!CanBuyLandCheckFunctions.Contains(delegateFunc)) + CanBuyLandCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanBuyLandHandler(CanBuyLandHandler delegateFunc) + { + if (CanBuyLandCheckFunctions.Contains(delegateFunc)) + CanBuyLandCheckFunctions.Remove(delegateFunc); + } + + public bool CanBuyLand(UUID user, ILandObject parcel) + { + foreach (CanBuyLandHandler check in CanBuyLandCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } + + public delegate bool CanLinkObjectHandler(UUID user, UUID objectID); + private List CanLinkObjectCheckFunctions = new List(); + + public void AddCanLinkObjectHandler(CanLinkObjectHandler delegateFunc) + { + if (!CanLinkObjectCheckFunctions.Contains(delegateFunc)) + CanLinkObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanLinkObjectHandler(CanLinkObjectHandler delegateFunc) + { + if (CanLinkObjectCheckFunctions.Contains(delegateFunc)) + CanLinkObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanLinkObject(UUID user, UUID objectID) + { + foreach (CanLinkObjectHandler check in CanLinkObjectCheckFunctions) + { + if (check(user, objectID) == false) + { + return false; + } + } + return true; + } + + public delegate bool CanDelinkObjectHandler(UUID user, UUID objectID); + private List CanDelinkObjectCheckFunctions = new List(); + + public void AddCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc) + { + if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc)) + CanDelinkObjectCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc) + { + if (CanDelinkObjectCheckFunctions.Contains(delegateFunc)) + CanDelinkObjectCheckFunctions.Remove(delegateFunc); + } + + public bool CanDelinkObject(UUID user, UUID objectID) + { + foreach (CanDelinkObjectHandler check in CanDelinkObjectCheckFunctions) + { + if (check(user, objectID) == false) + { + return false; + } + } + return true; + } + + #endregion + + public delegate bool CanCreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); + private List CanCreateObjectInventoryCheckFunctions + = new List(); + + + public void AddCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc) + { + if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateObjectInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc) + { + if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to directly create the given inventory type in a prim's + /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). + /// + /// + /// + /// + /// + public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID) + { + foreach (CanCreateObjectInventoryHandler check in CanCreateObjectInventoryCheckFunctions) + { + if (check(invType, objectID, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanCopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); + private List CanCopyObjectInventoryCheckFunctions = new List(); + + public void AddCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc) + { + if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyObjectInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc) + { + if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc); + } + + public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) + { + foreach (CanCopyObjectInventoryHandler check in CanCopyObjectInventoryCheckFunctions) + { + if (check(itemID, objectID, userID) == false) + { + return false; + } + } + return true; + } + + public delegate bool CanDeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); + private List CanDeleteObjectInventoryCheckFunctions + = new List(); + + public void AddCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc) + { + if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc) + { + if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc); + } + + public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) + { + foreach (CanDeleteObjectInventoryHandler check in CanDeleteObjectInventoryCheckFunctions) + { + if (check(itemID, objectID, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanCreateUserInventoryHandler(int invType, UUID userID); + private List CanCreateUserInventoryCheckFunctions + = new List(); + + public void AddCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc) + { + if (!CanCreateUserInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateUserInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc) + { + if (CanCreateUserInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateUserInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to create the given inventory type in their inventory. + /// + /// + /// + /// + public bool CanCreateUserInventory(int invType, UUID userID) + { + foreach (CanCreateUserInventoryHandler check in CanCreateUserInventoryCheckFunctions) + { + if (check(invType, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanEditUserInventoryHandler(UUID itemID, UUID userID); + private List CanEditUserInventoryCheckFunctions + = new List(); + + public void AddCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc) + { + if (!CanEditUserInventoryCheckFunctions.Contains(delegateFunc)) + CanEditUserInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc) + { + if (CanEditUserInventoryCheckFunctions.Contains(delegateFunc)) + CanEditUserInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. + /// + /// + /// + /// + public bool CanEditUserInventory(UUID itemID, UUID userID) + { + foreach (CanEditUserInventoryHandler check in CanEditUserInventoryCheckFunctions) + { + if (check(itemID, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanCopyUserInventoryHandler(UUID itemID, UUID userID); + private List CanCopyUserInventoryCheckFunctions + = new List(); + + public void AddCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc) + { + if (!CanCopyUserInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyUserInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc) + { + if (CanCopyUserInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyUserInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. + /// + /// + /// + /// + public bool CanCopyUserInventory(UUID itemID, UUID userID) + { + foreach (CanCopyUserInventoryHandler check in CanCopyUserInventoryCheckFunctions) + { + if (check(itemID, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanDeleteUserInventoryHandler(UUID itemID, UUID userID); + private List CanDeleteUserInventoryCheckFunctions + = new List(); + + public void AddCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc) + { + if (!CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteUserInventoryCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc) + { + if (CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteUserInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. + /// + /// + /// + /// + public bool CanDeleteUserInventory(UUID itemID, UUID userID) + { + foreach (CanDeleteUserInventoryHandler check in CanDeleteUserInventoryCheckFunctions) + { + if (check(itemID, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanTeleportHandler(UUID userID); + private List CanTeleportCheckFunctions = new List(); + + public void AddCanTeleportHandler(CanTeleportHandler delegateFunc) + { + if (!CanTeleportCheckFunctions.Contains(delegateFunc)) + CanTeleportCheckFunctions.Add(delegateFunc); + } + + public void RemoveCanTeleportHandler(CanTeleportHandler delegateFunc) + { + if (CanTeleportCheckFunctions.Contains(delegateFunc)) + CanTeleportCheckFunctions.Remove(delegateFunc); + } + + public bool CanTeleport(UUID userID) + { + foreach (CanTeleportHandler check in CanTeleportCheckFunctions) + { + if (check(userID) == false) + { + return false; + } + } + return true; + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 9c29c44..723f874 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -293,7 +293,7 @@ namespace OpenSim.Region.Environment.Scenes m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; m_eventManager = new EventManager(); - m_externalChecks = new SceneExternalChecks(this); + m_permissions = new ScenePermissions(this); m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; @@ -1750,7 +1750,7 @@ namespace OpenSim.Region.Environment.Scenes { Vector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new Vector3(0.5f, 0.5f, 0.5f), false); - if (ExternalChecks.ExternalChecksCanRezObject(1, ownerID, pos)) + if (Permissions.CanRezObject(1, ownerID, pos)) { // rez ON the ground, not IN the ground pos.Z += 0.25F; @@ -3450,7 +3450,7 @@ namespace OpenSim.Region.Environment.Scenes } // First check that this is the sim owner - if (ExternalChecks.ExternalChecksCanBeGodLike(agentID)) + if (Permissions.IsGod(agentID)) { // Next we check for spoofing..... UUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; @@ -3527,7 +3527,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) { - if (ExternalChecks.ExternalChecksCanBeGodLike(godID)) + if (Permissions.IsGod(godID)) { if (agentID == kickUserID) { @@ -3848,7 +3848,7 @@ namespace OpenSim.Region.Environment.Scenes } else if ((parcel.landData.Flags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0) { - if (part.OwnerID == parcel.landData.OwnerID || (parcel.landData.IsGroupOwned && part.GroupID == parcel.landData.GroupID) || ExternalChecks.ExternalChecksCanBeGodLike(part.OwnerID)) + if (part.OwnerID == parcel.landData.OwnerID || (parcel.landData.IsGroupOwned && part.GroupID == parcel.landData.GroupID) || Permissions.IsGod(part.OwnerID)) { return true; } @@ -4273,7 +4273,7 @@ namespace OpenSim.Region.Environment.Scenes List partList = new List(group.Children.Values); - if (ExternalChecks.ExternalChecksPropagatePermissions()) + if (Permissions.PropagatePermissions()) { foreach (SceneObjectPart child in partList) { diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index ee0f6b1..7137c2f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -84,10 +84,10 @@ namespace OpenSim.Region.Environment.Scenes } - protected SceneExternalChecks m_externalChecks; - public SceneExternalChecks ExternalChecks + protected ScenePermissions m_permissions; + public ScenePermissions Permissions { - get { return m_externalChecks; } + get { return m_permissions; } } protected string m_datastore; diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 8167c68..64da9d4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -599,7 +599,7 @@ namespace OpenSim.Region.Environment.Scenes public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) { - if (!avatar.Scene.ExternalChecks.ExternalChecksCanTeleport(avatar.UUID)) + if (!avatar.Scene.Permissions.CanTeleport(avatar.UUID)) return; bool destRegionUp = false; diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs deleted file mode 100644 index 0977734..0000000 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ /dev/null @@ -1,1334 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Environment.Interfaces; - -namespace OpenSim.Region.Environment.Scenes -{ - public class SceneExternalChecks - { - private Scene m_scene; - - public SceneExternalChecks(Scene scene) - { - m_scene = scene; - } - - #region Object Permission Checks - - public delegate uint GenerateClientFlags(UUID userID, UUID objectIDID); - private List GenerateClientFlagsCheckFunctions = new List(); - - public void addGenerateClientFlags(GenerateClientFlags delegateFunc) - { - if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) - GenerateClientFlagsCheckFunctions.Add(delegateFunc); - } - - public void removeGenerateClientFlags(GenerateClientFlags delegateFunc) - { - if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) - GenerateClientFlagsCheckFunctions.Remove(delegateFunc); - } - - public uint ExternalChecksGenerateClientFlags(UUID userID, UUID objectID) - { - SceneObjectPart part=m_scene.GetSceneObjectPart(objectID); - - if (part == null) - return 0; - - // libomv will moan about PrimFlags.ObjectYouOfficer being - // obsolete... - #pragma warning disable 0612 - uint perms=part.GetEffectiveObjectFlags() | - (uint)PrimFlags.ObjectModify | - (uint)PrimFlags.ObjectCopy | - (uint)PrimFlags.ObjectMove | - (uint)PrimFlags.ObjectTransfer | - (uint)PrimFlags.ObjectYouOwner | - (uint)PrimFlags.ObjectAnyOwner | - (uint)PrimFlags.ObjectOwnerModify | - (uint)PrimFlags.ObjectYouOfficer; - #pragma warning restore 0612 - - foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions) - { - perms &= check(userID, objectID); - } - return perms; - } - - public delegate void SetBypassPermissions(bool value); - private List SetBypassPermissionsCheckFunctions = new List(); - - public void addSetBypassPermissions(SetBypassPermissions delegateFunc) - { - if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) - SetBypassPermissionsCheckFunctions.Add(delegateFunc); - } - - public void removeSetBypassPermissions(SetBypassPermissions delegateFunc) - { - if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc)) - SetBypassPermissionsCheckFunctions.Remove(delegateFunc); - } - - public void ExternalChecksSetBypassPermissions(bool value) - { - foreach (SetBypassPermissions check in SetBypassPermissionsCheckFunctions) - { - check(value); - } - } - - public delegate bool BypassPermissions(); - private List BypassPermissionsCheckFunctions = new List(); - - public void addBypassPermissions(BypassPermissions delegateFunc) - { - if (!BypassPermissionsCheckFunctions.Contains(delegateFunc)) - BypassPermissionsCheckFunctions.Add(delegateFunc); - } - - public void removeBypassPermissions(BypassPermissions delegateFunc) - { - if (BypassPermissionsCheckFunctions.Contains(delegateFunc)) - BypassPermissionsCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksBypassPermissions() - { - foreach (BypassPermissions check in BypassPermissionsCheckFunctions) - { - if (check() == false) - { - return false; - } - } - return true; - } - - public delegate bool PropagatePermissions(); - private List PropagatePermissionsCheckFunctions = new List(); - - public void addPropagatePermissions(PropagatePermissions delegateFunc) - { - if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc)) - PropagatePermissionsCheckFunctions.Add(delegateFunc); - } - - public void removePropagatePermissions(PropagatePermissions delegateFunc) - { - if (PropagatePermissionsCheckFunctions.Contains(delegateFunc)) - PropagatePermissionsCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksPropagatePermissions() - { - foreach (PropagatePermissions check in PropagatePermissionsCheckFunctions) - { - if (check() == false) - { - return false; - } - } - return true; - } - - #region REZ OBJECT - public delegate bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); - private List CanRezObjectCheckFunctions = new List(); - - public void addCheckRezObject(CanRezObject delegateFunc) - { - if (!CanRezObjectCheckFunctions.Contains(delegateFunc)) - CanRezObjectCheckFunctions.Add(delegateFunc); - } - - public void removeCheckRezObject(CanRezObject delegateFunc) - { - if (CanRezObjectCheckFunctions.Contains(delegateFunc)) - CanRezObjectCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanRezObject(int objectCount, UUID owner, Vector3 objectPosition) - { - foreach (CanRezObject check in CanRezObjectCheckFunctions) - { - if (check(objectCount, owner,objectPosition, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region DELETE OBJECT - public delegate bool CanDeleteObject(UUID objectID, UUID deleter, Scene scene); - private List CanDeleteObjectCheckFunctions = new List(); - - public void addCheckDeleteObject(CanDeleteObject delegateFunc) - { - if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc)) - CanDeleteObjectCheckFunctions.Add(delegateFunc); - } - - public void removeCheckDeleteObject(CanDeleteObject delegateFunc) - { - if (CanDeleteObjectCheckFunctions.Contains(delegateFunc)) - CanDeleteObjectCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanDeleteObject(UUID objectID, UUID deleter) - { - foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions) - { - if (check(objectID,deleter,m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region TAKE OBJECT - public delegate bool CanTakeObject(UUID objectID, UUID 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(UUID objectID, UUID AvatarTakingUUID) - { - foreach (CanTakeObject check in CanTakeObjectCheckFunctions) - { - if (check(objectID, AvatarTakingUUID, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region TAKE COPY OBJECT - public delegate bool CanTakeCopyObject(UUID objectID, UUID userID, Scene inScene); - private List CanTakeCopyObjectCheckFunctions = new List(); - - public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc) - { - if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) - CanTakeCopyObjectCheckFunctions.Add(delegateFunc); - } - - public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc) - { - if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc)) - CanTakeCopyObjectCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanTakeCopyObject(UUID objectID, UUID userID) - { - 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, UUID objectID, UUID owner, Scene scene, Vector3 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, UUID objectID, UUID owner, Vector3 objectPosition) - { - foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions) - { - if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region EDIT OBJECT - public delegate bool CanEditObject(UUID objectID, UUID 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(UUID objectID, UUID editorID) - { - foreach (CanEditObject check in CanEditObjectCheckFunctions) - { - if (check(objectID, editorID, m_scene) == false) - { - return false; - } - } - return true; - } - - public delegate bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene); - private List CanEditObjectInventoryCheckFunctions = new List(); - - public void addCheckEditObjectInventory(CanEditObjectInventory delegateFunc) - { - if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanEditObjectInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckEditObjectInventory(CanEditObjectInventory delegateFunc) - { - if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanEditObjectInventoryCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanEditObjectInventory(UUID objectID, UUID editorID) - { - foreach (CanEditObjectInventory check in CanEditObjectInventoryCheckFunctions) - { - if (check(objectID, editorID, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region MOVE OBJECT - public delegate bool CanMoveObject(UUID objectID, UUID 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(UUID objectID, UUID moverID) - { - foreach (CanMoveObject check in CanMoveObjectCheckFunctions) - { - if (check(objectID,moverID,m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region OBJECT ENTRY - public delegate bool CanObjectEntry(UUID objectID, Vector3 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(UUID objectID, Vector3 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(UUID objectID, UUID 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(UUID objectID, UUID returnerID) - { - foreach (CanReturnObject check in CanReturnObjectCheckFunctions) - { - if (check(objectID,returnerID,m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region INSTANT MESSAGE - public delegate bool CanInstantMessage(UUID user, UUID target, Scene startScene); - private List CanInstantMessageCheckFunctions = new List(); - - public void addCheckInstantMessage(CanInstantMessage delegateFunc) - { - if (!CanInstantMessageCheckFunctions.Contains(delegateFunc)) - CanInstantMessageCheckFunctions.Add(delegateFunc); - } - - public void removeCheckInstantMessage(CanInstantMessage delegateFunc) - { - if (CanInstantMessageCheckFunctions.Contains(delegateFunc)) - CanInstantMessageCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanInstantMessage(UUID user, UUID 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(UUID user, UUID 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(UUID user, UUID target) - { - foreach (CanInventoryTransfer check in CanInventoryTransferCheckFunctions) - { - if (check(user, target, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region VIEW SCRIPT - public delegate bool CanViewScript(UUID script, UUID objectID, UUID 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(UUID script, UUID objectID, UUID user) - { - foreach (CanViewScript check in CanViewScriptCheckFunctions) - { - if (check(script, objectID, user, m_scene) == false) - { - return false; - } - } - return true; - } - - public delegate bool CanViewNotecard(UUID script, UUID objectID, UUID user, Scene scene); - private List CanViewNotecardCheckFunctions = new List(); - - public void addCheckViewNotecard(CanViewNotecard delegateFunc) - { - if (!CanViewNotecardCheckFunctions.Contains(delegateFunc)) - CanViewNotecardCheckFunctions.Add(delegateFunc); - } - - public void removeCheckViewNotecard(CanViewNotecard delegateFunc) - { - if (CanViewNotecardCheckFunctions.Contains(delegateFunc)) - CanViewNotecardCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanViewNotecard(UUID script, UUID objectID, UUID user) - { - foreach (CanViewNotecard check in CanViewNotecardCheckFunctions) - { - if (check(script, objectID, user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region EDIT SCRIPT - public delegate bool CanEditScript(UUID script, UUID objectID, UUID 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(UUID script, UUID objectID, UUID user) - { - foreach (CanEditScript check in CanEditScriptCheckFunctions) - { - if (check(script, objectID, user, m_scene) == false) - { - return false; - } - } - return true; - } - - public delegate bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene); - private List CanEditNotecardCheckFunctions = new List(); - - public void addCheckEditNotecard(CanEditNotecard delegateFunc) - { - if (!CanEditNotecardCheckFunctions.Contains(delegateFunc)) - CanEditNotecardCheckFunctions.Add(delegateFunc); - } - - public void removeCheckEditNotecard(CanEditNotecard delegateFunc) - { - if (CanEditNotecardCheckFunctions.Contains(delegateFunc)) - CanEditNotecardCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanEditNotecard(UUID script, UUID objectID, UUID user) - { - foreach (CanEditNotecard check in CanEditNotecardCheckFunctions) - { - if (check(script, objectID, user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region RUN SCRIPT (When Script Placed in Object) - public delegate bool CanRunScript(UUID script, UUID objectID, UUID 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(UUID script, UUID objectID, UUID user) - { - foreach (CanRunScript check in CanRunScriptCheckFunctions) - { - if (check(script, objectID, user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region START SCRIPT (When Script run box is Checked after placed in object) - public delegate bool CanStartScript(UUID script, UUID user, Scene scene); - private List CanStartScriptCheckFunctions = new List(); - - public void addCheckStartScript(CanStartScript delegateFunc) - { - if (!CanStartScriptCheckFunctions.Contains(delegateFunc)) - CanStartScriptCheckFunctions.Add(delegateFunc); - } - - public void removeCheckStartScript(CanStartScript delegateFunc) - { - if (CanStartScriptCheckFunctions.Contains(delegateFunc)) - CanStartScriptCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanStartScript(UUID script, UUID user) - { - foreach (CanStartScript check in CanStartScriptCheckFunctions) - { - if (check(script, user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region STOP SCRIPT (When Script run box is unchecked after placed in object) - public delegate bool CanStopScript(UUID script, UUID user, Scene scene); - private List CanStopScriptCheckFunctions = new List(); - - public void addCheckStopScript(CanStopScript delegateFunc) - { - if (!CanStopScriptCheckFunctions.Contains(delegateFunc)) - CanStopScriptCheckFunctions.Add(delegateFunc); - } - - public void removeCheckStopScript(CanStopScript delegateFunc) - { - if (CanStopScriptCheckFunctions.Contains(delegateFunc)) - CanStopScriptCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanStopScript(UUID script, UUID user) - { - foreach (CanStopScript check in CanStopScriptCheckFunctions) - { - if (check(script, user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region RESET SCRIPT - public delegate bool CanResetScript(UUID script, UUID user, Scene scene); - private List CanResetScriptCheckFunctions = new List(); - - public void addCheckResetScript(CanResetScript delegateFunc) - { - if (!CanResetScriptCheckFunctions.Contains(delegateFunc)) - CanResetScriptCheckFunctions.Add(delegateFunc); - } - - public void removeCheckResetScript(CanResetScript delegateFunc) - { - if (CanResetScriptCheckFunctions.Contains(delegateFunc)) - CanResetScriptCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanResetScript(UUID script, UUID user) - { - foreach (CanResetScript check in CanResetScriptCheckFunctions) - { - if (check(script, user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region TERRAFORM LAND - public delegate bool CanTerraformLand(UUID user, Vector3 position, Scene requestFromScene); - private List CanTerraformLandCheckFunctions = new List(); - - public void addCheckTerraformLand(CanTerraformLand delegateFunc) - { - if (!CanTerraformLandCheckFunctions.Contains(delegateFunc)) - CanTerraformLandCheckFunctions.Add(delegateFunc); - } - - public void removeCheckTerraformLand(CanTerraformLand delegateFunc) - { - if (CanTerraformLandCheckFunctions.Contains(delegateFunc)) - CanTerraformLandCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanTerraformLand(UUID user, Vector3 pos) - { - foreach (CanTerraformLand check in CanTerraformLandCheckFunctions) - { - if (check(user, pos, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region RUN CONSOLE COMMAND - public delegate bool CanRunConsoleCommand(UUID 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(UUID user) - { - foreach (CanRunConsoleCommand check in CanRunConsoleCommandCheckFunctions) - { - if (check(user, m_scene) == false) - { - return false; - } - } - return true; - } - - #endregion - - #region CAN ISSUE ESTATE COMMAND - public delegate bool CanIssueEstateCommand(UUID user, Scene requestFromScene, bool ownerCommand); - 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(UUID user, bool ownerCommand) - { - foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions) - { - if (check(user, m_scene, ownerCommand) == false) - { - return false; - } - } - return true; - } - #endregion - - #region CAN BE GODLIKE - public delegate bool CanBeGodLike(UUID 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(UUID user) - { - foreach (CanBeGodLike check in CanBeGodLikeCheckFunctions) - { - if (check(user, m_scene) == false) - { - return false; - } - } - return true; - } - #endregion - - #region EDIT PARCEL - public delegate bool CanEditParcel(UUID 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(UUID 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(UUID 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(UUID 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(UUID 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(UUID user, ILandObject parcel) - { - foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) - { - if (check(user, parcel, m_scene) == false) - { - return false; - } - } - return true; - } - #endregion - - public delegate bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene); - private List CanReclaimParcelCheckFunctions = new List(); - - public void addCheckReclaimParcel(CanReclaimParcel delegateFunc) - { - if (!CanReclaimParcelCheckFunctions.Contains(delegateFunc)) - CanReclaimParcelCheckFunctions.Add(delegateFunc); - } - - public void removeCheckReclaimParcel(CanReclaimParcel delegateFunc) - { - if (CanReclaimParcelCheckFunctions.Contains(delegateFunc)) - CanReclaimParcelCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanReclaimParcel(UUID user, ILandObject parcel) - { - foreach (CanReclaimParcel check in CanReclaimParcelCheckFunctions) - { - if (check(user, parcel, m_scene) == false) - { - return false; - } - } - return true; - } - public delegate bool CanBuyLand(UUID user, ILandObject parcel, Scene scene); - private List CanBuyLandCheckFunctions = new List(); - - public void addCheckCanBuyLand(CanBuyLand delegateFunc) - { - if (!CanBuyLandCheckFunctions.Contains(delegateFunc)) - CanBuyLandCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanBuyLand(CanBuyLand delegateFunc) - { - if (CanBuyLandCheckFunctions.Contains(delegateFunc)) - CanBuyLandCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanBuyLand(UUID user, ILandObject parcel) - { - foreach (CanBuyLand check in CanBuyLandCheckFunctions) - { - if (check(user, parcel, m_scene) == false) - { - return false; - } - } - return true; - } - - public delegate bool CanLinkObject(UUID user, UUID objectID); - private List CanLinkObjectCheckFunctions = new List(); - - public void addCheckCanLinkObject(CanLinkObject delegateFunc) - { - if (!CanLinkObjectCheckFunctions.Contains(delegateFunc)) - CanLinkObjectCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanLinkObject(CanLinkObject delegateFunc) - { - if (CanLinkObjectCheckFunctions.Contains(delegateFunc)) - CanLinkObjectCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanLinkObject(UUID user, UUID objectID) - { - foreach (CanLinkObject check in CanLinkObjectCheckFunctions) - { - if (check(user, objectID) == false) - { - return false; - } - } - return true; - } - - public delegate bool CanDelinkObject(UUID user, UUID objectID); - private List CanDelinkObjectCheckFunctions = new List(); - - public void addCheckCanDelinkObject(CanDelinkObject delegateFunc) - { - if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc)) - CanDelinkObjectCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanDelinkObject(CanDelinkObject delegateFunc) - { - if (CanDelinkObjectCheckFunctions.Contains(delegateFunc)) - CanDelinkObjectCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanDelinkObject(UUID user, UUID objectID) - { - foreach (CanDelinkObject check in CanDelinkObjectCheckFunctions) - { - if (check(user, objectID) == false) - { - return false; - } - } - return true; - } - - #endregion - - public delegate bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID); - private List CanCreateObjectInventoryCheckFunctions - = new List(); - - - public void addCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) - { - if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanCreateObjectInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) - { - if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc); - } - - /// - /// Check whether the specified user is allowed to directly create the given inventory type in a prim's - /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). - /// - /// - /// - /// - /// - public bool ExternalChecksCanCreateObjectInventory(int invType, UUID objectID, UUID userID) - { - foreach (CanCreateObjectInventory check in CanCreateObjectInventoryCheckFunctions) - { - if (check(invType, objectID, userID) == false) - { - return false; - } - } - - return true; - } - - public delegate bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID); - private List CanCopyObjectInventoryCheckFunctions = new List(); - - public void addCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) - { - if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanCopyObjectInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) - { - if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) - { - foreach (CanCopyObjectInventory check in CanCopyObjectInventoryCheckFunctions) - { - if (check(itemID, objectID, userID) == false) - { - return false; - } - } - return true; - } - - public delegate bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID); - private List CanDeleteObjectInventoryCheckFunctions - = new List(); - - public void addCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) - { - if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) - { - if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) - CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) - { - foreach (CanDeleteObjectInventory check in CanDeleteObjectInventoryCheckFunctions) - { - if (check(itemID, objectID, userID) == false) - { - return false; - } - } - - return true; - } - - public delegate bool CanCreateUserInventory(int invType, UUID userID); - private List CanCreateUserInventoryCheckFunctions - = new List(); - - public void addCheckCanCreateUserInventory(CanCreateUserInventory delegateFunc) - { - if (!CanCreateUserInventoryCheckFunctions.Contains(delegateFunc)) - CanCreateUserInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanCreateUserInventory(CanCreateUserInventory delegateFunc) - { - if (CanCreateUserInventoryCheckFunctions.Contains(delegateFunc)) - CanCreateUserInventoryCheckFunctions.Remove(delegateFunc); - } - - /// - /// Check whether the specified user is allowed to create the given inventory type in their inventory. - /// - /// - /// - /// - public bool ExternalChecksCanCreateUserInventory(int invType, UUID userID) - { - foreach (CanCreateUserInventory check in CanCreateUserInventoryCheckFunctions) - { - if (check(invType, userID) == false) - { - return false; - } - } - - return true; - } - - public delegate bool CanEditUserInventory(UUID itemID, UUID userID); - private List CanEditUserInventoryCheckFunctions - = new List(); - - public void addCheckCanEditUserInventory(CanEditUserInventory delegateFunc) - { - if (!CanEditUserInventoryCheckFunctions.Contains(delegateFunc)) - CanEditUserInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanEditUserInventory(CanEditUserInventory delegateFunc) - { - if (CanEditUserInventoryCheckFunctions.Contains(delegateFunc)) - CanEditUserInventoryCheckFunctions.Remove(delegateFunc); - } - - /// - /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. - /// - /// - /// - /// - public bool ExternalChecksCanEditUserInventory(UUID itemID, UUID userID) - { - foreach (CanEditUserInventory check in CanEditUserInventoryCheckFunctions) - { - if (check(itemID, userID) == false) - { - return false; - } - } - - return true; - } - - public delegate bool CanCopyUserInventory(UUID itemID, UUID userID); - private List CanCopyUserInventoryCheckFunctions - = new List(); - - public void addCheckCanCopyUserInventory(CanCopyUserInventory delegateFunc) - { - if (!CanCopyUserInventoryCheckFunctions.Contains(delegateFunc)) - CanCopyUserInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanCopyUserInventory(CanCopyUserInventory delegateFunc) - { - if (CanCopyUserInventoryCheckFunctions.Contains(delegateFunc)) - CanCopyUserInventoryCheckFunctions.Remove(delegateFunc); - } - - /// - /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. - /// - /// - /// - /// - public bool ExternalChecksCanCopyUserInventory(UUID itemID, UUID userID) - { - foreach (CanCopyUserInventory check in CanCopyUserInventoryCheckFunctions) - { - if (check(itemID, userID) == false) - { - return false; - } - } - - return true; - } - - public delegate bool CanDeleteUserInventory(UUID itemID, UUID userID); - private List CanDeleteUserInventoryCheckFunctions - = new List(); - - public void addCheckCanDeleteUserInventory(CanDeleteUserInventory delegateFunc) - { - if (!CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc)) - CanDeleteUserInventoryCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanDeleteUserInventory(CanDeleteUserInventory delegateFunc) - { - if (CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc)) - CanDeleteUserInventoryCheckFunctions.Remove(delegateFunc); - } - - /// - /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. - /// - /// - /// - /// - public bool ExternalChecksCanDeleteUserInventory(UUID itemID, UUID userID) - { - foreach (CanDeleteUserInventory check in CanDeleteUserInventoryCheckFunctions) - { - if (check(itemID, userID) == false) - { - return false; - } - } - - return true; - } - - public delegate bool CanTeleport(UUID userID); - private List CanTeleportCheckFunctions = new List(); - - public void addCheckCanTeleport(CanTeleport delegateFunc) - { - if (!CanTeleportCheckFunctions.Contains(delegateFunc)) - CanTeleportCheckFunctions.Add(delegateFunc); - } - - public void removeCheckCanTeleport(CanTeleport delegateFunc) - { - if (CanTeleportCheckFunctions.Contains(delegateFunc)) - CanTeleportCheckFunctions.Remove(delegateFunc); - } - - public bool ExternalChecksCanTeleport(UUID userID) - { - foreach (CanTeleport check in CanTeleportCheckFunctions) - { - if (check(userID) == false) - { - return false; - } - } - return true; - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs index 18fe151..4c15da2 100644 --- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs @@ -431,7 +431,7 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectGroup group = (SceneObjectGroup)obj; - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) group.SetGroup(GroupID, remoteClient); else remoteClient.SendAgentAlertMessage("You don't have permission to set the group", false); @@ -455,7 +455,7 @@ namespace OpenSim.Region.Environment.Scenes if (part == null) return; - if (!m_parentScene.ExternalChecks.ExternalChecksCanTakeObject( + if (!m_parentScene.Permissions.CanTakeObject( part.UUID, remoteClient.AgentId)) return; @@ -522,7 +522,7 @@ namespace OpenSim.Region.Environment.Scenes if (((SceneObjectGroup)obj).LocalId == objectLocalID) { SceneObjectGroup group = (SceneObjectGroup)obj; - if (m_parentScene.ExternalChecks.ExternalChecksCanTakeObject(obj.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanTakeObject(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 @@ -1056,7 +1056,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { group.Resize(scale, localID); } @@ -1068,7 +1068,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { group.GroupResize(scale, localID); } @@ -1104,7 +1104,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.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) { group.UpdateSingleRotation(rot, localID); } @@ -1122,7 +1122,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.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) { group.UpdateGroupRotation(rot); } @@ -1141,7 +1141,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.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) { group.UpdateGroupRotation(pos, rot); } @@ -1159,7 +1159,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) + if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) { group.UpdateSinglePosition(pos, localID); } @@ -1185,7 +1185,7 @@ namespace OpenSim.Region.Environment.Scenes } else { - if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) + if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) { group.UpdateGroupPosition(pos); } @@ -1204,7 +1204,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) { group.UpdateTextureEntry(localID, texture); } @@ -1222,7 +1222,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { group.UpdatePrimFlags(localID, UsePhysics, IsTemporary, IsPhantom); } @@ -1241,7 +1241,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(objectID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) + if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) { group.GrabMovement(offset, pos, remoteClient); } @@ -1263,7 +1263,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { group.SetPartName(Util.CleanString(name), primLocalID); group.HasGroupChanged = true; @@ -1281,7 +1281,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { group.SetPartDescription(Util.CleanString(description), primLocalID); group.HasGroupChanged = true; @@ -1294,7 +1294,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); part.ClickAction = Convert.ToByte(clickAction); @@ -1308,7 +1308,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); part.Material = Convert.ToByte(material); @@ -1323,7 +1323,7 @@ namespace OpenSim.Region.Environment.Scenes if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,agentID)) + if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID)) { group.UpdateExtraParam(primLocalID, type, inUse, data); } @@ -1340,7 +1340,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.GetPartsFullID(primLocalID), agentID)) + if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID)) { ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; @@ -1612,12 +1612,12 @@ namespace OpenSim.Region.Environment.Scenes // libomv will complain about PrimFlags.JointWheel being // deprecated, so we #pragma warning disable 0612 - if (IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanEditObject(objid, user)) + if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(objid, user)) { obj.ParentGroup.RootPart.AddFlag(PrimFlags.JointWheel); obj.ParentGroup.HasGroupChanged = true; } - else if (!IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(objid,user)) + else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(objid,user)) { obj.ParentGroup.RootPart.RemFlag(PrimFlags.JointWheel); obj.ParentGroup.HasGroupChanged = true; @@ -1665,7 +1665,7 @@ namespace OpenSim.Region.Environment.Scenes if (originPrim != null) { - if (m_parentScene.ExternalChecks.ExternalChecksCanDuplicateObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) + if (m_parentScene.Permissions.CanDuplicateObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) { SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID, true); copy.AbsolutePosition = copy.AbsolutePosition + offset; diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 2af31d6..30dd497 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) { - ForEachCurrentScene(delegate(Scene scene) { scene.ExternalChecks.ExternalChecksSetBypassPermissions(bypassPermissions); }); + ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); } private void ForEachCurrentScene(Action func) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 9ca5564..62e680b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -157,7 +157,7 @@ namespace OpenSim.Region.Environment.Scenes if (remoteClient != null && remoteClient.AgentId != part.OwnerID && - m_scene.ExternalChecks.ExternalChecksPropagatePermissions()) + m_scene.Permissions.PropagatePermissions()) { taskItem.BasePermissions = item.BasePermissions & item.NextPermissions; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index fcda37b..0eefda1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1277,14 +1277,14 @@ namespace OpenSim.Region.Environment.Scenes public void SendFullUpdateToClient(IClientAPI remoteClient) { - SendPartFullUpdate(remoteClient, RootPart, m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); + SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); lock (m_parts) { foreach (SceneObjectPart part in m_parts.Values) { if (part != RootPart) - SendPartFullUpdate(remoteClient, part, m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(remoteClient.AgentId, part.UUID)); + SendPartFullUpdate(remoteClient, part, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID)); } } } @@ -1493,7 +1493,7 @@ namespace OpenSim.Region.Environment.Scenes if (part.OwnerID != cAgentID) { // Apply Next Owner Permissions if we're not bypassing permissions - if (!m_scene.ExternalChecks.ExternalChecksBypassPermissions()) + if (!m_scene.Permissions.BypassPermissions()) ApplyNextOwnerPermissions(); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 8a58e71..712cbac 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -2997,7 +2997,7 @@ if (m_shape != null) { public void UpdatePermissions(UUID AgentID, byte field, uint localID, uint mask, byte addRemTF) { bool set = addRemTF == 1; - bool god = m_parentGroup.Scene.ExternalChecks.ExternalChecksCanBeGodLike(AgentID); + bool god = m_parentGroup.Scene.Permissions.IsGod(AgentID); uint baseMask = _baseMask; if (god) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs index 0a6f22c..aff1ef1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs @@ -230,7 +230,7 @@ namespace OpenSim.Region.Environment.Scenes // "Starting script {0}, {1} in prim {2}, {3}", // item.Name, item.ItemID, Name, UUID); - if (!m_part.ParentGroup.Scene.ExternalChecks.ExternalChecksCanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) + if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) return; m_part.AddFlag(PrimFlags.Scripted); diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index b293f9e..042a4fb 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -577,7 +577,7 @@ namespace OpenSim.Region.Environment.Scenes public uint GenerateClientFlags(UUID ObjectID) { - return m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(m_uuid, ObjectID); + return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID); } /// -- cgit v1.1