From 76f411147d69b2a57c8eb7db0f48f3341ca5fd51 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 21 Feb 2012 22:49:06 +0000 Subject: [PATCH 1/2] Revert "Fix:Cannot drag inventory from child prim into inventory http://opensimulator.org/mantis/view.php?id=5569" This reverts commit 15ce73caca9ea6448e34b95d344cbbf5c9507f6d. As per the COMMENTS in http://opensimulator.org/mantis/view.php?id=5569, I was going to fix this in a more general way. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 132f15d89d..6cc78b84b8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1144,11 +1144,6 @@ namespace OpenSim.Region.Framework.Scenes return; } - UUID partUUID = part.UUID; - SceneObjectGroup group = part.ParentGroup; - if (group != null) - partUUID = group.RootPart.UUID; - TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); if (null == taskItem) @@ -1160,18 +1155,19 @@ namespace OpenSim.Region.Framework.Scenes return; } - if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId); + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) { // If the item to be moved is no copy, we need to be able to // edit the prim. - if (!Permissions.CanEditObjectInventory(partUUID, remoteClient.AgentId)) + if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) return; } else { // If the item is copiable, then we just need to have perms // on it. The delete check is a pure rights check - if (!Permissions.CanDeleteObject(partUUID, remoteClient.AgentId)) + if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId)) return; } From 5397a6d4c626818af9aed1e2e0dedd430fb4b948 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 21 Feb 2012 22:54:30 +0000 Subject: [PATCH 2/2] Fix problem with dragging child part inventory item to user inventory. This fixes the problem by fixing the permissions module to look at root part permissions rather than having to do this for every caller. Resolves http://opensimulator.org/mantis/view.php?id=5569 --- .../World/Permissions/PermissionsModule.cs | 22 +++---------------- .../Framework/Scenes/Scene.Inventory.cs | 12 +--------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f3c6a30e64..702398481e 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -677,18 +677,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions bool permission = false; bool locked = false; - if (!m_scene.Entities.ContainsKey(objId)) - { - return false; - } + SceneObjectPart part = m_scene.GetSceneObjectPart(objId); - // If it's not an object, we cant edit it. - if ((!(m_scene.Entities[objId] is SceneObjectGroup))) - { + if (part == null) return false; - } - SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId]; + SceneObjectGroup group = part.ParentGroup; UUID objectOwner = group.OwnerID; locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0); @@ -977,16 +971,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); - - // If we selected a sub-prim to edit, the objectID won't represent the object, but only a part. - // We have to check the permissions of the group, though. - if (part.ParentID != 0) - { - objectID = part.ParentUUID; - part = m_scene.GetSceneObjectPart(objectID); - } - return GenericObjectPermission(editorID, objectID, false); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6cc78b84b8..83e3a455d8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1146,17 +1146,7 @@ namespace OpenSim.Region.Framework.Scenes TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); - if (null == taskItem) - { - m_log.WarnFormat("[PRIM INVENTORY]: Move of inventory item {0} from prim with local id {1} failed" - + " because the inventory item could not be found", - itemId, primLocalId); - - return; - } - - TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId); - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) { // If the item to be moved is no copy, we need to be able to // edit the prim.