From 04117d9f75ca278a921be9ce09c8c859f81cd428 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Apr 2017 19:07:04 +0100 Subject: recover PermissionsUtil.ApplyFoldedPermissions (well my version). its use easys code readability --- OpenSim/Framework/PermissionsUtil.cs | 32 ++++++++++++++++++++++++++++++++ OpenSim/Framework/Util.cs | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 3dce04d..a7f933c 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -64,5 +64,37 @@ namespace OpenSim.Framework str = "."; return str; } + + public static void ApplyFoldedPermissions(uint source, ref uint target) + { + uint folded = source & (uint)PermissionMask.FoldedMask; + if(folded == 0) // invalid we need to ignore + return; + + folded <<= (int)PermissionMask.FoldingShift; + folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well + folded |= ~(uint)PermissionMask.UnfoldedMask; + + uint tmp = target; + tmp &= folded; + target = tmp; + } + + // do not touch MOD + public static void ApplyNoModFoldedPermissions(uint source, ref uint target) + { + uint folded = source & (uint)PermissionMask.FoldedMask; + if(folded == 0) // invalid we need to ignore + return; + + folded <<= (int)PermissionMask.FoldingShift; + folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well + folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify); + + uint tmp = target; + tmp &= folded; + target = tmp; + } + } } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 4d025a9..f6ded04 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -92,8 +92,8 @@ namespace OpenSim.Framework // explicitly given All = 0x8e000, AllAndExport = 0x9e000, - AllEffective = 0x9e000 - + AllEffective = 0x9e000, + UnfoldedMask = 0x1e000 } /// -- cgit v1.1