From bd61b946df3b0589b03b23780a0eb3883268220d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 13 Nov 2008 20:29:41 +0000 Subject: * Add public bool ExternalChecksCanCreateAvatarInventory(int invType, UUID userID) public bool ExternalChecksCanCopyAvatarInventory(UUID itemID, UUID userID) public bool ExternalChecksCanCopyAvatarInventory(UUID itemID, UUID userID) public bool ExternalChecksCanDeleteAvatarInventory(UUID itemID, UUID userID) to ExternalChecks to handle avatar inventory checks (as opposed to object inv checks). * opensim-dev e-mail to follow concerning this shortly --- .../Environment/Scenes/SceneExternalChecks.cs | 143 ++++++++++++++++++++- 1 file changed, 141 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 0e018e8..cc627b0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs @@ -1089,8 +1089,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// 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. + /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). /// /// /// @@ -1164,7 +1163,147 @@ namespace OpenSim.Region.Environment.Scenes return true; } + + public delegate bool CanCreateAvatarInventory(int invType, UUID userID); + private List CanCreateAvatarInventoryCheckFunctions + = new List(); + + public void addCheckCanCreateAvatarInventory(CanCreateAvatarInventory delegateFunc) + { + if (!CanCreateAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateAvatarInventoryCheckFunctions.Add(delegateFunc); + } + + public void removeCheckCanCreateAvatarInventory(CanCreateAvatarInventory delegateFunc) + { + if (CanCreateAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanCreateAvatarInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to create the given inventory type in their inventory. + /// + /// + /// + /// + public bool ExternalChecksCanCreateAvatarInventory(int invType, UUID userID) + { + foreach (CanCreateAvatarInventory check in CanCreateAvatarInventoryCheckFunctions) + { + if (check(invType, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanEditAvatarInventory(UUID itemID, UUID userID); + private List CanEditAvatarInventoryCheckFunctions + = new List(); + + public void addCheckCanEditAvatarInventory(CanEditAvatarInventory delegateFunc) + { + if (!CanEditAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanEditAvatarInventoryCheckFunctions.Add(delegateFunc); + } + public void removeCheckCanEditAvatarInventory(CanEditAvatarInventory delegateFunc) + { + if (CanEditAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanEditAvatarInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. + /// + /// + /// + /// + public bool ExternalChecksCanEditAvatarInventory(UUID itemID, UUID userID) + { + foreach (CanEditAvatarInventory check in CanEditAvatarInventoryCheckFunctions) + { + if (check(itemID, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanCopyAvatarInventory(UUID itemID, UUID userID); + private List CanCopyAvatarInventoryCheckFunctions + = new List(); + + public void addCheckCanCopyAvatarInventory(CanCopyAvatarInventory delegateFunc) + { + if (!CanCopyAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyAvatarInventoryCheckFunctions.Add(delegateFunc); + } + + public void removeCheckCanCopyAvatarInventory(CanCopyAvatarInventory delegateFunc) + { + if (CanCopyAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanCopyAvatarInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. + /// + /// + /// + /// + public bool ExternalChecksCanCopyAvatarInventory(UUID itemID, UUID userID) + { + foreach (CanCopyAvatarInventory check in CanCopyAvatarInventoryCheckFunctions) + { + if (check(itemID, userID) == false) + { + return false; + } + } + + return true; + } + + public delegate bool CanDeleteAvatarInventory(UUID itemID, UUID userID); + private List CanDeleteAvatarInventoryCheckFunctions + = new List(); + + public void addCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory delegateFunc) + { + if (!CanDeleteAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteAvatarInventoryCheckFunctions.Add(delegateFunc); + } + + public void removeCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory delegateFunc) + { + if (CanDeleteAvatarInventoryCheckFunctions.Contains(delegateFunc)) + CanDeleteAvatarInventoryCheckFunctions.Remove(delegateFunc); + } + + /// + /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. + /// + /// + /// + /// + public bool ExternalChecksCanDeleteAvatarInventory(UUID itemID, UUID userID) + { + foreach (CanDeleteAvatarInventory check in CanDeleteAvatarInventoryCheckFunctions) + { + if (check(itemID, userID) == false) + { + return false; + } + } + + return true; + } + public delegate bool CanTeleport(UUID userID); private List CanTeleportCheckFunctions = new List(); -- cgit v1.1