Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

httptests
Diva Canto 2017-05-01 10:09:54 -07:00
commit 8e88a9d702
3 changed files with 28 additions and 40 deletions

View File

@ -580,25 +580,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
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

@ -118,6 +118,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
return false; return false;
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
if(group == null || group.IsDeleted || group.inTransit)
return false;
// make sure we are not buying a child part
part = group.RootPart;
switch (saleType) switch (saleType)
{ {
@ -157,18 +162,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
break; break;
case 2: // Sell a copy case 2: // Sell a copy
Vector3 inventoryStoredPosition = new Vector3(
Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6),
Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6),
group.AbsolutePosition.Z);
Vector3 originalPosition = group.AbsolutePosition;
group.AbsolutePosition = inventoryStoredPosition;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
group.AbsolutePosition = originalPosition;
uint perms = group.EffectiveOwnerPerms; uint perms = group.EffectiveOwnerPerms;
if ((perms & (uint)PermissionMask.Transfer) == 0) if ((perms & (uint)PermissionMask.Transfer) == 0)
@ -185,6 +178,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
return false; return false;
} }
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
AssetBase asset = m_scene.CreateAsset( AssetBase asset = m_scene.CreateAsset(
group.GetPartName(localID), group.GetPartName(localID),
group.GetPartDescription(localID), group.GetPartDescription(localID),
@ -206,12 +201,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

@ -338,6 +338,8 @@ namespace OpenSim.Region.Framework.Scenes
uint rootEveryonePerms = RootPart.EveryoneMask; uint rootEveryonePerms = RootPart.EveryoneMask;
uint everyone = rootEveryonePerms; uint everyone = rootEveryonePerms;
// date is time of writing april 30th 2017
bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
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++)
{ {
@ -345,6 +347,7 @@ namespace OpenSim.Region.Framework.Scenes
part.AggregateInnerPerms(); part.AggregateInnerPerms();
owner &= part.AggregatedInnerOwnerPerms; owner &= part.AggregatedInnerOwnerPerms;
group &= part.AggregatedInnerGroupPerms; group &= part.AggregatedInnerGroupPerms;
if(newObject)
everyone &= part.AggregatedInnerEveryonePerms; everyone &= part.AggregatedInnerEveryonePerms;
} }
// recover modify and move // recover modify and move
@ -407,13 +410,15 @@ namespace OpenSim.Region.Framework.Scenes
uint everyone = rootEveryonePerms; uint everyone = rootEveryonePerms;
bool needUpdate = false; bool needUpdate = false;
// date is time of writing april 30th 2017
bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
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];
owner &= part.AggregatedInnerOwnerPerms; owner &= part.AggregatedInnerOwnerPerms;
group &= part.AggregatedInnerGroupPerms; group &= part.AggregatedInnerGroupPerms;
if(newObject)
everyone &= part.AggregatedInnerEveryonePerms; everyone &= part.AggregatedInnerEveryonePerms;
} }
// recover modify and move // recover modify and move
@ -479,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 |
@ -487,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];
if (useBase)
ownerMask &= part.BaseMask; ownerMask &= part.BaseMask;
else
ownerMask &= part.OwnerMask;
perms &= part.Inventory.MaskEffectivePermissions(); perms &= part.Inventory.MaskEffectivePermissions();
} }