recover PermissionsUtil.ApplyFoldedPermissions (well my version). its use easys code readability
parent
725ccbb477
commit
04117d9f75
|
@ -3087,15 +3087,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ApplyNextOwnerPermissions(InventoryItemBase item)
|
private void ApplyNextOwnerPermissions(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
if (item.InvType == (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
uint perms = item.CurrentPermissions;
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
item.CurrentPermissions = perms;
|
||||||
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,5 +64,37 @@ namespace OpenSim.Framework
|
||||||
str = ".";
|
str = ".";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ApplyFoldedPermissions(uint source, ref uint target)
|
||||||
|
{
|
||||||
|
uint folded = source & (uint)PermissionMask.FoldedMask;
|
||||||
|
if(folded == 0) // invalid we need to ignore
|
||||||
|
return;
|
||||||
|
|
||||||
|
folded <<= (int)PermissionMask.FoldingShift;
|
||||||
|
folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well
|
||||||
|
folded |= ~(uint)PermissionMask.UnfoldedMask;
|
||||||
|
|
||||||
|
uint tmp = target;
|
||||||
|
tmp &= folded;
|
||||||
|
target = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not touch MOD
|
||||||
|
public static void ApplyNoModFoldedPermissions(uint source, ref uint target)
|
||||||
|
{
|
||||||
|
uint folded = source & (uint)PermissionMask.FoldedMask;
|
||||||
|
if(folded == 0) // invalid we need to ignore
|
||||||
|
return;
|
||||||
|
|
||||||
|
folded <<= (int)PermissionMask.FoldingShift;
|
||||||
|
folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well
|
||||||
|
folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify);
|
||||||
|
|
||||||
|
uint tmp = target;
|
||||||
|
tmp &= folded;
|
||||||
|
target = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,8 @@ namespace OpenSim.Framework
|
||||||
// explicitly given
|
// explicitly given
|
||||||
All = 0x8e000,
|
All = 0x8e000,
|
||||||
AllAndExport = 0x9e000,
|
AllAndExport = 0x9e000,
|
||||||
AllEffective = 0x9e000
|
AllEffective = 0x9e000,
|
||||||
|
UnfoldedMask = 0x1e000
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -573,7 +573,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
|
InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
|
||||||
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 | PermissionMask.FoldedMask);
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -586,19 +586,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
effectivePerms &= groupPerms;
|
effectivePerms &= groupPerms;
|
||||||
}
|
}
|
||||||
effectivePerms |= (uint)PermissionMask.Move;
|
|
||||||
|
|
||||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
if ((effectivePerms & (uint)PermissionMask.FoldedCopy) == 0)
|
PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms);
|
||||||
effectivePerms &= ~(uint)PermissionMask.Copy;
|
|
||||||
if ((effectivePerms & (uint)PermissionMask.FoldedTransfer) == 0)
|
|
||||||
effectivePerms &= ~(uint)PermissionMask.Transfer;
|
|
||||||
if ((effectivePerms & (uint)PermissionMask.FoldedExport) == 0)
|
|
||||||
effectivePerms &= ~(uint)PermissionMask.Export;
|
|
||||||
|
|
||||||
uint basePerms = effectivePerms & so.RootPart.NextOwnerMask;
|
uint basePerms = effectivePerms & so.RootPart.NextOwnerMask;
|
||||||
|
|
||||||
|
// rebuild folded perms since we don't have then on inworld objects
|
||||||
|
// possible existent ones where already unfolded
|
||||||
|
|
||||||
if((basePerms & (uint)PermissionMask.Copy) == 0)
|
if((basePerms & (uint)PermissionMask.Copy) == 0)
|
||||||
basePerms |= (uint)PermissionMask.Transfer;
|
basePerms |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
|
|
|
@ -208,19 +208,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
|
|
||||||
perms = group.GetEffectivePermissions(false);
|
perms = group.GetEffectivePermissions(false);
|
||||||
|
|
||||||
// if((perms & (uint)PermissionMask.FoldedMask) != 0)
|
PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
|
||||||
{
|
|
||||||
if ((perms & (uint)PermissionMask.FoldedCopy) == 0)
|
|
||||||
perms &= ~(uint)PermissionMask.Copy;
|
|
||||||
if ((perms & (uint)PermissionMask.FoldedTransfer) == 0)
|
|
||||||
perms &= ~(uint)PermissionMask.Transfer;
|
|
||||||
if ((perms & (uint)PermissionMask.FoldedModify) == 0)
|
|
||||||
perms &= ~(uint)PermissionMask.Modify;
|
|
||||||
if ((perms & (uint)PermissionMask.FoldedExport) == 0)
|
|
||||||
perms &= ~(uint)PermissionMask.Export;
|
|
||||||
}
|
|
||||||
item.BasePermissions = perms & part.NextOwnerMask;
|
item.BasePermissions = perms & part.NextOwnerMask;
|
||||||
item.CurrentPermissions = perms & part.NextOwnerMask;
|
|
||||||
|
// we need to rebuild folded here
|
||||||
|
|
||||||
|
item.CurrentPermissions = item.BasePermissions;
|
||||||
item.NextPermissions = part.NextOwnerMask;
|
item.NextPermissions = part.NextOwnerMask;
|
||||||
item.EveryOnePermissions = part.EveryoneMask &
|
item.EveryOnePermissions = part.EveryoneMask &
|
||||||
part.NextOwnerMask;
|
part.NextOwnerMask;
|
||||||
|
|
|
@ -1267,17 +1267,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// TODO: Fix this after the inventory fixer exists and has beenr run
|
// TODO: Fix this after the inventory fixer exists and has beenr run
|
||||||
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions;
|
||||||
if (taskItem.InvType == (int)InventoryType.Object)
|
if (taskItem.InvType == (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
if((taskItem.CurrentPermissions & (uint)PermissionMask.FoldedMask) != 0)
|
uint perms = agentItem.BasePermissions;
|
||||||
agentItem.BasePermissions &=
|
PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms );
|
||||||
(((taskItem.CurrentPermissions & (uint)PermissionMask.FoldedMask ) << (int)PermissionMask.FoldingShift) |
|
agentItem.BasePermissions = perms;
|
||||||
(taskItem.CurrentPermissions & (uint)PermissionMask.Move));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
agentItem.BasePermissions &= taskItem.CurrentPermissions;
|
agentItem.BasePermissions &= taskItem.CurrentPermissions;
|
||||||
|
|
||||||
|
// always unlock
|
||||||
|
agentItem.BasePermissions |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||||
|
|
||||||
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||||
|
|
Loading…
Reference in New Issue