a few changes to permissions folding... we are testing. at this point only use master for TESTING also
parent
8d3d87e0b2
commit
ba4e13ef55
|
@ -79,7 +79,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
FoldedMask = 0x0f,
|
FoldedMask = 0x0f,
|
||||||
|
|
||||||
//
|
FoldingShift = 13 , // number of bit shifts from normal perm to folded or back (same as Transfer shift below)
|
||||||
|
// when doing as a block
|
||||||
|
|
||||||
Transfer = 1 << 13, // 0x02000
|
Transfer = 1 << 13, // 0x02000
|
||||||
Modify = 1 << 14, // 0x04000
|
Modify = 1 << 14, // 0x04000
|
||||||
Copy = 1 << 15, // 0x08000
|
Copy = 1 << 15, // 0x08000
|
||||||
|
@ -91,6 +93,7 @@ namespace OpenSim.Framework
|
||||||
All = 0x8e000,
|
All = 0x8e000,
|
||||||
AllAndExport = 0x9e000,
|
AllAndExport = 0x9e000,
|
||||||
AllEffective = 0x9e000
|
AllEffective = 0x9e000
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -574,8 +574,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
IClientAPI remoteClient)
|
IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
|
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
|
||||||
uint allObjectsNextOwnerPerms = 0x7fffffff;
|
|
||||||
|
|
||||||
// For the porposes of inventory, an object is modify if the prims
|
// For the porposes of inventory, an object is modify if the prims
|
||||||
// are modify. This allows renaming an object that contains no
|
// are modify. This allows renaming an object that contains no
|
||||||
// mod items.
|
// mod items.
|
||||||
|
@ -591,21 +590,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
uint perms = effectivePerms;
|
if ((effectivePerms & (uint)PermissionMask.FoldedCopy) == 0)
|
||||||
uint nextPerms = (perms & 7) << 13;
|
effectivePerms &= ~(uint)PermissionMask.Copy;
|
||||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
if ((effectivePerms & (uint)PermissionMask.FoldedTransfer) == 0)
|
||||||
perms &= ~(uint)PermissionMask.Copy;
|
effectivePerms &= ~(uint)PermissionMask.Transfer;
|
||||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
if ((effectivePerms & (uint)PermissionMask.FoldedExport) == 0)
|
||||||
perms &= ~(uint)PermissionMask.Transfer;
|
effectivePerms &= ~(uint)PermissionMask.Export;
|
||||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
|
||||||
perms &= ~(uint)PermissionMask.Modify;
|
|
||||||
|
|
||||||
// item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
uint basePerms = effectivePerms & so.RootPart.NextOwnerMask;
|
||||||
|
|
||||||
uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask;
|
if((basePerms & (uint)PermissionMask.Copy) == 0)
|
||||||
item.BasePermissions = perms & nextp;
|
basePerms |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
|
// unlock
|
||||||
|
basePerms |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
|
basePerms &= ~(uint)PermissionMask.FoldedMask;
|
||||||
|
basePerms |= ((basePerms >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask);
|
||||||
|
|
||||||
|
item.BasePermissions = basePerms;
|
||||||
item.CurrentPermissions = item.BasePermissions;
|
item.CurrentPermissions = item.BasePermissions;
|
||||||
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
|
item.NextPermissions = effectivePerms & so.RootPart.NextOwnerMask;
|
||||||
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
|
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
|
||||||
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
|
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
|
||||||
|
|
||||||
|
@ -626,7 +631,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
(uint)PermissionMask.Modify |
|
(uint)PermissionMask.Modify |
|
||||||
(uint)PermissionMask.Move |
|
(uint)PermissionMask.Move |
|
||||||
(uint)PermissionMask.Export |
|
(uint)PermissionMask.Export |
|
||||||
7); // Preserve folded permissions
|
(uint)PermissionMask.FoldedMask); // Preserve folded permissions ??
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|
|
@ -682,19 +682,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// These will be applied to the root prim at next rez.
|
// These will be applied to the root prim at next rez.
|
||||||
// The legacy slam bit (bit 3) and folded permission (bits 0-2)
|
// The legacy slam bit (bit 3) and folded permission (bits 0-2)
|
||||||
// are preserved due to the above mangling
|
// are preserved due to the above mangling
|
||||||
ownerPerms &= nextPerms;
|
// ownerPerms &= nextPerms;
|
||||||
|
|
||||||
// Mask the base permissions. This is a conservative
|
// Mask the base permissions. This is a conservative
|
||||||
// approach altering only the three main perms
|
// approach altering only the three main perms
|
||||||
basePerms &= nextPerms;
|
// basePerms &= nextPerms;
|
||||||
|
|
||||||
// Mask out the folded portion of the base mask.
|
// Mask out the folded portion of the base mask.
|
||||||
// While the owner mask carries the actual folded
|
// While the owner mask carries the actual folded
|
||||||
// permissions, the base mask carries the original
|
// permissions, the base mask carries the original
|
||||||
// base mask, before masking with the folded perms.
|
// base mask, before masking with the folded perms.
|
||||||
// We need this later for rezzing.
|
// We need this later for rezzing.
|
||||||
basePerms &= ~(uint)PermissionMask.FoldedMask;
|
// basePerms &= ~(uint)PermissionMask.FoldedMask;
|
||||||
basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
|
// basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
|
||||||
|
|
||||||
// If this is an object, root prim perms may be more
|
// If this is an object, root prim perms may be more
|
||||||
// permissive than folded perms. Use folded perms as
|
// permissive than folded perms. Use folded perms as
|
||||||
|
@ -729,6 +729,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// move here so nextperms are mandatory
|
||||||
|
ownerPerms &= nextPerms;
|
||||||
|
basePerms &= nextPerms;
|
||||||
|
basePerms &= ~(uint)PermissionMask.FoldedMask;
|
||||||
|
basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
|
||||||
// Assign to the actual item. Make sure the slam bit is
|
// Assign to the actual item. Make sure the slam bit is
|
||||||
// set, if it wasn't set before.
|
// set, if it wasn't set before.
|
||||||
itemCopy.BasePermissions = basePerms;
|
itemCopy.BasePermissions = basePerms;
|
||||||
|
|
|
@ -326,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// aux
|
// aux
|
||||||
const uint allmask = (uint)PermissionMask.AllEffective;
|
const uint allmask = (uint)PermissionMask.AllEffective;
|
||||||
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
||||||
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
const uint copytransfermask = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
|
||||||
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
|
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
|
||||||
bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
|
bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
|
||||||
|
@ -350,7 +350,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// recover modify and move
|
// recover modify and move
|
||||||
rootOwnerPerms &= movemodmask;
|
rootOwnerPerms &= movemodmask;
|
||||||
owner |= rootOwnerPerms;
|
owner |= rootOwnerPerms;
|
||||||
if((owner & copytransfermast) == 0)
|
if((owner & copytransfermask) == 0)
|
||||||
owner |= (uint)PermissionMask.Transfer;
|
owner |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
owner &= basePerms;
|
owner &= basePerms;
|
||||||
|
@ -479,17 +479,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetEffectivePermissions()
|
|
||||||
{
|
|
||||||
return GetEffectivePermissions(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint GetEffectivePermissions(bool useBase)
|
public uint GetEffectivePermissions(bool useBase)
|
||||||
{
|
{
|
||||||
uint perms=(uint)(PermissionMask.Modify |
|
uint perms=(uint)(PermissionMask.Modify |
|
||||||
PermissionMask.Copy |
|
PermissionMask.Copy |
|
||||||
PermissionMask.Move |
|
PermissionMask.Move |
|
||||||
PermissionMask.Transfer) | 7;
|
PermissionMask.Transfer |
|
||||||
|
PermissionMask.FoldedMask);
|
||||||
|
|
||||||
uint ownerMask = 0x7fffffff;
|
uint ownerMask = 0x7fffffff;
|
||||||
|
|
||||||
|
@ -512,17 +508,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
perms &= ~(uint)PermissionMask.Copy;
|
perms &= ~(uint)PermissionMask.Copy;
|
||||||
if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
|
if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
|
||||||
perms &= ~(uint)PermissionMask.Transfer;
|
perms &= ~(uint)PermissionMask.Transfer;
|
||||||
|
if ((ownerMask & (uint)PermissionMask.Export) == 0)
|
||||||
// If root prim permissions are applied here, this would screw
|
perms &= ~(uint)PermissionMask.Export;
|
||||||
// with in-inventory manipulation of the next owner perms
|
|
||||||
// in a major way. So, let's move this to the give itself.
|
|
||||||
// Yes. I know. Evil.
|
|
||||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
|
|
||||||
// perms &= ~((uint)PermissionMask.Modify >> 13);
|
|
||||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
|
|
||||||
// perms &= ~((uint)PermissionMask.Copy >> 13);
|
|
||||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
|
|
||||||
// perms &= ~((uint)PermissionMask.Transfer >> 13);
|
|
||||||
|
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5288,9 +5288,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
// Export needs to be preserved in the base and everyone
|
// Export needs to be preserved in the base and everyone
|
||||||
// mask, but removed in the owner mask as a next owner
|
// mask, but removed in the owner mask as a next owner
|
||||||
// can never change the export status
|
// can never change the export status
|
||||||
BaseMask &= NextOwnerMask | (uint)PermissionMask.Export;
|
BaseMask &= (NextOwnerMask | (uint)PermissionMask.Export);
|
||||||
OwnerMask &= NextOwnerMask;
|
OwnerMask &= NextOwnerMask;
|
||||||
EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export;
|
EveryoneMask &= (NextOwnerMask | (uint)PermissionMask.Export);
|
||||||
GroupMask = 0; // Giving an object zaps group permissions
|
GroupMask = 0; // Giving an object zaps group permissions
|
||||||
|
|
||||||
Inventory.ApplyNextOwnerPermissions();
|
Inventory.ApplyNextOwnerPermissions();
|
||||||
|
|
|
@ -1340,33 +1340,38 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public uint MaskEffectivePermissions()
|
public uint MaskEffectivePermissions()
|
||||||
{
|
{
|
||||||
|
// used to propagate permissions restrictions outwards
|
||||||
|
// Modify does not propagate outwards.
|
||||||
uint mask=0x7fffffff;
|
uint mask=0x7fffffff;
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
|
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
|
||||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
mask &= ~((uint)PermissionMask.FoldedCopy);
|
||||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
|
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
|
||||||
mask &= ~((uint)PermissionMask.Transfer >> 13);
|
mask &= ~((uint)PermissionMask.FoldedTransfer);
|
||||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
|
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Export) == 0)
|
||||||
mask &= ~((uint)PermissionMask.Modify >> 13);
|
mask &= ~((uint)PermissionMask.FoldedExport);
|
||||||
|
|
||||||
|
// this breaks some SL legal use cases
|
||||||
|
// there should be no folding from task inventory
|
||||||
|
/*
|
||||||
if (item.InvType == (int)InventoryType.Object)
|
if (item.InvType == (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedCopy)) == 0)
|
||||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
mask &= ~((uint)PermissionMask.FoldedCopy);
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedTransfer)) == 0)
|
||||||
mask &= ~((uint)PermissionMask.Transfer >> 13);
|
mask &= ~((uint)PermissionMask.FoldedTransfer);
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) == 0)
|
||||||
mask &= ~((uint)PermissionMask.Modify >> 13);
|
mask &= ~((uint)PermissionMask.FoldedExport);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||||
mask &= ~(uint)PermissionMask.Copy;
|
mask &= ~(uint)PermissionMask.Copy;
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
||||||
mask &= ~(uint)PermissionMask.Transfer;
|
mask &= ~(uint)PermissionMask.Transfer;
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
|
if ((item.CurrentPermissions & (uint)PermissionMask.Export) == 0)
|
||||||
mask &= ~(uint)PermissionMask.Modify;
|
mask &= ~((uint)PermissionMask.Export);
|
||||||
}
|
}
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
@ -1375,19 +1380,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
|
||||||
|
// this breaks legal SL use cases
|
||||||
|
// there should be no unfold into task inventory
|
||||||
|
/*
|
||||||
|
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & (uint)PermissionMask.FoldedMask) != 0)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat (
|
// m_log.DebugFormat (
|
||||||
// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}",
|
// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}",
|
||||||
// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions);
|
// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions);
|
||||||
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedCopy)) == 0)
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedTransfer)) == 0)
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedModify)) == 0)
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
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;
|
||||||
|
|
Loading…
Reference in New Issue