aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2017-04-29 19:07:04 +0100
committerUbitUmarov2017-04-29 19:07:04 +0100
commit04117d9f75ca278a921be9ce09c8c859f81cd428 (patch)
tree3a919f3e3d2eb3c0ea22bcb7fefa9fdd5e0541e0
parentadd check for valid folded perms (diff)
downloadopensim-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
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs12
-rw-r--r--OpenSim/Framework/PermissionsUtil.cs32
-rw-r--r--OpenSim/Framework/Util.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs12
6 files changed, 59 insertions, 36 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 1ee2468..510905f 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -3087,15 +3087,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
3087 /// </summary> 3087 /// </summary>
3088 private void ApplyNextOwnerPermissions(InventoryItemBase item) 3088 private void ApplyNextOwnerPermissions(InventoryItemBase item)
3089 { 3089 {
3090 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) 3090 if (item.InvType == (int)InventoryType.Object)
3091 { 3091 {
3092 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) 3092 uint perms = item.CurrentPermissions;
3093 item.CurrentPermissions &= ~(uint)PermissionMask.Copy; 3093 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
3094 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) 3094 item.CurrentPermissions = perms;
3095 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
3096 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
3097 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
3098 } 3095 }
3096
3099 item.CurrentPermissions &= item.NextPermissions; 3097 item.CurrentPermissions &= item.NextPermissions;
3100 item.BasePermissions &= item.NextPermissions; 3098 item.BasePermissions &= item.NextPermissions;
3101 item.EveryOnePermissions &= item.NextPermissions; 3099 item.EveryOnePermissions &= item.NextPermissions;
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>
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index d916cc2..bce0610 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -573,7 +573,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
573 InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, 573 InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
574 IClientAPI remoteClient) 574 IClientAPI remoteClient)
575 { 575 {
576 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; 576 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export | PermissionMask.FoldedMask);
577 577
578 // For the porposes of inventory, an object is modify if the prims 578 // For the porposes of inventory, an object is modify if the prims
579 // are modify. This allows renaming an object that contains no 579 // are modify. This allows renaming an object that contains no
@@ -586,19 +586,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
586 586
587 effectivePerms &= groupPerms; 587 effectivePerms &= groupPerms;
588 } 588 }
589 effectivePerms |= (uint)PermissionMask.Move; 589
590
591 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) 590 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
592 { 591 {
593 if ((effectivePerms & (uint)PermissionMask.FoldedCopy) == 0) 592 PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms);
594 effectivePerms &= ~(uint)PermissionMask.Copy; 593
595 if ((effectivePerms & (uint)PermissionMask.FoldedTransfer) == 0)
596 effectivePerms &= ~(uint)PermissionMask.Transfer;
597 if ((effectivePerms & (uint)PermissionMask.FoldedExport) == 0)
598 effectivePerms &= ~(uint)PermissionMask.Export;
599
600 uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; 594 uint basePerms = effectivePerms & so.RootPart.NextOwnerMask;
601 595
596 // rebuild folded perms since we don't have then on inworld objects
597 // possible existent ones where already unfolded
598
602 if((basePerms & (uint)PermissionMask.Copy) == 0) 599 if((basePerms & (uint)PermissionMask.Copy) == 0)
603 basePerms |= (uint)PermissionMask.Transfer; 600 basePerms |= (uint)PermissionMask.Transfer;
604 601
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index f90285d..84f33d1 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -208,19 +208,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
208 208
209 perms = group.GetEffectivePermissions(false); 209 perms = group.GetEffectivePermissions(false);
210 210
211// if((perms & (uint)PermissionMask.FoldedMask) != 0) 211 PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
212 { 212
213 if ((perms & (uint)PermissionMask.FoldedCopy) == 0)
214 perms &= ~(uint)PermissionMask.Copy;
215 if ((perms & (uint)PermissionMask.FoldedTransfer) == 0)
216 perms &= ~(uint)PermissionMask.Transfer;
217 if ((perms & (uint)PermissionMask.FoldedModify) == 0)
218 perms &= ~(uint)PermissionMask.Modify;
219 if ((perms & (uint)PermissionMask.FoldedExport) == 0)
220 perms &= ~(uint)PermissionMask.Export;
221 }
222 item.BasePermissions = perms & part.NextOwnerMask; 213 item.BasePermissions = perms & part.NextOwnerMask;
223 item.CurrentPermissions = perms & part.NextOwnerMask; 214
215// we need to rebuild folded here
216
217 item.CurrentPermissions = item.BasePermissions;
224 item.NextPermissions = part.NextOwnerMask; 218 item.NextPermissions = part.NextOwnerMask;
225 item.EveryOnePermissions = part.EveryoneMask & 219 item.EveryOnePermissions = part.EveryoneMask &
226 part.NextOwnerMask; 220 part.NextOwnerMask;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a6f6aa3..5e19a8a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1267,17 +1267,19 @@ namespace OpenSim.Region.Framework.Scenes
1267 // TODO: Fix this after the inventory fixer exists and has beenr run 1267 // TODO: Fix this after the inventory fixer exists and has beenr run
1268 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) 1268 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
1269 { 1269 {
1270 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1270 agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions;
1271 if (taskItem.InvType == (int)InventoryType.Object) 1271 if (taskItem.InvType == (int)InventoryType.Object)
1272 { 1272 {
1273 if((taskItem.CurrentPermissions & (uint)PermissionMask.FoldedMask) != 0) 1273 uint perms = agentItem.BasePermissions;
1274 agentItem.BasePermissions &= 1274 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms );
1275 (((taskItem.CurrentPermissions & (uint)PermissionMask.FoldedMask ) << (int)PermissionMask.FoldingShift) | 1275 agentItem.BasePermissions = perms;
1276 (taskItem.CurrentPermissions & (uint)PermissionMask.Move));
1277 } 1276 }
1278 else 1277 else
1279 agentItem.BasePermissions &= taskItem.CurrentPermissions; 1278 agentItem.BasePermissions &= taskItem.CurrentPermissions;
1280 1279
1280 // always unlock
1281 agentItem.BasePermissions |= (uint)PermissionMask.Move;
1282
1281 agentItem.CurrentPermissions = agentItem.BasePermissions; 1283 agentItem.CurrentPermissions = agentItem.BasePermissions;
1282 1284
1283 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; 1285 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;