Add the return object permissions fix
parent
c4e4cd5931
commit
5f4dc6fe61
|
@ -856,7 +856,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
}
|
||||
|
||||
foreach (List<SceneObjectGroup> ol in returns.Values)
|
||||
m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
|
||||
{
|
||||
if (m_scene.Permissions.CanUseObjectReturn(this, type, remote_client, ol))
|
||||
m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -168,6 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED
|
||||
|
||||
m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
|
||||
m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED
|
||||
|
||||
m_scene.AddCommand(this, "bypass permissions",
|
||||
"bypass permissions <true / false>",
|
||||
|
@ -1523,5 +1524,65 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
// You can reset the scripts in any object you can edit
|
||||
return GenericObjectPermission(agentID, prim, false);
|
||||
}
|
||||
|
||||
private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
long powers = 0;
|
||||
if (parcel.landData.GroupID != UUID.Zero)
|
||||
client.GetGroupPowers(parcel.landData.GroupID);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case (uint)ObjectReturnType.Owner:
|
||||
// Don't let group members return owner's objects, ever
|
||||
//
|
||||
if (parcel.landData.IsGroupOwned)
|
||||
{
|
||||
if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parcel.landData.OwnerID != client.AgentId)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case (uint)ObjectReturnType.Group:
|
||||
if (parcel.landData.OwnerID != client.AgentId)
|
||||
{
|
||||
// If permissionis granted through a group...
|
||||
//
|
||||
if ((powers & (long)GroupPowers.ReturnGroupSet) != 0)
|
||||
{
|
||||
foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist))
|
||||
{
|
||||
// check for and remove group owned objects unless
|
||||
// the user also has permissions to return those
|
||||
//
|
||||
if (g.OwnerID == g.GroupID &&
|
||||
((powers & (long)GroupPowers.ReturnGroupOwned) == 0))
|
||||
{
|
||||
retlist.Remove(g);
|
||||
}
|
||||
}
|
||||
// And allow the operation
|
||||
//
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (uint)ObjectReturnType.Other:
|
||||
if ((powers & (long)GroupPowers.ReturnNonGroup) != 0)
|
||||
return true;
|
||||
break;
|
||||
case (uint)ObjectReturnType.List:
|
||||
break;
|
||||
}
|
||||
|
||||
return GenericParcelPermission(client.AgentId, parcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool TeleportHandler(UUID userID, Scene scene);
|
||||
public delegate bool UseObjectReturnHandler(ILandObject landData, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene);
|
||||
#endregion
|
||||
|
||||
public class ScenePermissions
|
||||
|
@ -135,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event CopyUserInventoryHandler OnCopyUserInventory;
|
||||
public event DeleteUserInventoryHandler OnDeleteUserInventory;
|
||||
public event TeleportHandler OnTeleport;
|
||||
public event UseObjectReturnHandler OnUseObjectReturn;
|
||||
#endregion
|
||||
|
||||
#region Object Permission Checks
|
||||
|
@ -910,5 +912,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanUseObjectReturn(ILandObject landData, uint type , IClientAPI client, List<SceneObjectGroup> retlist)
|
||||
{
|
||||
UseObjectReturnHandler handler = OnUseObjectReturn;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (UseObjectReturnHandler h in list)
|
||||
{
|
||||
if (h(landData, type, client, retlist, m_scene) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue