From 7f99a8c900251c59bc7cb7d8309a14ad5360de42 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Jan 2011 16:20:38 +0100 Subject: Fix direct item give permissions --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 44 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 1f32362..7216b39 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -308,10 +308,17 @@ namespace OpenSim.Region.Framework.Scenes { if (UUID.Zero == transactionID) { + item.Flags = itemUpd.Flags; item.Name = itemUpd.Name; item.Description = itemUpd.Description; + if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) + item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; + if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions)) + item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; + if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) + item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; item.GroupID = itemUpd.GroupID; item.GroupOwned = itemUpd.GroupOwned; @@ -326,9 +333,12 @@ namespace OpenSim.Region.Framework.Scenes // TODO: Check if folder changed and move item //item.NextPermissions = itemUpd.Folder; item.InvType = itemUpd.InvType; + + if (item.SalePrice != itemUpd.SalePrice || + item.SaleType != itemUpd.SaleType) + item.Flags |= (uint)InventoryItemFlags.ObjectSlamSale; item.SalePrice = itemUpd.SalePrice; item.SaleType = itemUpd.SaleType; - item.Flags = itemUpd.Flags; InventoryService.UpdateItem(item); } @@ -509,7 +519,8 @@ namespace OpenSim.Region.Framework.Scenes // Assign to the actual item. Make sure the slam bit is // set, if it wasn't set before. itemCopy.BasePermissions = basePerms; - itemCopy.CurrentPermissions = ownerPerms | 16; // Slam + itemCopy.CurrentPermissions = ownerPerms; + itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; itemCopy.NextPermissions = item.NextPermissions; @@ -1049,7 +1060,7 @@ namespace OpenSim.Region.Framework.Scenes else agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; - agentItem.CurrentPermissions |= 16; // Slam + agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; agentItem.NextPermissions = taskItem.NextPermissions; agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; @@ -1260,7 +1271,7 @@ namespace OpenSim.Region.Framework.Scenes (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); destTaskItem.BasePermissions = srcTaskItem.BasePermissions & (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); - destTaskItem.CurrentPermissions |= 16; // Slam! + destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; } } @@ -1434,6 +1445,8 @@ namespace OpenSim.Region.Framework.Scenes // Base ALWAYS has move currentItem.BasePermissions |= (uint)PermissionMask.Move; + itemInfo.Flags = currentItem.Flags; + // Check if we're allowed to mess with permissions if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god { @@ -1451,6 +1464,14 @@ namespace OpenSim.Region.Framework.Scenes // Owner can't change base, and can change other // only up to base itemInfo.BasePermissions = currentItem.BasePermissions; + if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; + if (itemInfo.GroupPermissions != currentItem.GroupPermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; + if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; + if (itemInfo.NextPermissions != currentItem.NextPermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; itemInfo.EveryonePermissions &= currentItem.BasePermissions; itemInfo.GroupPermissions &= currentItem.BasePermissions; itemInfo.CurrentPermissions &= currentItem.BasePermissions; @@ -1458,6 +1479,19 @@ namespace OpenSim.Region.Framework.Scenes } } + else + { + if (itemInfo.BasePermissions != currentItem.BasePermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase; + if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; + if (itemInfo.GroupPermissions != currentItem.GroupPermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; + if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; + if (itemInfo.NextPermissions != currentItem.NextPermissions) + itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; + } // Next ALWAYS has move itemInfo.NextPermissions |= (uint)PermissionMask.Move; @@ -1666,7 +1700,7 @@ namespace OpenSim.Region.Framework.Scenes srcTaskItem.NextPermissions; destTaskItem.BasePermissions = srcTaskItem.BasePermissions & srcTaskItem.NextPermissions; - destTaskItem.CurrentPermissions |= 16; // Slam! + destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; } } -- cgit v1.1 From f59b55d930b4a715d2ea5b99d2b3f5494073b1ae Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Jan 2011 17:40:21 +0100 Subject: Dont' trust the viewer! Fix a permission slam error caused by trusting the viewer too much. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7216b39..7fa5509 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -308,7 +308,6 @@ namespace OpenSim.Region.Framework.Scenes { if (UUID.Zero == transactionID) { - item.Flags = itemUpd.Flags; item.Name = itemUpd.Name; item.Description = itemUpd.Description; if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) -- cgit v1.1