From d7a98925ce5693f28ef48e4228680f3a7aba12af Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 22 Sep 2008 12:52:56 +0000 Subject: Create CanEditObjectInventory to preserve the ability to have different permissions on inventory and object edits. This may be needed by the viewer on public grids --- .../Region/Environment/Scenes/Scene.Inventory.cs | 28 ++-------------------- .../Environment/Scenes/SceneExternalChecks.cs | 27 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 26 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 a188701..a1c5fe7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1186,18 +1186,7 @@ namespace OpenSim.Region.Environment.Scenes if (part != null) { - - // replacing the following two checks with the - // ExternalChecks.ExternalChecksCanEditObject(...) - // call - - // if (part.OwnerID != remoteClient.AgentId) - // return; - - // if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) - // return; - - if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId)) + if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) { return; } @@ -1293,20 +1282,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T SceneObjectPart part = GetSceneObjectPart(localID); if (part != null) { - - /* - if (part.OwnerID != remoteClient.AgentId) - { - return; - } - - if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) - { - return; - } - */ - - if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId)) + if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) { return; } diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 678d707..f8d041a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs @@ -343,6 +343,33 @@ namespace OpenSim.Region.Environment.Scenes 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 -- cgit v1.1