* Patch for #973 - Object Rez from Inventory ignores permissions - Thanks tglion!
parent
3370d581e1
commit
e456cb7533
|
@ -159,6 +159,44 @@ namespace OpenSim.Region.Environment
|
|||
return permission;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Permissions check - can user enter an object?
|
||||
/// </summary>
|
||||
/// <param name="user">User attempting move an object</param>
|
||||
/// <param name="oldPos">Source object-position</param>
|
||||
/// <param name="newPos">Target object-position</param>
|
||||
/// <returns>Has permission?</returns>
|
||||
public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
|
||||
{
|
||||
ILandObject land1 = m_scene.LandChannel.getLandObject(oldPos.X, oldPos.Y);
|
||||
ILandObject land2 = m_scene.LandChannel.getLandObject(newPos.X, newPos.Y);
|
||||
if (land1 == null || land2 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (land1.landData.globalID == land2.landData.globalID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((land2.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO: check for group rights
|
||||
|
||||
if (GenericParcelPermission(user, newPos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SendPermissionError(user, "Not allowed to move objects in this parcel!");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#region Object Permissions
|
||||
|
||||
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
|
||||
|
|
|
@ -981,6 +981,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||
if (group != null)
|
||||
{
|
||||
LLVector3 oldPos = group.AbsolutePosition;
|
||||
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos))
|
||||
{
|
||||
group.SendGroupTerseUpdate();
|
||||
return;
|
||||
}
|
||||
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
|
||||
{
|
||||
group.UpdateSinglePosition(pos, localID);
|
||||
|
@ -999,6 +1005,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||
if (group != null)
|
||||
{
|
||||
LLVector3 oldPos = group.AbsolutePosition;
|
||||
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos))
|
||||
{
|
||||
group.SendGroupTerseUpdate();
|
||||
return;
|
||||
}
|
||||
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
|
||||
{
|
||||
group.UpdateGroupPosition(pos);
|
||||
|
|
|
@ -855,9 +855,23 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
if (selectedEnt != null)
|
||||
{
|
||||
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
|
||||
bool permission;
|
||||
if (DeRezPacket.AgentBlock.Destination == 1)
|
||||
{ // Take Copy
|
||||
permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
|
||||
((SceneObjectGroup) selectedEnt).UUID);
|
||||
}
|
||||
else
|
||||
{ // Take
|
||||
permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId,
|
||||
((SceneObjectGroup) selectedEnt).UUID);
|
||||
}
|
||||
|
||||
if (permission)
|
||||
{
|
||||
string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
|
||||
SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt;
|
||||
string sceneObjectXml = objectGroup.ToXmlString();
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
|
@ -871,8 +885,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
AssetCache.AddAsset(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Creator = objectGroup.RootPart.CreatorID;
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.Creator = remoteClient.AgentId;
|
||||
item.ID = LLUUID.Random();
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
|
@ -880,12 +894,18 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
item.AssetType = asset.Type;
|
||||
item.InvType = asset.InvType;
|
||||
item.Folder = DeRezPacket.AgentBlock.DestinationID;
|
||||
item.CurrentPermissions = 2147483647;
|
||||
item.NextPermissions = 2147483647;
|
||||
item.EveryOnePermissions =
|
||||
((SceneObjectGroup) selectedEnt).RootPart.EveryoneMask;
|
||||
item.BasePermissions = ((SceneObjectGroup) selectedEnt).RootPart.BaseMask;
|
||||
item.CurrentPermissions = ((SceneObjectGroup) selectedEnt).RootPart.OwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) {
|
||||
item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BasePermissions = objectGroup.RootPart.BaseMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.OwnerMask;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
}
|
||||
|
||||
userInfo.AddItem(remoteClient.AgentId, item);
|
||||
remoteClient.SendInventoryItemCreateUpdate(item);
|
||||
|
@ -894,7 +914,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy
|
||||
if (DeRezPacket.AgentBlock.Destination != 1)
|
||||
{
|
||||
DeleteSceneObjectGroup((SceneObjectGroup) selectedEnt);
|
||||
DeleteSceneObjectGroup(objectGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -941,6 +961,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
|
||||
BypassRayCast, bRayEndIsIntersection);
|
||||
|
||||
if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Rez object
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
|
@ -967,6 +992,21 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
rootPart.Name = item.Name;
|
||||
rootPart.Description = item.Description;
|
||||
|
||||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if (part.OwnerID != item.Owner)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.Owner;
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.BaseMask = item.BasePermissions;
|
||||
part.OwnerMask = item.CurrentPermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
part.ChangeInventoryOwner(item.Owner);
|
||||
}
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
group.ApplyPhysics(m_physicalPrim);
|
||||
group.StartScripts();
|
||||
|
|
|
@ -115,6 +115,31 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void ChangeInventoryOwner(LLUUID ownerId)
|
||||
{
|
||||
lock (TaskInventory)
|
||||
{
|
||||
if (0 == TaskInventory.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HasInventoryChanged = true;
|
||||
|
||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values);
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
if (ownerId != item.OwnerID)
|
||||
{
|
||||
item.LastOwnerID = item.OwnerID;
|
||||
item.OwnerID = ownerId;
|
||||
item.BaseMask = item.NextOwnerMask & (uint)PermissionMask.All;
|
||||
item.OwnerMask = item.NextOwnerMask & (uint)PermissionMask.All;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start all the scripts contained in this prim's inventory
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue