diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/PermissionsUtil.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 3dce04d..e50d4df 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs | |||
@@ -60,9 +60,57 @@ namespace OpenSim.Framework | |||
60 | str += "C"; | 60 | str += "C"; |
61 | if ((perms & (int)PermissionMask.Transfer) != 0) | 61 | if ((perms & (int)PermissionMask.Transfer) != 0) |
62 | str += "T"; | 62 | str += "T"; |
63 | if ((perms & (int)PermissionMask.Export) != 0) | ||
64 | str += "X"; | ||
63 | if (str == "") | 65 | if (str == "") |
64 | str = "."; | 66 | str = "."; |
65 | return str; | 67 | return str; |
66 | } | 68 | } |
69 | |||
70 | public static void ApplyFoldedPermissions(uint foldedSourcePerms, ref uint targetPerms) | ||
71 | { | ||
72 | uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; | ||
73 | if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do | ||
74 | return; | ||
75 | |||
76 | folded <<= (int)PermissionMask.FoldingShift; | ||
77 | folded |= ~(uint)PermissionMask.UnfoldedMask; | ||
78 | |||
79 | uint tmp = targetPerms; | ||
80 | tmp &= folded; | ||
81 | targetPerms = tmp; | ||
82 | } | ||
83 | |||
84 | // do not touch MOD | ||
85 | public static void ApplyNoModFoldedPermissions(uint foldedSourcePerms, ref uint target) | ||
86 | { | ||
87 | uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; | ||
88 | if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do | ||
89 | return; | ||
90 | |||
91 | folded <<= (int)PermissionMask.FoldingShift; | ||
92 | folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify); | ||
93 | |||
94 | uint tmp = target; | ||
95 | tmp &= folded; | ||
96 | target = tmp; | ||
97 | } | ||
98 | |||
99 | public static uint FixAndFoldPermissions(uint perms) | ||
100 | { | ||
101 | uint tmp = perms; | ||
102 | |||
103 | // C & T rule | ||
104 | if((tmp & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0) | ||
105 | tmp |= (uint)PermissionMask.Transfer; | ||
106 | |||
107 | // unlock | ||
108 | tmp |= (uint)PermissionMask.Move; | ||
109 | |||
110 | tmp &= ~(uint)PermissionMask.FoldedMask; | ||
111 | tmp |= ((tmp >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask); | ||
112 | |||
113 | return tmp; | ||
114 | } | ||
67 | } | 115 | } |
68 | } | 116 | } |