fix owner on user rez from a prim inventory to ground

This commit is contained in:
UbitUmarov
2021-06-27 16:55:36 +01:00
parent 598caf46cc
commit eb441ea4e4
2 changed files with 66 additions and 56 deletions

View File

@@ -2283,7 +2283,7 @@ namespace OpenSim.Region.Framework.Scenes
return; // only Return can be called without a client return; // only Return can be called without a client
// this is not as 0.8x code // this is not as 0.8x code
// 0.8x did refuse all operation is not allowed on all objects // 0.8x did refuse all operation if not allowed on all objects
// this will do it on allowed objects // this will do it on allowed objects
// current viewers only ask if all allowed // current viewers only ask if all allowed
@@ -2626,42 +2626,50 @@ namespace OpenSim.Region.Framework.Scenes
if (fromTaskID == UUID.Zero) if (fromTaskID == UUID.Zero)
{ {
// rez from user inventory
IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null) if (invAccess != null)
invAccess.RezObject( invAccess.RezObject(
remoteClient, itemID, rezGroupID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, remoteClient, itemID, rezGroupID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
RezSelected, RemoveItem, fromTaskID, false); RezSelected, RemoveItem, fromTaskID, false);
return;
} }
else
// rez from a prim inventory
SceneObjectPart part = GetSceneObjectPart(fromTaskID);
if (part == null)
{ {
SceneObjectPart part = GetSceneObjectPart(fromTaskID); m_log.ErrorFormat(
if (part == null) "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object",
{ remoteClient.Name, itemID, fromTaskID);
m_log.ErrorFormat(
"[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object",
remoteClient.Name, itemID, fromTaskID);
return; return;
}
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
if (item == null)
{
m_log.ErrorFormat(
"[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item",
remoteClient.Name, itemID, fromTaskID);
return;
}
byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
Vector3 pos = GetNewRezLocation(
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true, scale, false);
RezObject(part, item, pos, null, Vector3.Zero, 0, false);
} }
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
if (item == null)
{
m_log.ErrorFormat(
"[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item",
remoteClient.Name, itemID, fromTaskID);
return;
}
if(item.InvType != (int)InventoryType.Object)
{
m_log.ErrorFormat(
"[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but item is not a object",
remoteClient.Name, itemID, fromTaskID);
return;
}
byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
Vector3 pos = GetNewRezLocation(
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true, scale, false);
RezObject(part, item, remoteClient.AgentId, rezGroupID, pos, null, Vector3.Zero, 0, false, true, true);
} }
/// <summary> /// <summary>
@@ -2677,6 +2685,14 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>The SceneObjectGroup(s) rezzed, or null if rez was unsuccessful</returns> /// <returns>The SceneObjectGroup(s) rezzed, or null if rez was unsuccessful</returns>
public virtual List<SceneObjectGroup> RezObject(SceneObjectPart sourcePart, TaskInventoryItem item, public virtual List<SceneObjectGroup> RezObject(SceneObjectPart sourcePart, TaskInventoryItem item,
Vector3 pos, Quaternion? rot, Vector3 vel, int param, bool atRoot, bool rezSelected = false) Vector3 pos, Quaternion? rot, Vector3 vel, int param, bool atRoot, bool rezSelected = false)
{
return RezObject(sourcePart, item, item.OwnerID, sourcePart.GroupID,
pos, rot, vel, param, atRoot, rezSelected, false);
}
public virtual List<SceneObjectGroup> RezObject(SceneObjectPart sourcePart, TaskInventoryItem item,
UUID newowner, UUID newgroup,
Vector3 pos, Quaternion? rot, Vector3 vel, int param, bool atRoot, bool rezSelected, bool humanRez)
{ {
if (null == item) if (null == item)
return null; return null;
@@ -2686,7 +2702,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 bbox; Vector3 bbox;
float offsetHeight; float offsetHeight;
bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist,out bbox, out offsetHeight); bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, newowner, newgroup, out objlist, out veclist,out bbox, out offsetHeight);
if (!success) if (!success)
return null; return null;
@@ -2695,7 +2711,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectGroup group in objlist) foreach (SceneObjectGroup group in objlist)
totalPrims += group.PrimCount; totalPrims += group.PrimCount;
if (!Permissions.CanRezObject(totalPrims, item.OwnerID, pos)) if (!Permissions.CanRezObject(totalPrims, newowner, pos))
return null; return null;
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
@@ -2759,6 +2775,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
UUID rezzerID;
if(humanRez)
rezzerID = newowner;
else
rezzerID = sourcePart.UUID;
for (int i = 0; i < objlist.Count; i++) for (int i = 0; i < objlist.Count; i++)
{ {
SceneObjectGroup group = objlist[i]; SceneObjectGroup group = objlist[i];
@@ -2774,7 +2796,7 @@ namespace OpenSim.Region.Framework.Scenes
group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
} }
group.RezzerID = sourcePart.UUID; group.RezzerID = rezzerID;
if (rezSelected) if (rezSelected)
{ {

View File

@@ -1115,6 +1115,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, out Vector3 bbox, out float offsetHeight) public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, out Vector3 bbox, out float offsetHeight)
{
return GetRezReadySceneObjects(item, item.OwnerID, m_part.GroupID, out objlist, out veclist, out bbox, out offsetHeight);
}
public bool GetRezReadySceneObjects(TaskInventoryItem item, UUID NewOwner, UUID NewGroup, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, out Vector3 bbox, out float offsetHeight)
{ {
AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
@@ -1130,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
for (int i = 0; i < objlist.Count; i++) for (int i = 0; i < objlist.Count; i++)
{ {
@@ -1155,29 +1160,12 @@ namespace OpenSim.Region.Framework.Scenes
rootPart.Name = item.Name; rootPart.Name = item.Name;
rootPart.Description = item.Description; rootPart.Description = item.Description;
} }
/* reverted to old code till part.ApplyPermissionsOnRez is better reviewed/fixed
group.SetGroup(m_part.GroupID, null);
foreach (SceneObjectPart part in group.Parts) group.SetGroup(NewGroup, null);
{
// Convert between InventoryItem classes. You can never have too many similar but slightly different classes :)
InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID);
dest.BasePermissions = item.BasePermissions;
dest.CurrentPermissions = item.CurrentPermissions;
dest.EveryOnePermissions = item.EveryonePermissions;
dest.GroupPermissions = item.GroupPermissions;
dest.NextPermissions = item.NextPermissions;
dest.Flags = item.Flags;
part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene);
}
*/
// old code start
SceneObjectPart[] partList = group.Parts; SceneObjectPart[] partList = group.Parts;
group.SetGroup(m_part.GroupID, null); bool slamThings = (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0;
if ((rootPart.OwnerID != NewOwner) || slamThings)
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
{ {
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
{ {
@@ -1197,12 +1185,12 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in partList) foreach (SceneObjectPart part in partList)
{ {
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) if ((part.OwnerID != NewOwner))
{ {
if(part.GroupID != part.OwnerID) if(part.GroupID != part.OwnerID)
part.LastOwnerID = part.OwnerID; part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID; part.OwnerID = NewOwner;
part.Inventory.ChangeInventoryOwner(item.OwnerID); part.Inventory.ChangeInventoryOwner(NewOwner);
} }
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
@@ -1212,7 +1200,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
part.GroupMask = item.GroupPermissions; part.GroupMask = item.GroupPermissions;
} }
// old code end
rootPart.TrimPermissions(); rootPart.TrimPermissions();
group.InvalidateDeepEffectivePerms(); group.InvalidateDeepEffectivePerms();
} }