From bf68255b86093afe68392973054af7c3e2f2121b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 13 Nov 2008 19:16:15 +0000 Subject: * refactor: rename object inventory permission checks to distinguish between task inventory and agent inventory --- .../Region/Environment/Scenes/Scene.Inventory.cs | 3 +- .../Environment/Scenes/SceneExternalChecks.cs | 76 +++++++++++++--------- 2 files changed, 47 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 19c9d08..d47e068 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1387,7 +1387,8 @@ namespace OpenSim.Region.Environment.Scenes if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) return; - if (!ExternalChecks.ExternalChecksCanCreateInventory(itemBase.InvType, part.UUID, remoteClient.AgentId)) + if (!ExternalChecks.ExternalChecksCanCreateObjectInventory( + itemBase.InvType, part.UUID, remoteClient.AgentId)) return; AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index c5bbcdd..0e018e8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs @@ -1070,51 +1070,63 @@ namespace OpenSim.Region.Environment.Scenes #endregion - public delegate bool CanCreateInventory(int invType, UUID objectID, UUID userID); - private List CanCreateInventoryCheckFunctions = new List(); + public delegate bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID); + private List CanCreateObjectInventoryCheckFunctions + = new List(); - public void addCheckCanCreateInventory(CanCreateInventory delegateFunc) + + public void addCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) { - if (!CanCreateInventoryCheckFunctions.Contains(delegateFunc)) - CanCreateInventoryCheckFunctions.Add(delegateFunc); + if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateObjectInventoryCheckFunctions.Add(delegateFunc); } - public void removeCheckCanCreateInventory(CanCreateInventory delegateFunc) + public void removeCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) { - if (CanCreateInventoryCheckFunctions.Contains(delegateFunc)) - CanCreateInventoryCheckFunctions.Remove(delegateFunc); + if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc); } - public bool ExternalChecksCanCreateInventory(int invType, UUID objectID, UUID userID) + /// + /// 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). This permission check does not + /// apply to existing items that are being dragged in to that prim's inventory. + /// + /// + /// + /// + /// + public bool ExternalChecksCanCreateObjectInventory(int invType, UUID objectID, UUID userID) { - foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions) + foreach (CanCreateObjectInventory check in CanCreateObjectInventoryCheckFunctions) { if (check(invType, objectID, userID) == false) { return false; } } + return true; } - public delegate bool CanCopyInventory(UUID itemID, UUID objectID, UUID userID); - private List CanCopyInventoryCheckFunctions = new List(); + public delegate bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID); + private List CanCopyObjectInventoryCheckFunctions = new List(); - public void addCheckCanCopyInventory(CanCopyInventory delegateFunc) + public void addCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) { - if (!CanCopyInventoryCheckFunctions.Contains(delegateFunc)) - CanCopyInventoryCheckFunctions.Add(delegateFunc); + if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyObjectInventoryCheckFunctions.Add(delegateFunc); } - public void removeCheckCanCopyInventory(CanCopyInventory delegateFunc) + public void removeCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) { - if (CanCopyInventoryCheckFunctions.Contains(delegateFunc)) - CanCopyInventoryCheckFunctions.Remove(delegateFunc); + if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc); } - - public bool ExternalChecksCanCopyInventory(UUID itemID, UUID objectID, UUID userID) + + public bool ExternalChecksCanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) { - foreach (CanCopyInventory check in CanCopyInventoryCheckFunctions) + foreach (CanCopyObjectInventory check in CanCopyObjectInventoryCheckFunctions) { if (check(itemID, objectID, userID) == false) { @@ -1124,30 +1136,32 @@ namespace OpenSim.Region.Environment.Scenes return true; } - public delegate bool CanDeleteInventory(UUID itemID, UUID objectID, UUID userID); - private List CanDeleteInventoryCheckFunctions = new List(); + public delegate bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID); + private List CanDeleteObjectInventoryCheckFunctions + = new List(); - public void addCheckCanDeleteInventory(CanDeleteInventory delegateFunc) + public void addCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) { - if (!CanDeleteInventoryCheckFunctions.Contains(delegateFunc)) - CanDeleteInventoryCheckFunctions.Add(delegateFunc); + if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc); } - public void removeCheckCanDeleteInventory(CanDeleteInventory delegateFunc) + public void removeCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) { - if (CanDeleteInventoryCheckFunctions.Contains(delegateFunc)) - CanDeleteInventoryCheckFunctions.Remove(delegateFunc); + if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc); } - public bool ExternalChecksCanDeleteInventory(UUID itemID, UUID objectID, UUID userID) + public bool ExternalChecksCanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) { - foreach (CanDeleteInventory check in CanDeleteInventoryCheckFunctions) + foreach (CanDeleteObjectInventory check in CanDeleteObjectInventoryCheckFunctions) { if (check(itemID, objectID, userID) == false) { return false; } } + return true; } -- cgit v1.1