From 522695c821c9f68d6c13533220de428f0d036dd7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Apr 2017 22:09:45 +0100 Subject: update folded permitions if taking from world, or after unfold --- OpenSim/Framework/PermissionsUtil.cs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index a7f933c..39ccaba 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -65,9 +65,9 @@ namespace OpenSim.Framework return str; } - public static void ApplyFoldedPermissions(uint source, ref uint target) + public static void ApplyFoldedPermissions(uint foldedSourcePerms, ref uint targetPerms) { - uint folded = source & (uint)PermissionMask.FoldedMask; + uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; if(folded == 0) // invalid we need to ignore return; @@ -75,15 +75,15 @@ namespace OpenSim.Framework folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well folded |= ~(uint)PermissionMask.UnfoldedMask; - uint tmp = target; + uint tmp = targetPerms; tmp &= folded; - target = tmp; + targetPerms = tmp; } // do not touch MOD - public static void ApplyNoModFoldedPermissions(uint source, ref uint target) + public static void ApplyNoModFoldedPermissions(uint foldedSourcePerms, ref uint target) { - uint folded = source & (uint)PermissionMask.FoldedMask; + uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; if(folded == 0) // invalid we need to ignore return; @@ -96,5 +96,21 @@ namespace OpenSim.Framework target = tmp; } + public static uint FixAndFoldPermissions(uint perms) + { + uint tmp = perms; + + // C & T rule + if((tmp & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0) + tmp |= (uint)PermissionMask.Transfer; + + // unlock + tmp |= (uint)PermissionMask.Move; + + tmp &= ~(uint)PermissionMask.FoldedMask; + tmp |= ((tmp >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask); + + return tmp; + } } } -- cgit v1.1