diff options
Diffstat (limited to 'OpenSim/Framework/PermissionsUtil.cs')
-rw-r--r-- | OpenSim/Framework/PermissionsUtil.cs | 32 |
1 files changed, 32 insertions, 0 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 | } |