diff options
author | UbitUmarov | 2017-04-29 19:07:04 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-29 19:07:04 +0100 |
commit | 04117d9f75ca278a921be9ce09c8c859f81cd428 (patch) | |
tree | 3a919f3e3d2eb3c0ea22bcb7fefa9fdd5e0541e0 /OpenSim/Framework | |
parent | add check for valid folded perms (diff) | |
download | opensim-SC_OLD-04117d9f75ca278a921be9ce09c8c859f81cd428.zip opensim-SC_OLD-04117d9f75ca278a921be9ce09c8c859f81cd428.tar.gz opensim-SC_OLD-04117d9f75ca278a921be9ce09c8c859f81cd428.tar.bz2 opensim-SC_OLD-04117d9f75ca278a921be9ce09c8c859f81cd428.tar.xz |
recover PermissionsUtil.ApplyFoldedPermissions (well my version). its use easys code readability
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/PermissionsUtil.cs | 32 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 4 |
2 files changed, 34 insertions, 2 deletions
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 | |||
64 | str = "."; | 64 | str = "."; |
65 | return str; | 65 | return str; |
66 | } | 66 | } |
67 | |||
68 | public static void ApplyFoldedPermissions(uint source, ref uint target) | ||
69 | { | ||
70 | uint folded = source & (uint)PermissionMask.FoldedMask; | ||
71 | if(folded == 0) // invalid we need to ignore | ||
72 | return; | ||
73 | |||
74 | folded <<= (int)PermissionMask.FoldingShift; | ||
75 | folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well | ||
76 | folded |= ~(uint)PermissionMask.UnfoldedMask; | ||
77 | |||
78 | uint tmp = target; | ||
79 | tmp &= folded; | ||
80 | target = tmp; | ||
81 | } | ||
82 | |||
83 | // do not touch MOD | ||
84 | public static void ApplyNoModFoldedPermissions(uint source, ref uint target) | ||
85 | { | ||
86 | uint folded = source & (uint)PermissionMask.FoldedMask; | ||
87 | if(folded == 0) // invalid we need to ignore | ||
88 | return; | ||
89 | |||
90 | folded <<= (int)PermissionMask.FoldingShift; | ||
91 | folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well | ||
92 | folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify); | ||
93 | |||
94 | uint tmp = target; | ||
95 | tmp &= folded; | ||
96 | target = tmp; | ||
97 | } | ||
98 | |||
67 | } | 99 | } |
68 | } | 100 | } |
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 | |||
92 | // explicitly given | 92 | // explicitly given |
93 | All = 0x8e000, | 93 | All = 0x8e000, |
94 | AllAndExport = 0x9e000, | 94 | AllAndExport = 0x9e000, |
95 | AllEffective = 0x9e000 | 95 | AllEffective = 0x9e000, |
96 | 96 | UnfoldedMask = 0x1e000 | |
97 | } | 97 | } |
98 | 98 | ||
99 | /// <summary> | 99 | /// <summary> |