From ba4e13ef55c378db13b6aa97316e99d651762a02 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 28 Apr 2017 20:03:44 +0100 Subject: a few changes to permissions folding... we are testing. at this point only use master for TESTING also --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 13 ++++-- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 25 +++--------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 +- .../Framework/Scenes/SceneObjectPartInventory.cs | 46 +++++++++++++--------- 4 files changed, 45 insertions(+), 43 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2f016fa..edf8cb6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -682,19 +682,19 @@ namespace OpenSim.Region.Framework.Scenes // These will be applied to the root prim at next rez. // The legacy slam bit (bit 3) and folded permission (bits 0-2) // are preserved due to the above mangling - ownerPerms &= nextPerms; +// ownerPerms &= nextPerms; // Mask the base permissions. This is a conservative // approach altering only the three main perms - basePerms &= nextPerms; +// basePerms &= nextPerms; // Mask out the folded portion of the base mask. // While the owner mask carries the actual folded // permissions, the base mask carries the original // base mask, before masking with the folded perms. // We need this later for rezzing. - basePerms &= ~(uint)PermissionMask.FoldedMask; - basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); +// basePerms &= ~(uint)PermissionMask.FoldedMask; +// basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); // If this is an object, root prim perms may be more // permissive than folded perms. Use folded perms as @@ -729,6 +729,11 @@ namespace OpenSim.Region.Framework.Scenes } } + // move here so nextperms are mandatory + ownerPerms &= nextPerms; + basePerms &= nextPerms; + basePerms &= ~(uint)PermissionMask.FoldedMask; + basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); // Assign to the actual item. Make sure the slam bit is // set, if it wasn't set before. itemCopy.BasePermissions = basePerms; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 081281e..42f47b5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -326,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes // aux const uint allmask = (uint)PermissionMask.AllEffective; const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); - const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); + const uint copytransfermask = (uint)(PermissionMask.Copy | PermissionMask.Transfer); uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; @@ -350,7 +350,7 @@ namespace OpenSim.Region.Framework.Scenes // recover modify and move rootOwnerPerms &= movemodmask; owner |= rootOwnerPerms; - if((owner & copytransfermast) == 0) + if((owner & copytransfermask) == 0) owner |= (uint)PermissionMask.Transfer; owner &= basePerms; @@ -479,17 +479,13 @@ namespace OpenSim.Region.Framework.Scenes } } - public uint GetEffectivePermissions() - { - return GetEffectivePermissions(false); - } - public uint GetEffectivePermissions(bool useBase) { uint perms=(uint)(PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Move | - PermissionMask.Transfer) | 7; + PermissionMask.Transfer | + PermissionMask.FoldedMask); uint ownerMask = 0x7fffffff; @@ -512,17 +508,8 @@ namespace OpenSim.Region.Framework.Scenes perms &= ~(uint)PermissionMask.Copy; if ((ownerMask & (uint)PermissionMask.Transfer) == 0) perms &= ~(uint)PermissionMask.Transfer; - - // If root prim permissions are applied here, this would screw - // with in-inventory manipulation of the next owner perms - // in a major way. So, let's move this to the give itself. - // Yes. I know. Evil. -// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0) -// perms &= ~((uint)PermissionMask.Modify >> 13); -// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0) -// perms &= ~((uint)PermissionMask.Copy >> 13); -// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) -// perms &= ~((uint)PermissionMask.Transfer >> 13); + if ((ownerMask & (uint)PermissionMask.Export) == 0) + perms &= ~(uint)PermissionMask.Export; return perms; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e4f18d9..f948336 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5288,9 +5288,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter // Export needs to be preserved in the base and everyone // mask, but removed in the owner mask as a next owner // can never change the export status - BaseMask &= NextOwnerMask | (uint)PermissionMask.Export; + BaseMask &= (NextOwnerMask | (uint)PermissionMask.Export); OwnerMask &= NextOwnerMask; - EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export; + EveryoneMask &= (NextOwnerMask | (uint)PermissionMask.Export); GroupMask = 0; // Giving an object zaps group permissions Inventory.ApplyNextOwnerPermissions(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b53c355..894078d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1340,33 +1340,38 @@ namespace OpenSim.Region.Framework.Scenes public uint MaskEffectivePermissions() { + // used to propagate permissions restrictions outwards + // Modify does not propagate outwards. uint mask=0x7fffffff; - + foreach (TaskInventoryItem item in m_items.Values) { if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); + mask &= ~((uint)PermissionMask.FoldedCopy); if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); + mask &= ~((uint)PermissionMask.FoldedTransfer); + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Export) == 0) + mask &= ~((uint)PermissionMask.FoldedExport); + // this breaks some SL legal use cases + // there should be no folding from task inventory +/* if (item.InvType == (int)InventoryType.Object) { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); + if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedCopy)) == 0) + mask &= ~((uint)PermissionMask.FoldedCopy); + if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedTransfer)) == 0) + mask &= ~((uint)PermissionMask.FoldedTransfer); + if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) == 0) + mask &= ~((uint)PermissionMask.FoldedExport); } - +*/ if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) mask &= ~(uint)PermissionMask.Copy; if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) mask &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~(uint)PermissionMask.Modify; + if ((item.CurrentPermissions & (uint)PermissionMask.Export) == 0) + mask &= ~((uint)PermissionMask.Export); } return mask; } @@ -1375,19 +1380,24 @@ namespace OpenSim.Region.Framework.Scenes { foreach (TaskInventoryItem item in m_items.Values) { - if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + + // this breaks legal SL use cases + // there should be no unfold into task inventory +/* + if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & (uint)PermissionMask.FoldedMask) != 0) { // m_log.DebugFormat ( // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedCopy)) == 0) item.CurrentPermissions &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedTransfer)) == 0) item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedModify)) == 0) item.CurrentPermissions &= ~(uint)PermissionMask.Modify; } +*/ item.CurrentPermissions &= item.NextPermissions; item.BasePermissions &= item.NextPermissions; item.EveryonePermissions &= item.NextPermissions; -- cgit v1.1