Fix the long-standing bug that object permissions set in inventory were lost

NOTE: Items rezzed by users using 0.8 or older will still exhibit broken
behaviour. Until 0.8 becomes end of life, this fix will not produce
dependable results on grids with mixed versions. Grids based on 0.9 will
now work properly.
melanie
Melanie Thielker 2017-01-06 17:05:00 +00:00
parent da76224eac
commit e526e8c5e2
4 changed files with 21 additions and 11 deletions

View File

@ -1141,6 +1141,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
part.OwnerID = item.Owner;
part.RezzerID = item.Owner;
part.Inventory.ChangeInventoryOwner(item.Owner);
// This applies the base mask from the item as the next
// permissions for the object. This is correct because the
// giver's base mask was masked by the giver's next owner
// mask, so the base mask equals the original next owner mask.
part.NextOwnerMask = item.BasePermissions;
}
so.ApplyNextOwnerPermissions();
@ -1152,10 +1158,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
{
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
part.NextOwnerMask = item.NextPermissions & part.BaseMask;
part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
part.NextOwnerMask = item.NextPermissions & part.BaseMask;
}
}
}

View File

@ -627,6 +627,7 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.AssetType = item.AssetType;
itemCopy.InvType = item.InvType;
itemCopy.Folder = recipientFolderId;
itemCopy.Flags = item.Flags;
if (Permissions.PropagatePermissions() && recipient != senderId)
{
@ -643,7 +644,7 @@ namespace OpenSim.Region.Framework.Scenes
//
// Transfer
// Copy
// Modufy
// Modify
uint permsMask = ~ ((uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer |
(uint)PermissionMask.Modify);
@ -718,6 +719,10 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.BasePermissions = basePerms;
itemCopy.CurrentPermissions = ownerPerms;
itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
// Need to clear the other inventory slam options.
// That is so we can handle the case where the recipient
// changes the bits in inventory before rezzing
itemCopy.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
itemCopy.NextPermissions = item.NextPermissions;
@ -767,9 +772,8 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.GroupID = UUID.Zero;
itemCopy.GroupOwned = false;
itemCopy.Flags = item.Flags;
itemCopy.SalePrice = item.SalePrice;
itemCopy.SaleType = item.SaleType;
itemCopy.SalePrice = 0; //item.SalePrice;
itemCopy.SaleType = 0; //item.SaleType;
IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
@ -1251,9 +1255,11 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.CurrentPermissions = agentItem.BasePermissions;
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
agentItem.NextPermissions = taskItem.NextPermissions;
agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
// Group permissions make no sense here
agentItem.GroupPermissions = 0;
}
else
{
@ -1261,7 +1267,7 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.CurrentPermissions = taskItem.CurrentPermissions;
agentItem.NextPermissions = taskItem.NextPermissions;
agentItem.EveryOnePermissions = taskItem.EveryonePermissions;
agentItem.GroupPermissions = taskItem.GroupPermissions;
agentItem.GroupPermissions = 0;
}
message = null;

View File

@ -5242,6 +5242,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
BaseMask &= NextOwnerMask | (uint)PermissionMask.Export;
OwnerMask &= NextOwnerMask;
EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export;
GroupMask = 0; // Giving an object zaps group permissions
Inventory.ApplyNextOwnerPermissions();
}

View File

@ -947,7 +947,6 @@ namespace OpenSim.Services.UserAccountService
if (item.InvType == (int)InventoryType.Object)
{
uint perms = item.CurrentPermissions;
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
item.CurrentPermissions = perms;
}