diff options
Diffstat (limited to '')
6 files changed, 48 insertions, 39 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 354f587..811781c 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -2763,15 +2763,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2763 | /// </summary> | 2763 | /// </summary> |
2764 | private void ApplyNextOwnerPermissions(InventoryItemBase item) | 2764 | private void ApplyNextOwnerPermissions(InventoryItemBase item) |
2765 | { | 2765 | { |
2766 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 2766 | if (item.InvType == (int)InventoryType.Object) |
2767 | { | 2767 | { |
2768 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 2768 | uint perms = item.CurrentPermissions; |
2769 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 2769 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms); |
2770 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 2770 | item.CurrentPermissions = perms; |
2771 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | ||
2772 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
2773 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
2774 | } | 2771 | } |
2772 | |||
2775 | item.CurrentPermissions &= item.NextPermissions; | 2773 | item.CurrentPermissions &= item.NextPermissions; |
2776 | item.BasePermissions &= item.NextPermissions; | 2774 | item.BasePermissions &= item.NextPermissions; |
2777 | item.EveryOnePermissions &= item.NextPermissions; | 2775 | item.EveryOnePermissions &= item.NextPermissions; |
diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 3dce04d..d785a78 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs | |||
@@ -64,5 +64,24 @@ namespace OpenSim.Framework | |||
64 | str = "."; | 64 | str = "."; |
65 | return str; | 65 | return str; |
66 | } | 66 | } |
67 | |||
68 | /// <summary> | ||
69 | /// Applies an object's folded permissions to its regular permissions. | ||
70 | /// </summary> | ||
71 | /// <param name="foldedPerms">The folded permissions. Only the lowest 7 bits are examined.</param> | ||
72 | /// <param name="mainPerms">The permissions variable to modify.</param> | ||
73 | public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms) | ||
74 | { | ||
75 | if ((foldedPerms & 7) == 0) | ||
76 | return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded | ||
77 | |||
78 | if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0) | ||
79 | mainPerms &= ~(uint)PermissionMask.Copy; | ||
80 | if ((foldedPerms & ((uint)PermissionMask.Transfer >> 13)) == 0) | ||
81 | mainPerms &= ~(uint)PermissionMask.Transfer; | ||
82 | if ((foldedPerms & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
83 | mainPerms &= ~(uint)PermissionMask.Modify; | ||
84 | } | ||
85 | |||
67 | } | 86 | } |
68 | } | 87 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index da36ed0..a7e6fdd 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -443,13 +443,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
443 | } | 443 | } |
444 | else | 444 | else |
445 | { | 445 | { |
446 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
447 | |||
448 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 446 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
449 | item.Description = asset.Description; | 447 | item.Description = asset.Description; |
450 | item.Name = asset.Name; | 448 | item.Name = asset.Name; |
451 | item.AssetType = asset.Type; | 449 | item.AssetType = asset.Type; |
452 | 450 | ||
451 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
452 | |||
453 | m_Scene.AddInventoryItem(item); | 453 | m_Scene.AddInventoryItem(item); |
454 | 454 | ||
455 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 455 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
@@ -495,16 +495,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
495 | effectivePerms &= grp.GetEffectivePermissions(); | 495 | effectivePerms &= grp.GetEffectivePermissions(); |
496 | effectivePerms |= (uint)PermissionMask.Move; | 496 | effectivePerms |= (uint)PermissionMask.Move; |
497 | 497 | ||
498 | //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
499 | |||
498 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 500 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
499 | { | 501 | { |
500 | uint perms = effectivePerms; | 502 | uint perms = effectivePerms; |
501 | uint nextPerms = (perms & 7) << 13; | 503 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); |
502 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
503 | perms &= ~(uint)PermissionMask.Copy; | ||
504 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
505 | perms &= ~(uint)PermissionMask.Transfer; | ||
506 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
507 | perms &= ~(uint)PermissionMask.Modify; | ||
508 | 504 | ||
509 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | 505 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; |
510 | item.CurrentPermissions = item.BasePermissions; | 506 | item.CurrentPermissions = item.BasePermissions; |
@@ -530,8 +526,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
530 | (uint)PermissionMask.Move | | 526 | (uint)PermissionMask.Move | |
531 | (uint)PermissionMask.Export | | 527 | (uint)PermissionMask.Export | |
532 | 7); // Preserve folded permissions | 528 | 7); // Preserve folded permissions |
533 | } | 529 | } |
534 | 530 | ||
531 | //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
532 | |||
535 | return item; | 533 | return item; |
536 | } | 534 | } |
537 | 535 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 22a53a8..0cb574a 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -198,13 +198,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
198 | item.InvType = (int)InventoryType.Object; | 198 | item.InvType = (int)InventoryType.Object; |
199 | item.Folder = categoryID; | 199 | item.Folder = categoryID; |
200 | 200 | ||
201 | uint nextPerms=(perms & 7) << 13; | 201 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); |
202 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
203 | perms &= ~(uint)PermissionMask.Copy; | ||
204 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
205 | perms &= ~(uint)PermissionMask.Transfer; | ||
206 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
207 | perms &= ~(uint)PermissionMask.Modify; | ||
208 | 202 | ||
209 | item.BasePermissions = perms & part.NextOwnerMask; | 203 | item.BasePermissions = perms & part.NextOwnerMask; |
210 | item.CurrentPermissions = perms & part.NextOwnerMask; | 204 | item.CurrentPermissions = perms & part.NextOwnerMask; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 65536db..9cc5cde 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -669,17 +669,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
669 | // a mask | 669 | // a mask |
670 | if (item.InvType == (int)InventoryType.Object) | 670 | if (item.InvType == (int)InventoryType.Object) |
671 | { | 671 | { |
672 | // Create a safe mask for the current perms | ||
673 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | ||
674 | foldedPerms |= permsMask; | ||
675 | |||
676 | bool isRootMod = (item.CurrentPermissions & | 672 | bool isRootMod = (item.CurrentPermissions & |
677 | (uint)PermissionMask.Modify) != 0 ? | 673 | (uint)PermissionMask.Modify) != 0 ? |
678 | true : false; | 674 | true : false; |
679 | 675 | ||
680 | // Mask the owner perms to the folded perms | 676 | // Mask the owner perms to the folded perms |
681 | ownerPerms &= foldedPerms; | 677 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms); |
682 | basePerms &= foldedPerms; | 678 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms); |
683 | 679 | ||
684 | // If the root was mod, let the mask reflect that | 680 | // If the root was mod, let the mask reflect that |
685 | // We also need to adjust the base here, because | 681 | // We also need to adjust the base here, because |
@@ -1209,9 +1205,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1209 | { | 1205 | { |
1210 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1206 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
1211 | if (taskItem.InvType == (int)InventoryType.Object) | 1207 | if (taskItem.InvType == (int)InventoryType.Object) |
1212 | agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); | 1208 | { |
1209 | uint perms = taskItem.CurrentPermissions; | ||
1210 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); | ||
1211 | agentItem.BasePermissions = perms | (uint)PermissionMask.Move; | ||
1212 | agentItem.CurrentPermissions = agentItem.BasePermissions; | ||
1213 | } | ||
1213 | else | 1214 | else |
1215 | { | ||
1214 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 1216 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
1217 | } | ||
1215 | 1218 | ||
1216 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 1219 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
1217 | agentItem.NextPermissions = taskItem.NextPermissions; | 1220 | agentItem.NextPermissions = taskItem.NextPermissions; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 5fa01e3..fb8ecd5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1132,14 +1132,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1132 | // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", | 1132 | // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", |
1133 | // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); | 1133 | // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); |
1134 | 1134 | ||
1135 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 1135 | if (item.InvType == (int)InventoryType.Object) |
1136 | { | 1136 | { |
1137 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 1137 | uint perms = item.CurrentPermissions; |
1138 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 1138 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); |
1139 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 1139 | item.CurrentPermissions = perms; |
1140 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | ||
1141 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
1142 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
1143 | } | 1140 | } |
1144 | 1141 | ||
1145 | item.CurrentPermissions &= item.NextPermissions; | 1142 | item.CurrentPermissions &= item.NextPermissions; |