From 1984f316fc125d793ccf6cbea4f6ea7df9711d17 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 12 Jan 2017 17:15:36 +0000 Subject: [PATCH] Add permission CanChangeSelectedState replacing 2 calls to check Move and Modify/edit. As those calls did, this controls changes to objects selected state for edition (simulation hold etc). --- .../Framework/Scenes/Scene.PacketHandlers.cs | 6 ++---- .../Region/Framework/Scenes/Scene.Permissions.cs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2d62b50af4..e611897caa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -183,8 +183,7 @@ namespace OpenSim.Region.Framework.Scenes part.SendFullUpdate(remoteClient); // A prim is only tainted if it's allowed to be edited by the person clicking it. - if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) - || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) + if (Permissions.CanChangeSelectedState(sog.UUID, (ScenePresence)remoteClient.SceneAgent)) { part.IsSelected = true; EventManager.TriggerParcelPrimCountTainted(); @@ -250,8 +249,7 @@ namespace OpenSim.Region.Framework.Scenes // handled by group, but by prim. Legacy cruft. // TODO: Make selection flagging per prim! // - if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) - || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) + if (Permissions.CanChangeSelectedState(part.ParentGroup.UUID, (ScenePresence)remoteClient.SceneAgent)) { part.IsSelected = false; if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e045c437de..8f32b03ef2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -404,6 +404,20 @@ namespace OpenSim.Region.Framework.Scenes #endregion + #region persence EDIT or MOVE OBJECT + private const uint CANSELECTMASK = (uint)( + PrimFlags.ObjectMove | + PrimFlags.ObjectModify | + PrimFlags.ObjectOwnerModify + ); + + public bool CanChangeSelectedState(UUID objectID, ScenePresence sp) + { + uint perms = GenerateClientFlags(sp , objectID); + return (perms & CANSELECTMASK) != 0; + } + + #endregion #region EDIT OBJECT public bool CanEditObject(UUID objectID, UUID editorID) {