diff options
author | UbitUmarov | 2017-04-29 22:09:45 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-29 22:09:45 +0100 |
commit | 522695c821c9f68d6c13533220de428f0d036dd7 (patch) | |
tree | ab368d8fba08a87a83e9c96e1257fef40871d191 /OpenSim/Framework | |
parent | recover PermissionsUtil.ApplyFoldedPermissions (well my version). its use ea... (diff) | |
download | opensim-SC_OLD-522695c821c9f68d6c13533220de428f0d036dd7.zip opensim-SC_OLD-522695c821c9f68d6c13533220de428f0d036dd7.tar.gz opensim-SC_OLD-522695c821c9f68d6c13533220de428f0d036dd7.tar.bz2 opensim-SC_OLD-522695c821c9f68d6c13533220de428f0d036dd7.tar.xz |
update folded permitions if taking from world, or after unfold
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/PermissionsUtil.cs | 28 |
1 files changed, 22 insertions, 6 deletions
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 | |||
65 | return str; | 65 | return str; |
66 | } | 66 | } |
67 | 67 | ||
68 | public static void ApplyFoldedPermissions(uint source, ref uint target) | 68 | public static void ApplyFoldedPermissions(uint foldedSourcePerms, ref uint targetPerms) |
69 | { | 69 | { |
70 | uint folded = source & (uint)PermissionMask.FoldedMask; | 70 | uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; |
71 | if(folded == 0) // invalid we need to ignore | 71 | if(folded == 0) // invalid we need to ignore |
72 | return; | 72 | return; |
73 | 73 | ||
@@ -75,15 +75,15 @@ namespace OpenSim.Framework | |||
75 | folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well | 75 | folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well |
76 | folded |= ~(uint)PermissionMask.UnfoldedMask; | 76 | folded |= ~(uint)PermissionMask.UnfoldedMask; |
77 | 77 | ||
78 | uint tmp = target; | 78 | uint tmp = targetPerms; |
79 | tmp &= folded; | 79 | tmp &= folded; |
80 | target = tmp; | 80 | targetPerms = tmp; |
81 | } | 81 | } |
82 | 82 | ||
83 | // do not touch MOD | 83 | // do not touch MOD |
84 | public static void ApplyNoModFoldedPermissions(uint source, ref uint target) | 84 | public static void ApplyNoModFoldedPermissions(uint foldedSourcePerms, ref uint target) |
85 | { | 85 | { |
86 | uint folded = source & (uint)PermissionMask.FoldedMask; | 86 | uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; |
87 | if(folded == 0) // invalid we need to ignore | 87 | if(folded == 0) // invalid we need to ignore |
88 | return; | 88 | return; |
89 | 89 | ||
@@ -96,5 +96,21 @@ namespace OpenSim.Framework | |||
96 | target = tmp; | 96 | target = tmp; |
97 | } | 97 | } |
98 | 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 | } | ||
99 | } | 115 | } |
100 | } | 116 | } |