chance new effective permissions code to ease aggregation on demand( ie on changes). But still doing full aggregation on checks, so still heavy
parent
d78f04b326
commit
733072b6a3
|
@ -80,15 +80,17 @@ namespace OpenSim.Framework
|
||||||
FoldedMask = 0x0f,
|
FoldedMask = 0x0f,
|
||||||
|
|
||||||
//
|
//
|
||||||
Transfer = 1 << 13,
|
Transfer = 1 << 13, // 0x02000
|
||||||
Modify = 1 << 14,
|
Modify = 1 << 14, // 0x04000
|
||||||
Copy = 1 << 15,
|
Copy = 1 << 15, // 0x08000
|
||||||
Export = 1 << 16,
|
Export = 1 << 16, // 0x10000
|
||||||
Move = 1 << 19,
|
Move = 1 << 19, // 0x80000
|
||||||
Damage = 1 << 20,
|
Damage = 1 << 20, // 0x100000 does not seem to be in use
|
||||||
// All does not contain Export, which is special and must be
|
// All does not contain Export, which is special and must be
|
||||||
// explicitly given
|
// explicitly given
|
||||||
All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19)
|
All = 0x8e000,
|
||||||
|
AllAndExport = 0x9e000,
|
||||||
|
AllEffective = 0x9e000
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -278,10 +278,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="datastore"></param>
|
/// <param name="datastore"></param>
|
||||||
void ProcessInventoryBackup(ISimulationDataService datastore);
|
void ProcessInventoryBackup(ISimulationDataService datastore);
|
||||||
|
|
||||||
void AggregateEveryOnePerms(ref uint current);
|
void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone);
|
||||||
void AggregateGroupOrEveryonePerms(ref uint current);
|
|
||||||
void AggregateGroupPerms(ref uint current);
|
|
||||||
void AggregateOwnerPerms(ref uint current);
|
|
||||||
|
|
||||||
uint MaskEffectivePermissions();
|
uint MaskEffectivePermissions();
|
||||||
|
|
||||||
|
|
|
@ -259,41 +259,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
// bc this is on heavy duty code paths
|
// bc this is on heavy duty code paths
|
||||||
// but for now we need to test the concept
|
// but for now we need to test the concept
|
||||||
AggregateEveryOnePerms();
|
AggregateDeepPerms();
|
||||||
return m_EffectiveEveryOnePerms;
|
return m_EffectiveEveryOnePerms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AggregateEveryOnePerms()
|
|
||||||
{
|
|
||||||
lock(PermissionsLock)
|
|
||||||
{
|
|
||||||
// get object everyone permissions
|
|
||||||
uint baseperms = RootPart.EveryoneMask & (uint)PermissionMask.All;
|
|
||||||
|
|
||||||
if(baseperms == 0)
|
|
||||||
{
|
|
||||||
m_EffectiveEveryOnePerms = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint current = baseperms;
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
{
|
|
||||||
SceneObjectPart part = parts[i];
|
|
||||||
part.Inventory.AggregateEveryOnePerms(ref current);
|
|
||||||
if( current == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// recover move
|
|
||||||
baseperms &= (uint)PermissionMask.Move;
|
|
||||||
current |= baseperms;
|
|
||||||
current &= (uint)PermissionMask.All;
|
|
||||||
m_EffectiveEveryOnePerms = current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private uint m_EffectiveGroupPerms;
|
private uint m_EffectiveGroupPerms;
|
||||||
public uint EffectiveGroupPerms
|
public uint EffectiveGroupPerms
|
||||||
{
|
{
|
||||||
|
@ -302,42 +272,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
// bc this is on heavy duty code paths
|
// bc this is on heavy duty code paths
|
||||||
// but for now we need to test the concept
|
// but for now we need to test the concept
|
||||||
AggregateGroupPerms();
|
AggregateDeepPerms();
|
||||||
return m_EffectiveGroupPerms;
|
return m_EffectiveGroupPerms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AggregateGroupPerms()
|
|
||||||
{
|
|
||||||
lock(PermissionsLock)
|
|
||||||
{
|
|
||||||
// get object everyone permissions
|
|
||||||
uint baseperms = RootPart.GroupMask & (uint)PermissionMask.All;
|
|
||||||
|
|
||||||
if(baseperms == 0)
|
|
||||||
{
|
|
||||||
m_EffectiveGroupPerms = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint current = baseperms;
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
{
|
|
||||||
SceneObjectPart part = parts[i];
|
|
||||||
part.Inventory.AggregateGroupPerms(ref current);
|
|
||||||
if( current == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// recover modify and move
|
|
||||||
baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
|
|
||||||
current |= baseperms;
|
|
||||||
current &= (uint)PermissionMask.All;
|
|
||||||
m_EffectiveGroupPerms = current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private uint m_EffectiveGroupOrEveryOnePerms;
|
|
||||||
public uint EffectiveGroupOrEveryOnePerms
|
public uint EffectiveGroupOrEveryOnePerms
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -345,38 +284,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
// bc this is on heavy duty code paths
|
// bc this is on heavy duty code paths
|
||||||
// but for now we need to test the concept
|
// but for now we need to test the concept
|
||||||
AggregateGroupOrEveryOnePerms();
|
AggregateDeepPerms();
|
||||||
return m_EffectiveGroupOrEveryOnePerms;
|
return m_EffectiveEveryOnePerms | m_EffectiveGroupPerms;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AggregateGroupOrEveryOnePerms()
|
|
||||||
{
|
|
||||||
lock(PermissionsLock)
|
|
||||||
{
|
|
||||||
// get object everyone permissions
|
|
||||||
uint baseperms = (RootPart.EveryoneMask | RootPart.GroupMask) & (uint)PermissionMask.All;
|
|
||||||
|
|
||||||
if(baseperms == 0)
|
|
||||||
{
|
|
||||||
m_EffectiveGroupOrEveryOnePerms = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint current = baseperms;
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
{
|
|
||||||
SceneObjectPart part = parts[i];
|
|
||||||
part.Inventory.AggregateGroupOrEveryonePerms(ref current);
|
|
||||||
if( current == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// recover modify and move
|
|
||||||
baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
|
|
||||||
current |= baseperms;
|
|
||||||
current &= (uint)PermissionMask.All;
|
|
||||||
m_EffectiveGroupOrEveryOnePerms = current;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,40 +297,111 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
// bc this is on heavy duty code paths
|
// bc this is on heavy duty code paths
|
||||||
// but for now we need to test the concept
|
// but for now we need to test the concept
|
||||||
AggregateOwnerPerms();
|
AggregateDeepPerms();
|
||||||
return m_EffectiveOwnerPerms;
|
return m_EffectiveOwnerPerms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AggregateOwnerPerms()
|
// aggregates perms scanning parts and their contents
|
||||||
|
public void AggregateDeepPerms()
|
||||||
{
|
{
|
||||||
lock(PermissionsLock)
|
lock(PermissionsLock)
|
||||||
{
|
{
|
||||||
// get object everyone permissions
|
// aux
|
||||||
uint baseperms = RootPart.OwnerMask & (uint)PermissionMask.All;
|
const uint allmask = (uint)PermissionMask.AllEffective;
|
||||||
|
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
||||||
|
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
|
||||||
if(baseperms == 0)
|
uint baseOwnerPerms = RootPart.OwnerMask;
|
||||||
{
|
uint owner = baseOwnerPerms;
|
||||||
m_EffectiveOwnerPerms = 0;
|
uint baseGroupPerms = RootPart.GroupMask;
|
||||||
return;
|
uint group = baseGroupPerms;
|
||||||
}
|
uint baseEveryonePerms = RootPart.EveryoneMask;
|
||||||
|
uint everyone = baseEveryonePerms;
|
||||||
|
|
||||||
uint current = baseperms;
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = parts[i];
|
SceneObjectPart part = parts[i];
|
||||||
part.Inventory.AggregateOwnerPerms(ref current);
|
part.AggregateInnerPerms();
|
||||||
if( current == 0)
|
owner &= part.AggregatedInnerOwnerPerms;
|
||||||
break;
|
group &= part.AggregatedInnerGroupPerms;
|
||||||
|
everyone &= part.AggregatedInnerEveryonePerms;
|
||||||
}
|
}
|
||||||
// recover modify and move
|
// recover modify and move
|
||||||
baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
|
baseOwnerPerms &= movemodmask;
|
||||||
current |= baseperms;
|
owner |= baseOwnerPerms;
|
||||||
current &= (uint)PermissionMask.All;
|
if((owner & copytransfermast) == 0)
|
||||||
if((current & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0)
|
owner |= (uint)PermissionMask.Transfer;
|
||||||
current |= (uint)PermissionMask.Transfer;
|
owner &= allmask;
|
||||||
m_EffectiveOwnerPerms = current;
|
m_EffectiveOwnerPerms = owner;
|
||||||
|
|
||||||
|
// recover modify and move
|
||||||
|
baseGroupPerms &= movemodmask;
|
||||||
|
group |= baseGroupPerms;
|
||||||
|
if((group & copytransfermast) == 0)
|
||||||
|
group |= (uint)PermissionMask.Transfer;
|
||||||
|
group &= allmask;
|
||||||
|
m_EffectiveGroupPerms = group;
|
||||||
|
|
||||||
|
// recover move
|
||||||
|
baseEveryonePerms &= (uint)PermissionMask.Move;
|
||||||
|
everyone |= baseEveryonePerms;
|
||||||
|
if((everyone & copytransfermast) == 0) // not much sense but as sl
|
||||||
|
everyone |= (uint)PermissionMask.Transfer;
|
||||||
|
everyone &= allmask;
|
||||||
|
m_EffectiveEveryOnePerms = everyone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// aggregates perms scanning parts, assuming their contents was already aggregated
|
||||||
|
public void AggregatePerms()
|
||||||
|
{
|
||||||
|
lock(PermissionsLock)
|
||||||
|
{
|
||||||
|
// aux
|
||||||
|
const uint allmask = (uint)PermissionMask.AllEffective;
|
||||||
|
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
||||||
|
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
|
||||||
|
uint baseOwnerPerms = RootPart.OwnerMask;
|
||||||
|
uint owner = baseOwnerPerms;
|
||||||
|
uint baseGroupPerms = RootPart.GroupMask;
|
||||||
|
uint group = baseGroupPerms;
|
||||||
|
uint baseEveryonePerms = RootPart.EveryoneMask;
|
||||||
|
uint everyone = baseEveryonePerms;
|
||||||
|
|
||||||
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = parts[i];
|
||||||
|
owner &= part.AggregatedInnerOwnerPerms;
|
||||||
|
group &= part.AggregatedInnerGroupPerms;
|
||||||
|
everyone &= part.AggregatedInnerEveryonePerms;
|
||||||
|
}
|
||||||
|
// recover modify and move
|
||||||
|
baseOwnerPerms &= movemodmask;
|
||||||
|
owner |= baseOwnerPerms;
|
||||||
|
if((owner & copytransfermast) == 0)
|
||||||
|
owner |= (uint)PermissionMask.Transfer;
|
||||||
|
owner &= allmask;
|
||||||
|
m_EffectiveOwnerPerms = owner;
|
||||||
|
|
||||||
|
// recover modify and move
|
||||||
|
baseGroupPerms &= movemodmask;
|
||||||
|
group |= baseGroupPerms;
|
||||||
|
if((group & copytransfermast) == 0)
|
||||||
|
group |= (uint)PermissionMask.Transfer;
|
||||||
|
group &= allmask;
|
||||||
|
m_EffectiveGroupPerms = group;
|
||||||
|
|
||||||
|
// recover move
|
||||||
|
baseEveryonePerms &= (uint)PermissionMask.Move;
|
||||||
|
everyone |= baseEveryonePerms;
|
||||||
|
if((everyone & copytransfermast) == 0) // not much sense but as sl
|
||||||
|
everyone |= (uint)PermissionMask.Transfer;
|
||||||
|
everyone &= allmask;
|
||||||
|
m_EffectiveEveryOnePerms = everyone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2537,6 +2537,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return (uint)Flags | (uint)LocalFlags;
|
return (uint)Flags | (uint)LocalFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some of this lines need be moved to other place later
|
||||||
|
|
||||||
|
// effective permitions considering only this part inventory contents perms
|
||||||
|
public uint AggregatedInnerOwnerPerms {get; private set; }
|
||||||
|
public uint AggregatedInnerGroupPerms {get; private set; }
|
||||||
|
public uint AggregatedInnerEveryonePerms {get; private set; }
|
||||||
|
private object InnerPermsLock = new object();
|
||||||
|
|
||||||
|
public void AggregateInnerPerms()
|
||||||
|
{
|
||||||
|
const uint mask = (uint)PermissionMask.AllEffective;
|
||||||
|
|
||||||
|
uint owner = mask;
|
||||||
|
uint group = mask;
|
||||||
|
uint everyone = mask;
|
||||||
|
|
||||||
|
lock(InnerPermsLock) // do we really need this?
|
||||||
|
{
|
||||||
|
if(Inventory != null)
|
||||||
|
Inventory.AggregateInnerPerms(ref owner, ref group, ref everyone);
|
||||||
|
|
||||||
|
AggregatedInnerOwnerPerms = owner & mask;
|
||||||
|
AggregatedInnerGroupPerms = group & mask;
|
||||||
|
AggregatedInnerEveryonePerms = everyone & mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Vector3 GetGeometricCenter()
|
public Vector3 GetGeometricCenter()
|
||||||
{
|
{
|
||||||
// this is not real geometric center but a average of positions relative to root prim acording to
|
// this is not real geometric center but a average of positions relative to root prim acording to
|
||||||
|
|
|
@ -1317,48 +1317,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reduce to minimal set
|
public void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone)
|
||||||
public void AggregateEveryOnePerms(ref uint current)
|
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
current &= item.EveryonePermissions;
|
owner &= item.CurrentPermissions;
|
||||||
if(current == 0)
|
group &= item.GroupPermissions;
|
||||||
break;
|
everyone &= item.EveryonePermissions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AggregateGroupPerms(ref uint current)
|
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
|
||||||
{
|
|
||||||
current &= item.GroupPermissions;
|
|
||||||
if(current == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AggregateGroupOrEveryonePerms(ref uint current)
|
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
|
||||||
{
|
|
||||||
current &= (item.GroupPermissions | item.EveryonePermissions);
|
|
||||||
if(current == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AggregateOwnerPerms(ref uint current)
|
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
|
||||||
{
|
|
||||||
current &= item.CurrentPermissions;
|
|
||||||
if(current == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public uint MaskEffectivePermissions()
|
public uint MaskEffectivePermissions()
|
||||||
{
|
{
|
||||||
uint mask=0x7fffffff;
|
uint mask=0x7fffffff;
|
||||||
|
|
Loading…
Reference in New Issue