Add a new permissions check for bulk object returns.

0.6.6-post-fixes
Melanie Thielker 2009-05-24 16:11:35 +00:00
parent 006c2c2e8f
commit f3f7d60367
3 changed files with 29 additions and 0 deletions

View File

@ -795,6 +795,9 @@ namespace OpenSim.Region.CoreModules.World.Land
Dictionary<UUID,List<SceneObjectGroup>> returns =
new Dictionary<UUID,List<SceneObjectGroup>>();
if (!m_scene.Permissions.CanUseObjectReturn(this, type, remote_client))
return;
lock (primsOverMe)
{
if (type == (uint)ObjectReturnType.Owner)

View File

@ -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,13 @@ 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, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericParcelPermission(client.AgentId, parcel);
}
}
}

View File

@ -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, 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)
{
UseObjectReturnHandler handler = OnUseObjectReturn;
if (handler != null)
{
Delegate[] list = handler.GetInvocationList();
foreach (UseObjectReturnHandler h in list)
{
if (h(landData, type, client, m_scene) == false)
return false;
}
}
return true;
}
}
}