From 180add745cea4a7e076afd1cfe1c922df1bf7e0b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 16 Jan 2017 20:27:39 +0000 Subject: [PATCH] replace calls to SetOwnerId and SetRootPartOwner by a single new SetOwner() so owner is not changed twice on rootpart --- .../World/Objects/BuySell/BuySellModule.cs | 3 +-- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +-- .../Framework/Scenes/SceneObjectGroup.cs | 24 +++++++++++++++++++ .../Attachments/TempAttachmentsModule.cs | 3 +-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 283735889f..2a7bfb09fa 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -136,8 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell return false; } - group.SetOwnerId(remoteClient.AgentId); - group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); + group.SetOwner(remoteClient.AgentId, remoteClient.ActiveGroupId); if (m_scene.Permissions.PropagatePermissions()) { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2f65ce2ae9..602ac4b88a 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -2103,8 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes if (original.OwnerID != AgentID) { - copy.SetOwnerId(AgentID); - copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID); + copy.SetOwner(AgentID, GroupID); SceneObjectPart[] partList = copy.Parts; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4d1e5642a6..924b61f0c2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2766,6 +2766,30 @@ namespace OpenSim.Region.Framework.Scenes part.ScheduleFullUpdate(); } + public void SetOwner(UUID cAgentID, UUID cGroupID) + { + SceneObjectPart rpart = RootPart; + UUID oldowner = rpart.OwnerID; + ForEachPart(delegate(SceneObjectPart part) + { + if(part.GroupID != part.OwnerID) + part.LastOwnerID = part.OwnerID; + part.OwnerID = cAgentID; + part.GroupID = cGroupID; + }); + + if (oldowner != cAgentID) + { + // Apply Next Owner Permissions if we're not bypassing permissions + if (!m_scene.Permissions.BypassPermissions()) + ApplyNextOwnerPermissions(); + } + + rpart.ScheduleFullUpdate(); + } + + + /// /// Make a copy of the given part. /// diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs index ed27385efb..1d5e4fb188 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs @@ -163,8 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) return 0; - hostPart.ParentGroup.SetOwnerId(target.UUID); - hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId); + hostPart.ParentGroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId); if (m_scene.Permissions.PropagatePermissions()) {