From d8341588b3b7d855c381831ddf6ca5656a6be9c3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Apr 2017 23:59:56 +0100 Subject: [PATCH] nore permissions masks hierachy --- .../InventoryAccess/InventoryAccessModule.cs | 8 +++--- .../World/Objects/BuySell/BuySellModule.cs | 6 ++--- .../Framework/Scenes/Scene.Inventory.cs | 26 +++++++++---------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d4f9c16e7d..a32d7dc5ca 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -597,10 +597,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms); item.BasePermissions = basePerms; - item.CurrentPermissions = item.BasePermissions; - item.NextPermissions = effectivePerms & so.RootPart.NextOwnerMask; - item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; - item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; + item.CurrentPermissions = basePerms; + item.NextPermissions = basePerms & so.RootPart.NextOwnerMask; + item.EveryOnePermissions = basePerms & so.RootPart.EveryoneMask; + item.GroupPermissions = basePerms & so.RootPart.GroupMask; // apply next owner perms on rez item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index ca392b8f93..6854b53cf7 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -216,12 +216,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell item.BasePermissions = perms; item.CurrentPermissions = perms; - - perms &= part.NextOwnerMask; - item.NextPermissions = perms; - + item.NextPermissions = part.NextOwnerMask & perms; item.EveryOnePermissions = part.EveryoneMask & perms; item.GroupPermissions = part.GroupMask & perms; + item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; item.CreationDate = Util.UnixTimeSinceEpoch(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 054957157a..a2cee81832 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1267,29 +1267,27 @@ namespace OpenSim.Region.Framework.Scenes // TODO: Fix this after the inventory fixer exists and has beenr run if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) { - agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions; + uint perms = taskItem.BasePermissions & taskItem.NextPermissions; if (taskItem.InvType == (int)InventoryType.Object) { - uint perms = agentItem.BasePermissions; - PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms ); -// perms |= (uint)PermissionMask.Move; -// agentItem.BasePermissions = perms; - agentItem.BasePermissions = PermissionsUtil.FixAndFoldPermissions(perms); + PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms ); + perms = PermissionsUtil.FixAndFoldPermissions(perms); } else - agentItem.BasePermissions &= taskItem.CurrentPermissions; + perms &= taskItem.CurrentPermissions; // always unlock - agentItem.BasePermissions |= (uint)PermissionMask.Move; + perms |= (uint)PermissionMask.Move; - agentItem.CurrentPermissions = agentItem.BasePermissions; - - agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; - agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); - agentItem.NextPermissions = taskItem.NextPermissions; - agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); + agentItem.BasePermissions = perms; + agentItem.CurrentPermissions = perms; + agentItem.NextPermissions = perms & taskItem.NextPermissions; + agentItem.EveryOnePermissions = perms & taskItem.EveryonePermissions; // Group permissions make no sense here agentItem.GroupPermissions = 0; + + agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; + agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); } else {