From 9cf8795ecf1a2f34f803babf318d9c1f394ee18b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 19 Sep 2010 22:53:05 +0200 Subject: [PATCH 1/3] Fix a merge artefact that broke script state persistence in XAttachments --- OpenSim/Framework/TaskInventoryItem.cs | 8 +++----- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index df5b936126..883f61a3e8 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -120,7 +120,7 @@ namespace OpenSim.Framework private UUID _permsGranter; private int _permsMask; private int _type = 0; - private UUID _oldID; + private UUID _oldID = UUID.Zero; private bool _ownerChanged = false; @@ -227,9 +227,6 @@ namespace OpenSim.Framework get { return _oldID; } - set { - _oldID = value; - } } public UUID LastOwnerID { @@ -348,7 +345,8 @@ namespace OpenSim.Framework /// The new part ID to which this item belongs public void ResetIDs(UUID partID) { - OldItemID = ItemID; + if (_oldID == UUID.Zero) + _oldID = ItemID; ItemID = UUID.Random(); ParentPartID = partID; ParentID = partID; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f9bfffd629..41b0a42472 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1029,7 +1029,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { - Dictionary pstates = parts[i].Inventory.GetScriptStates(); + Dictionary pstates = parts[i].Inventory.GetScriptStates(oldIDs); foreach (KeyValuePair kvp in pstates) states.Add(kvp.Key, kvp.Value); } From 7229bc4fbda804d41525356027269ca9a665b0bf Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Sep 2010 02:08:55 +0200 Subject: [PATCH 2/3] Refactor script create permission into the perms module --- .../World/Permissions/PermissionsModule.cs | 28 +++++++++++++++---- .../Framework/Scenes/Scene.Inventory.cs | 10 ------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index ecfd211e02..e46fb1c525 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -1780,10 +1780,28 @@ namespace OpenSim.Region.CoreModules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - if ((int)InventoryType.LSL == invType) - if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID)) - return false; - + SceneObjectPart part = scene.GetSceneObjectPart(objectID); + ScenePresence p = scene.GetScenePresence(userID); + + if (part == null || p == null) + return false; + + if (!IsAdministrator(userID)) + { + if (part.OwnerID != userID) + { + // Group permissions + if ((part.GroupID == UUID.Zero) || (p.ControllingClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0)) + return false; + } else { + if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) + return false; + } + if ((int)InventoryType.LSL == invType) + if (m_allowedScriptCreators == UserSet.Administrators) + return false; + } + return true; } @@ -1980,4 +1998,4 @@ namespace OpenSim.Region.CoreModules.World.Permissions return false; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index ac82fda830..18cfcbc183 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1532,16 +1532,6 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) return; - if (part.OwnerID != remoteClient.AgentId) - { - // Group permissions - if ((part.GroupID == UUID.Zero) || (remoteClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0)) - return; - } else { - if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) - return; - } - if (!Permissions.CanCreateObjectInventory( itemBase.InvType, part.UUID, remoteClient.AgentId)) return; From 12f9b1df8c10f25b80f7cda7cccd7e3866653f49 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Sep 2010 03:57:09 +0200 Subject: [PATCH 3/3] Fix a typo --- .../CoreModules/World/Permissions/PermissionsModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index e46fb1c525..289741fd84 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED - m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE + m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED @@ -1780,8 +1780,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - SceneObjectPart part = scene.GetSceneObjectPart(objectID); - ScenePresence p = scene.GetScenePresence(userID); + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + ScenePresence p = m_scene.GetScenePresence(userID); if (part == null || p == null) return false;