rename sog.GetEffectivePermissions() since its use is now limited to more specific task, and no longer on current effective(full) path. Note that change ownermask start to be current ownermask, and filter it to all parts basemask

httptests
UbitUmarov 2017-05-01 14:18:59 +01:00
parent 2dbf96593c
commit 60dc124872
3 changed files with 13 additions and 25 deletions

View File

@ -579,26 +579,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
IClientAPI remoteClient) IClientAPI remoteClient)
{ {
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export | PermissionMask.FoldedMask); 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
// are modify. This allows renaming an object that contains no
// mod items.
foreach (SceneObjectGroup grp in objsForEffectivePermissions) foreach (SceneObjectGroup grp in objsForEffectivePermissions)
{ {
uint groupPerms = grp.GetEffectivePermissions(true); effectivePerms &= grp.CurrentAndFoldedNextPermissions();
// if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0)
// groupPerms |= (uint)PermissionMask.Modify;
effectivePerms &= groupPerms;
} }
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
{ {
// apply parts inventory items next owner
PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms); PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms);
// change to next owner
uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; uint basePerms = effectivePerms & so.RootPart.NextOwnerMask;
// fix and update folded
// rebuild folded perms since we don't have then on inworld objects
basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms); basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms);
item.BasePermissions = basePerms; item.BasePermissions = basePerms;

View File

@ -206,12 +206,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = categoryID; item.Folder = categoryID;
perms = group.GetEffectivePermissions(false); perms = group.CurrentAndFoldedNextPermissions();
// apply parts inventory next perms
PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms); PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms);
// change to next owner perms
perms &= part.NextOwnerMask; perms &= part.NextOwnerMask;
// update folded
perms = PermissionsUtil.FixAndFoldPermissions(perms); perms = PermissionsUtil.FixAndFoldPermissions(perms);
item.BasePermissions = perms; item.BasePermissions = perms;

View File

@ -484,7 +484,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public uint GetEffectivePermissions(bool useBase) public uint CurrentAndFoldedNextPermissions()
{ {
uint perms=(uint)(PermissionMask.Modify | uint perms=(uint)(PermissionMask.Modify |
PermissionMask.Copy | PermissionMask.Copy |
@ -492,18 +492,13 @@ namespace OpenSim.Region.Framework.Scenes
PermissionMask.Transfer | PermissionMask.Transfer |
PermissionMask.FoldedMask); PermissionMask.FoldedMask);
uint ownerMask = 0x7fffffff; uint ownerMask = RootPart.OwnerMask;
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];
ownerMask &= part.BaseMask;
if (useBase)
ownerMask &= part.BaseMask;
else
ownerMask &= part.OwnerMask;
perms &= part.Inventory.MaskEffectivePermissions(); perms &= part.Inventory.MaskEffectivePermissions();
} }