diff options
Diffstat (limited to '')
6 files changed, 46 insertions, 58 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index a5c9fb4..597b439 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -3053,11 +3053,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3053 | { | 3053 | { |
3054 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 3054 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) |
3055 | { | 3055 | { |
3056 | uint perms = item.CurrentPermissions; | 3056 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) |
3057 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms); | 3057 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; |
3058 | item.CurrentPermissions = perms; | 3058 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) |
3059 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | ||
3060 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
3061 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
3059 | } | 3062 | } |
3060 | |||
3061 | item.CurrentPermissions &= item.NextPermissions; | 3063 | item.CurrentPermissions &= item.NextPermissions; |
3062 | item.BasePermissions &= item.NextPermissions; | 3064 | item.BasePermissions &= item.NextPermissions; |
3063 | item.EveryOnePermissions &= item.NextPermissions; | 3065 | item.EveryOnePermissions &= item.NextPermissions; |
diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 5d3186d..3dce04d 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs | |||
@@ -64,24 +64,5 @@ 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 | |||
86 | } | 67 | } |
87 | } | 68 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index fcf373b..4fb4cc2 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -532,17 +532,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
532 | } | 532 | } |
533 | else | 533 | else |
534 | { | 534 | { |
535 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
536 | |||
535 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 537 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
536 | item.Description = asset.Description; | 538 | item.Description = asset.Description; |
537 | item.Name = asset.Name; | 539 | item.Name = asset.Name; |
538 | item.AssetType = asset.Type; | 540 | item.AssetType = asset.Type; |
539 | 541 | ||
540 | //preserve perms on return | ||
541 | if(DeRezAction.Return == action) | ||
542 | AddPermissions(item, objlist[0], objlist, null); | ||
543 | else | ||
544 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
545 | |||
546 | m_Scene.AddInventoryItem(item); | 542 | m_Scene.AddInventoryItem(item); |
547 | 543 | ||
548 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 544 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
@@ -599,15 +595,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
599 | } | 595 | } |
600 | effectivePerms |= (uint)PermissionMask.Move; | 596 | effectivePerms |= (uint)PermissionMask.Move; |
601 | 597 | ||
602 | //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
603 | |||
604 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 598 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
605 | { | 599 | { |
606 | // Changing ownership, so apply the "Next Owner" permissions to all of the | 600 | // Changing ownership, so apply the "Next Owner" permissions to all of the |
607 | // inventory item's permissions. | 601 | // inventory item's permissions. |
608 | 602 | ||
609 | uint perms = effectivePerms; | 603 | uint perms = effectivePerms; |
610 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); | 604 | uint nextPerms = (perms & 7) << 13; |
605 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
606 | perms &= ~(uint)PermissionMask.Copy; | ||
607 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
608 | perms &= ~(uint)PermissionMask.Transfer; | ||
609 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
610 | perms &= ~(uint)PermissionMask.Modify; | ||
611 | 611 | ||
612 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | 612 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; |
613 | item.CurrentPermissions = item.BasePermissions; | 613 | item.CurrentPermissions = item.BasePermissions; |
@@ -640,10 +640,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
640 | (uint)PermissionMask.Move | | 640 | (uint)PermissionMask.Move | |
641 | (uint)PermissionMask.Export | | 641 | (uint)PermissionMask.Export | |
642 | 7); // Preserve folded permissions | 642 | 7); // Preserve folded permissions |
643 | } | 643 | } |
644 | 644 | ||
645 | //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
646 | |||
647 | return item; | 645 | return item; |
648 | } | 646 | } |
649 | 647 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index b7f01be..2837358 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -211,7 +211,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
211 | item.InvType = (int)InventoryType.Object; | 211 | item.InvType = (int)InventoryType.Object; |
212 | item.Folder = categoryID; | 212 | item.Folder = categoryID; |
213 | 213 | ||
214 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); | 214 | uint nextPerms=(perms & 7) << 13; |
215 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
216 | perms &= ~(uint)PermissionMask.Copy; | ||
217 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
218 | perms &= ~(uint)PermissionMask.Transfer; | ||
219 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
220 | perms &= ~(uint)PermissionMask.Modify; | ||
215 | 221 | ||
216 | item.BasePermissions = perms & part.NextOwnerMask; | 222 | item.BasePermissions = perms & part.NextOwnerMask; |
217 | item.CurrentPermissions = perms & part.NextOwnerMask; | 223 | item.CurrentPermissions = perms & part.NextOwnerMask; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e3ccf96..9c8dbb6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -681,13 +681,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
681 | // a mask | 681 | // a mask |
682 | if (item.InvType == (int)InventoryType.Object) | 682 | if (item.InvType == (int)InventoryType.Object) |
683 | { | 683 | { |
684 | // Create a safe mask for the current perms | ||
685 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | ||
686 | foldedPerms |= permsMask; | ||
687 | |||
684 | bool isRootMod = (item.CurrentPermissions & | 688 | bool isRootMod = (item.CurrentPermissions & |
685 | (uint)PermissionMask.Modify) != 0 ? | 689 | (uint)PermissionMask.Modify) != 0 ? |
686 | true : false; | 690 | true : false; |
687 | 691 | ||
688 | // Mask the owner perms to the folded perms | 692 | // Mask the owner perms to the folded perms |
689 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms); | 693 | ownerPerms &= foldedPerms; |
690 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms); | 694 | basePerms &= foldedPerms; |
691 | 695 | ||
692 | // If the root was mod, let the mask reflect that | 696 | // If the root was mod, let the mask reflect that |
693 | // We also need to adjust the base here, because | 697 | // We also need to adjust the base here, because |
@@ -1240,19 +1244,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1240 | { | 1244 | { |
1241 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1245 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
1242 | if (taskItem.InvType == (int)InventoryType.Object) | 1246 | if (taskItem.InvType == (int)InventoryType.Object) |
1243 | { | 1247 | agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); |
1244 | // Bake the new base permissions from folded permissions | 1248 | else |
1245 | // The folded perms are in the lowest 3 bits of the current perms | 1249 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
1246 | // We use base permissions here to avoid baking the "Locked" status | ||
1247 | // into the item as it is passed. | ||
1248 | uint perms = taskItem.BasePermissions & taskItem.NextPermissions; | ||
1249 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); | ||
1250 | // Avoid the "lock trap" - move must always be enabled but the above may remove it | ||
1251 | // Add it back here. | ||
1252 | agentItem.BasePermissions = perms | (uint)PermissionMask.Move; | ||
1253 | // Newly given items cannot be "locked" on rez. Make sure by | ||
1254 | // setting current equal to base. | ||
1255 | } | ||
1256 | 1250 | ||
1257 | agentItem.CurrentPermissions = agentItem.BasePermissions; | 1251 | agentItem.CurrentPermissions = agentItem.BasePermissions; |
1258 | 1252 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index a50f162..45c3ebd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1358,12 +1358,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1358 | { | 1358 | { |
1359 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 1359 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) |
1360 | { | 1360 | { |
1361 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 1361 | // m_log.DebugFormat ( |
1362 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 1362 | // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", |
1363 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 1363 | // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); |
1364 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | 1364 | |
1365 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 1365 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) |
1366 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 1366 | { |
1367 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | ||
1368 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | ||
1369 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | ||
1370 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | ||
1371 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
1372 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
1373 | } | ||
1367 | } | 1374 | } |
1368 | item.CurrentPermissions &= item.NextPermissions; | 1375 | item.CurrentPermissions &= item.NextPermissions; |
1369 | item.BasePermissions &= item.NextPermissions; | 1376 | item.BasePermissions &= item.NextPermissions; |