Fix errors introduced by incomplete understanding of what folded perms are
parent
c707955517
commit
4385d7d693
|
@ -3053,11 +3053,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
||||||
{
|
{
|
||||||
uint perms = item.CurrentPermissions;
|
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
||||||
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
|
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
||||||
item.CurrentPermissions = perms;
|
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
||||||
|
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
||||||
|
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
||||||
|
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.CurrentPermissions &= item.NextPermissions;
|
item.CurrentPermissions &= item.NextPermissions;
|
||||||
item.BasePermissions &= item.NextPermissions;
|
item.BasePermissions &= item.NextPermissions;
|
||||||
item.EveryOnePermissions &= item.NextPermissions;
|
item.EveryOnePermissions &= item.NextPermissions;
|
||||||
|
|
|
@ -64,24 +64,5 @@ namespace OpenSim.Framework
|
||||||
str = ".";
|
str = ".";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Applies an object's folded permissions to its regular permissions.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="foldedPerms">The folded permissions. Only the lowest 7 bits are examined.</param>
|
|
||||||
/// <param name="mainPerms">The permissions variable to modify.</param>
|
|
||||||
public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms)
|
|
||||||
{
|
|
||||||
// if ((foldedPerms & 7) == 0)
|
|
||||||
// return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded
|
|
||||||
|
|
||||||
if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0)
|
|
||||||
mainPerms &= ~(uint)PermissionMask.Copy;
|
|
||||||
if ((foldedPerms & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
|
||||||
mainPerms &= ~(uint)PermissionMask.Transfer;
|
|
||||||
if ((foldedPerms & ((uint)PermissionMask.Modify >> 13)) == 0)
|
|
||||||
mainPerms &= ~(uint)PermissionMask.Modify;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -532,17 +532,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
AddPermissions(item, objlist[0], objlist, remoteClient);
|
||||||
|
|
||||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
item.Description = asset.Description;
|
item.Description = asset.Description;
|
||||||
item.Name = asset.Name;
|
item.Name = asset.Name;
|
||||||
item.AssetType = asset.Type;
|
item.AssetType = asset.Type;
|
||||||
|
|
||||||
//preserve perms on return
|
|
||||||
if(DeRezAction.Return == action)
|
|
||||||
AddPermissions(item, objlist[0], objlist, null);
|
|
||||||
else
|
|
||||||
AddPermissions(item, objlist[0], objlist, remoteClient);
|
|
||||||
|
|
||||||
m_Scene.AddInventoryItem(item);
|
m_Scene.AddInventoryItem(item);
|
||||||
|
|
||||||
if (remoteClient != null && item.Owner == remoteClient.AgentId)
|
if (remoteClient != null && item.Owner == remoteClient.AgentId)
|
||||||
|
@ -599,15 +595,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
effectivePerms |= (uint)PermissionMask.Move;
|
effectivePerms |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
//PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
|
|
||||||
|
|
||||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
// Changing ownership, so apply the "Next Owner" permissions to all of the
|
// Changing ownership, so apply the "Next Owner" permissions to all of the
|
||||||
// inventory item's permissions.
|
// inventory item's permissions.
|
||||||
|
|
||||||
uint perms = effectivePerms;
|
uint perms = effectivePerms;
|
||||||
PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
|
uint nextPerms = (perms & 7) << 13;
|
||||||
|
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||||
|
perms &= ~(uint)PermissionMask.Copy;
|
||||||
|
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||||
|
perms &= ~(uint)PermissionMask.Transfer;
|
||||||
|
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||||
|
perms &= ~(uint)PermissionMask.Modify;
|
||||||
|
|
||||||
item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
||||||
item.CurrentPermissions = item.BasePermissions;
|
item.CurrentPermissions = item.BasePermissions;
|
||||||
|
@ -642,8 +642,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
7); // Preserve folded permissions
|
7); // Preserve folded permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
//PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
|
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
item.InvType = (int)InventoryType.Object;
|
item.InvType = (int)InventoryType.Object;
|
||||||
item.Folder = categoryID;
|
item.Folder = categoryID;
|
||||||
|
|
||||||
PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
|
uint nextPerms=(perms & 7) << 13;
|
||||||
|
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||||
|
perms &= ~(uint)PermissionMask.Copy;
|
||||||
|
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||||
|
perms &= ~(uint)PermissionMask.Transfer;
|
||||||
|
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||||
|
perms &= ~(uint)PermissionMask.Modify;
|
||||||
|
|
||||||
item.BasePermissions = perms & part.NextOwnerMask;
|
item.BasePermissions = perms & part.NextOwnerMask;
|
||||||
item.CurrentPermissions = perms & part.NextOwnerMask;
|
item.CurrentPermissions = perms & part.NextOwnerMask;
|
||||||
|
|
|
@ -681,13 +681,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// a mask
|
// a mask
|
||||||
if (item.InvType == (int)InventoryType.Object)
|
if (item.InvType == (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
|
// Create a safe mask for the current perms
|
||||||
|
uint foldedPerms = (item.CurrentPermissions & 7) << 13;
|
||||||
|
foldedPerms |= permsMask;
|
||||||
|
|
||||||
bool isRootMod = (item.CurrentPermissions &
|
bool isRootMod = (item.CurrentPermissions &
|
||||||
(uint)PermissionMask.Modify) != 0 ?
|
(uint)PermissionMask.Modify) != 0 ?
|
||||||
true : false;
|
true : false;
|
||||||
|
|
||||||
// Mask the owner perms to the folded perms
|
// Mask the owner perms to the folded perms
|
||||||
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms);
|
ownerPerms &= foldedPerms;
|
||||||
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms);
|
basePerms &= foldedPerms;
|
||||||
|
|
||||||
// If the root was mod, let the mask reflect that
|
// If the root was mod, let the mask reflect that
|
||||||
// We also need to adjust the base here, because
|
// We also need to adjust the base here, because
|
||||||
|
@ -1240,19 +1244,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||||
if (taskItem.InvType == (int)InventoryType.Object)
|
if (taskItem.InvType == (int)InventoryType.Object)
|
||||||
{
|
agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move));
|
||||||
// Bake the new base permissions from folded permissions
|
else
|
||||||
// The folded perms are in the lowest 3 bits of the current perms
|
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
||||||
// We use base permissions here to avoid baking the "Locked" status
|
|
||||||
// into the item as it is passed.
|
|
||||||
uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
|
|
||||||
PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
|
|
||||||
// Avoid the "lock trap" - move must always be enabled but the above may remove it
|
|
||||||
// Add it back here.
|
|
||||||
agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
|
|
||||||
// Newly given items cannot be "locked" on rez. Make sure by
|
|
||||||
// setting current equal to base.
|
|
||||||
}
|
|
||||||
|
|
||||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||||
|
|
||||||
|
|
|
@ -1358,12 +1358,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
// m_log.DebugFormat (
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}",
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions);
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
{
|
||||||
|
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
||||||
|
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
||||||
|
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
||||||
|
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
||||||
|
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
||||||
|
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
item.CurrentPermissions &= item.NextPermissions;
|
item.CurrentPermissions &= item.NextPermissions;
|
||||||
item.BasePermissions &= item.NextPermissions;
|
item.BasePermissions &= item.NextPermissions;
|
||||||
|
|
Loading…
Reference in New Issue