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 | |
parent | recover PermissionsUtil.ApplyFoldedPermissions (well my version). its use ea... (diff) | |
download | opensim-SC-522695c821c9f68d6c13533220de428f0d036dd7.zip opensim-SC-522695c821c9f68d6c13533220de428f0d036dd7.tar.gz opensim-SC-522695c821c9f68d6c13533220de428f0d036dd7.tar.bz2 opensim-SC-522695c821c9f68d6c13533220de428f0d036dd7.tar.xz |
update folded permitions if taking from world, or after unfold
Diffstat (limited to '')
4 files changed, 30 insertions, 23 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 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index bce0610..d4f9c16 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -594,16 +594,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
594 | uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; | 594 | uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; |
595 | 595 | ||
596 | // rebuild folded perms since we don't have then on inworld objects | 596 | // rebuild folded perms since we don't have then on inworld objects |
597 | // possible existent ones where already unfolded | 597 | basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms); |
598 | |||
599 | if((basePerms & (uint)PermissionMask.Copy) == 0) | ||
600 | basePerms |= (uint)PermissionMask.Transfer; | ||
601 | |||
602 | // unlock | ||
603 | basePerms |= (uint)PermissionMask.Move; | ||
604 | |||
605 | basePerms &= ~(uint)PermissionMask.FoldedMask; | ||
606 | basePerms |= ((basePerms >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask); | ||
607 | 598 | ||
608 | item.BasePermissions = basePerms; | 599 | item.BasePermissions = basePerms; |
609 | item.CurrentPermissions = item.BasePermissions; | 600 | item.CurrentPermissions = item.BasePermissions; |
@@ -1146,9 +1137,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1146 | if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0) | 1137 | if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0) |
1147 | { | 1138 | { |
1148 | // We have permissions stored there so use them | 1139 | // We have permissions stored there so use them |
1149 | part.NextOwnerMask = ((item.BasePermissions & 7) << 13); | 1140 | part.NextOwnerMask = ((item.BasePermissions & (uint)PermissionMask.FoldedMask) << (int)PermissionMask.FoldingShift); |
1150 | if ((item.BasePermissions & (uint)PermissionMask.FoldedExport) != 0) | ||
1151 | part.NextOwnerMask |= (uint)PermissionMask.Export; | ||
1152 | part.NextOwnerMask |= (uint)PermissionMask.Move; | 1141 | part.NextOwnerMask |= (uint)PermissionMask.Move; |
1153 | } | 1142 | } |
1154 | else | 1143 | else |
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 84f33d1..af53aa3 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -210,9 +210,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
210 | 210 | ||
211 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); | 211 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); |
212 | 212 | ||
213 | item.BasePermissions = perms & part.NextOwnerMask; | 213 | perms &= part.NextOwnerMask; |
214 | 214 | ||
215 | // we need to rebuild folded here | 215 | item.BasePermissions = PermissionsUtil.FixAndFoldPermissions(perms); |
216 | 216 | ||
217 | item.CurrentPermissions = item.BasePermissions; | 217 | item.CurrentPermissions = item.BasePermissions; |
218 | item.NextPermissions = part.NextOwnerMask; | 218 | item.NextPermissions = part.NextOwnerMask; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 5e19a8a..0549571 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1272,14 +1272,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1272 | { | 1272 | { |
1273 | uint perms = agentItem.BasePermissions; | 1273 | uint perms = agentItem.BasePermissions; |
1274 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms ); | 1274 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms ); |
1275 | agentItem.BasePermissions = perms; | 1275 | // perms |= (uint)PermissionMask.Move; |
1276 | // agentItem.BasePermissions = perms; | ||
1277 | agentItem.BasePermissions = PermissionsUtil.FixAndFoldPermissions(perms); | ||
1276 | } | 1278 | } |
1277 | else | 1279 | else |
1278 | agentItem.BasePermissions &= taskItem.CurrentPermissions; | 1280 | agentItem.BasePermissions &= taskItem.CurrentPermissions; |
1279 | 1281 | ||
1280 | // always unlock | 1282 | // always unlock |
1281 | agentItem.BasePermissions |= (uint)PermissionMask.Move; | 1283 | agentItem.BasePermissions |= (uint)PermissionMask.Move; |
1282 | 1284 | ||
1283 | agentItem.CurrentPermissions = agentItem.BasePermissions; | 1285 | agentItem.CurrentPermissions = agentItem.BasePermissions; |
1284 | 1286 | ||
1285 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 1287 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |