From db2fbf6516a055beb71de9b82a9773c29bf3a73d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 17 Jan 2017 13:24:09 +0000 Subject: add more calls to effective permissions aggregation, some paths may still be missing on objects changes, but remove the aggregation on check paths, so all can be tested. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 8 ++++++- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 10 ++++----- .../Region/Framework/Scenes/SceneObjectGroup.cs | 26 +++++++++++++--------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++++-- .../Framework/Scenes/SceneObjectPartInventory.cs | 11 ++++++++- .../Scenes/Serialization/SceneObjectSerializer.cs | 5 +++-- .../Scenes/Serialization/SceneXmlLoader.cs | 1 + 9 files changed, 49 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c913271..473589a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -338,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes // Update item with new asset item.AssetID = asset.FullID; group.UpdateInventoryItem(item); + group.AggregatePerms(); part.SendPropertiesToClient(remoteClient); @@ -1214,6 +1215,7 @@ namespace OpenSim.Region.Framework.Scenes } group.RemoveInventoryItem(localID, itemID); + group.AggregatePerms(); } part.SendPropertiesToClient(remoteClient); @@ -1530,9 +1532,10 @@ namespace OpenSim.Region.Framework.Scenes destTaskItem.Type = srcTaskItem.Type; destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID); - if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + { part.Inventory.RemoveInventoryItem(itemId); + } ScenePresence avatar; @@ -1978,6 +1981,8 @@ namespace OpenSim.Region.Framework.Scenes part.Inventory.AddInventoryItem(taskItem, false); part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); + part.ParentGroup.AggregatePerms(); + // tell anyone managing scripts that a new script exists EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); @@ -2658,6 +2663,7 @@ namespace OpenSim.Region.Framework.Scenes // We can only call this after adding the scene object, since the scene object references the scene // to find out if scripts should be activated at all. + group.AggregatePerms(); group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); group.ScheduleGroupForFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2137b42..ff1e34e 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2351,6 +2351,7 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerOnSceneObjectLoaded(group); SceneObjectPart rootPart = group.GetPart(group.UUID); rootPart.Flags &= ~PrimFlags.Scripted; + group.AggregateDeepPerms(); rootPart.TrimPermissions(); // Don't do this here - it will get done later on when sculpt data is loaded. @@ -2622,6 +2623,7 @@ namespace OpenSim.Region.Framework.Scenes if (UserManagementModule != null) sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); + sceneObject.AggregateDeepPerms(); sceneObject.ScheduleGroupForFullUpdate(); return sceneObject; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index dad8cac..7a97bfc 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -343,7 +343,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.ForceInventoryPersistence(); sceneObject.HasGroupChanged = true; } - + sceneObject.AggregateDeepPerms(); return ret; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 399e341..5ecf352 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes bool addFromAllowedDrop = agentID != part.OwnerID; part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); - + part.ParentGroup.AggregatePerms(); return true; } else @@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) // bc this is on heavy duty code paths // but for now we need to test the concept - AggregateDeepPerms(); +// AggregateDeepPerms(); return m_EffectiveEveryOnePerms; } } @@ -272,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) // bc this is on heavy duty code paths // but for now we need to test the concept - AggregateDeepPerms(); +// AggregateDeepPerms(); return m_EffectiveGroupPerms; } } @@ -285,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) // bc this is on heavy duty code paths // but for now we need to test the concept - AggregateDeepPerms(); +// AggregateDeepPerms(); return m_EffectiveGroupOrEveryOnePerms; } } @@ -298,7 +298,7 @@ namespace OpenSim.Region.Framework.Scenes // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) // bc this is on heavy duty code paths // but for now we need to test the concept - AggregateDeepPerms(); + // AggregateDeepPerms(); return m_EffectiveOwnerPerms; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 033170d..d14c450 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2441,17 +2441,16 @@ namespace OpenSim.Region.Framework.Scenes dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; - if (userExposed) dupe.m_rootPart.TrimPermissions(); List partList = new List(m_parts.GetArray()); partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) - { - return p1.LinkNum.CompareTo(p2.LinkNum); - } - ); + { + return p1.LinkNum.CompareTo(p2.LinkNum); + } + ); foreach (SceneObjectPart part in partList) { @@ -2503,10 +2502,12 @@ namespace OpenSim.Region.Framework.Scenes if (dupe.m_rootPart.PhysActor != null) dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building + dupe.AggregateDeepPerms(); + dupe.HasGroupChanged = true; dupe.AttachToBackup(); - ScheduleGroupForFullUpdate(); + dupe.ScheduleGroupForFullUpdate(); } m_dupeInProgress = false; @@ -3426,6 +3427,7 @@ namespace OpenSim.Region.Framework.Scenes objectGroup.HasGroupChangedDueToDelink = true; InvalidBoundsRadius(); + objectGroup.AggregatePerms(); if (sendEvents) linkPart.TriggerScriptChangedEvent(Changed.LINK); @@ -3964,8 +3966,8 @@ namespace OpenSim.Region.Framework.Scenes public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) { - uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits - uint foldedPerms = RootPart.OwnerMask & 3; + uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits + uint foldedPerms = RootPart.OwnerMask & (uint)PermissionMask.FoldedMask; ForEachPart(part => { @@ -3976,14 +3978,14 @@ namespace OpenSim.Region.Framework.Scenes part.Inventory.ApplyGodPermissions(part.BaseMask); }); - uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); - uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); + uint lockMask = ~(uint)(PermissionMask.Move); + uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move); RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", // (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); - + AggregatePerms(); RootPart.ScheduleFullUpdate(); } @@ -4008,6 +4010,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (SceneObjectPart part in Parts) part.Inventory.ApplyGodPermissions(RootPart.BaseMask); + AggregatePerms(); } HasGroupChanged = true; @@ -5223,6 +5226,7 @@ namespace OpenSim.Region.Framework.Scenes { part.ResetOwnerChangeFlag(); }); + AggregatePerms(); } // clear some references to easy cg diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0817144..69d8288 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -476,8 +476,8 @@ namespace OpenSim.Region.Framework.Scenes APIDActive = false; Flags = 0; CreateSelected = true; - TrimPermissions(); + AggregateInnerPerms(); } #endregion Constructors @@ -4495,7 +4495,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter break; } - + AggregateInnerPerms(); SendFullUpdateToAllClients(); } } @@ -4512,6 +4512,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter EveryoneMask = source.EveryoneMask & BaseMask; NextOwnerMask = source.NextOwnerMask & BaseMask; + AggregateInnerPerms(); + if (OwnerMask != prevOwnerMask || GroupMask != prevGroupMask || EveryoneMask != prevEveryoneMask || @@ -5335,6 +5337,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter item.OwnerChanged = false; Inventory.UpdateInventoryItem(item, false, false); } + AggregateInnerPerms(); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 29d9f08..545d44b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -807,6 +807,7 @@ namespace OpenSim.Region.Framework.Scenes else m_part.TriggerScriptChangedEvent(Changed.INVENTORY); + m_part.AggregateInnerPerms(); m_inventorySerial++; //m_inventorySerial += 2; HasInventoryChanged = true; @@ -829,7 +830,7 @@ namespace OpenSim.Region.Framework.Scenes // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); } m_items.LockItemsForWrite(false); - + m_part.AggregateInnerPerms(); m_inventorySerial++; } @@ -1022,16 +1023,20 @@ namespace OpenSim.Region.Framework.Scenes item.AssetID = m_items[item.ItemID].AssetID; m_items[item.ItemID] = item; + m_inventorySerial++; if (fireScriptEvents) m_part.TriggerScriptChangedEvent(Changed.INVENTORY); if (considerChanged) { + m_part.AggregateInnerPerms(); + m_part.ParentGroup.AggregatePerms(); HasInventoryChanged = true; m_part.ParentGroup.HasGroupChanged = true; } m_items.LockItemsForWrite(false); + return true; } else @@ -1068,6 +1073,10 @@ namespace OpenSim.Region.Framework.Scenes m_items.LockItemsForWrite(true); m_items.Remove(itemID); m_items.LockItemsForWrite(false); + + m_part.AggregateInnerPerms(); + m_part.ParentGroup.AggregatePerms(); + m_inventorySerial++; m_part.TriggerScriptChangedEvent(Changed.INVENTORY); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index b8d210c..a12a401 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(reader); - + sceneObject.AggregateDeepPerms(); return sceneObject; } @@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(doc); - + sceneObject.AggregatePerms(); return sceneObject; } catch (Exception e) @@ -1739,6 +1739,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadEndElement(); // SceneObjectPart + obj.AggregateInnerPerms(); // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); return obj; } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 01bc491..0f022dd 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -70,6 +70,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization //obj.RegenerateFullIDs(); scene.AddNewSceneObject(obj, true); + obj.AggregateDeepPerms(); } } else -- cgit v1.1