Permissions modules where made NONShared modules. Make them so, removing incoerences and their potencial bugs

httptests
UbitUmarov 2017-01-27 12:32:01 +00:00
parent cdc23bab74
commit 56e3aaefde
4 changed files with 193 additions and 121 deletions

View File

@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
if (part.OwnerID == part.GroupID) // Group owned
{
// Does the user have the power to put the object on sale?
if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID, m_scene))
if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID))
{
client.SendAgentAlertMessage("You don't have permission to set group-owned objects on sale", false);
return;

View File

@ -349,7 +349,77 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (!m_Enabled)
return;
if(scene != m_scene)
return;
m_scene.UnregisterModuleInterface<IPermissionsModule>(this);
scenePermissions.OnBypassPermissions -= BypassPermissions;
scenePermissions.OnSetBypassPermissions -= SetBypassPermissions;
scenePermissions.OnPropagatePermissions -= PropagatePermissions;
scenePermissions.OnIsGridGod -= IsGridAdministrator;
scenePermissions.OnIsAdministrator -= IsAdministrator;
scenePermissions.OnIsEstateManager -= IsEstateManager;
scenePermissions.OnGenerateClientFlags -= GenerateClientFlags;
scenePermissions.OnIssueEstateCommand -= CanIssueEstateCommand;
scenePermissions.OnRunConsoleCommand -= CanRunConsoleCommand;
scenePermissions.OnTeleport -= CanTeleport;
scenePermissions.OnInstantMessage -= CanInstantMessage;
scenePermissions.OnAbandonParcel -= CanAbandonParcel;
scenePermissions.OnReclaimParcel -= CanReclaimParcel;
scenePermissions.OnDeedParcel -= CanDeedParcel;
scenePermissions.OnSellParcel -= CanSellParcel;
scenePermissions.OnEditParcelProperties -= CanEditParcelProperties;
scenePermissions.OnTerraformLand -= CanTerraformLand;
scenePermissions.OnBuyLand -= CanBuyLand;
scenePermissions.OnRezObject -= CanRezObject;
scenePermissions.OnObjectEntry -= CanObjectEntry;
scenePermissions.OnReturnObjects -= CanReturnObjects;
scenePermissions.OnDuplicateObject -= CanDuplicateObject;
scenePermissions.OnDeleteObjectByIDs -= CanDeleteObjectByIDs;
scenePermissions.OnDeleteObject -= CanDeleteObject;
scenePermissions.OnEditObjectByIDs -= CanEditObjectByIDs;
scenePermissions.OnEditObject -= CanEditObject;
scenePermissions.OnInventoryTransfer -= CanInventoryTransfer;
scenePermissions.OnMoveObject -= CanMoveObject;
scenePermissions.OnTakeObject -= CanTakeObject;
scenePermissions.OnTakeCopyObject -= CanTakeCopyObject;
scenePermissions.OnLinkObject -= CanLinkObject;
scenePermissions.OnDelinkObject -= CanDelinkObject;
scenePermissions.OnDeedObject -= CanDeedObject;
scenePermissions.OnSellGroupObject -= CanSellGroupObject;
scenePermissions.OnCreateObjectInventory -= CanCreateObjectInventory;
scenePermissions.OnEditObjectInventory -= CanEditObjectInventory;
scenePermissions.OnCopyObjectInventory -= CanCopyObjectInventory;
scenePermissions.OnDeleteObjectInventory -= CanDeleteObjectInventory;
scenePermissions.OnDoObjectInvToObjectInv -= CanDoObjectInvToObjectInv;
scenePermissions.OnDropInObjectInv -= CanDropInObjectInv;
scenePermissions.OnViewNotecard -= CanViewNotecard;
scenePermissions.OnViewScript -= CanViewScript;
scenePermissions.OnEditNotecard -= CanEditNotecard;
scenePermissions.OnEditScript -= CanEditScript;
scenePermissions.OnResetScript -= CanResetScript;
scenePermissions.OnRunScript -= CanRunScript;
scenePermissions.OnCompileScript -= CanCompileScript;
scenePermissions.OnCreateUserInventory -= CanCreateUserInventory;
scenePermissions.OnCopyUserInventory -= CanCopyUserInventory;
scenePermissions.OnEditUserInventory -= CanEditUserInventory;
scenePermissions.OnDeleteUserInventory -= CanDeleteUserInventory;
scenePermissions.OnControlPrimMedia -= CanControlPrimMedia;
scenePermissions.OnInteractWithPrimMedia -= CanInteractWithPrimMedia;
}
public void Close()
@ -1099,7 +1169,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#endregion
#region Permission Checks
private bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
private bool CanAbandonParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1107,7 +1177,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandRelease, false);
}
private bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
private bool CanReclaimParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1115,7 +1185,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericParcelOwnerPermission(user, parcel, 0,true);
}
private bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
private bool CanDeedParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1129,7 +1199,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (parcel.LandData.OwnerID != user) // Only the owner can deed!
return false;
ScenePresence sp = scene.GetScenePresence(user);
ScenePresence sp = m_scene.GetScenePresence(user);
if(sp == null)
return false;
@ -1179,7 +1249,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1195,7 +1265,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
//If they can rez, they can duplicate
return CanRezObject(0, sp.UUID, sog.AbsolutePosition, scene);
return CanRezObject(0, sp.UUID, sog.AbsolutePosition);
}
private bool CanDeleteObject(SceneObjectGroup sog, ScenePresence sp)
@ -1240,14 +1310,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
private bool CanDeleteObjectByIDs(UUID objectID, UUID userID, Scene scene)
private bool CanDeleteObjectByIDs(UUID objectID, UUID userID)
{
// ignoring locked. viewers should warn and ask for confirmation
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
if (sog == null)
return false;
@ -1282,12 +1352,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene)
private bool CanEditObjectByIDs(UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
if (sog == null)
return false;
@ -1311,12 +1381,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanEditObjectInventory(UUID objectID, UUID userID, Scene scene)
private bool CanEditObjectInventory(UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
if (sog == null)
return false;
@ -1326,7 +1396,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanEditParcelProperties(UUID userID, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
private bool CanEditParcelProperties(UUID userID, ILandObject parcel, GroupPowers p, bool allowManager)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1342,7 +1412,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// <param name="user"></param>
/// <param name="scene"></param>
/// <returns></returns>
private bool CanEditScript(UUID script, UUID objectID, UUID userID, Scene scene)
private bool CanEditScript(UUID script, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1353,7 +1423,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// Ordinarily, if you can view it, you can edit it
// There is no viewing a no mod script
//
return CanViewScript(script, objectID, userID, scene);
return CanViewScript(script, objectID, userID);
}
/// <summary>
@ -1364,7 +1434,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// <param name="user"></param>
/// <param name="scene"></param>
/// <returns></returns>
private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1395,7 +1465,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
SceneObjectPart part = scene.GetSceneObjectPart(objectID);
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return false;
@ -1442,21 +1512,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanInstantMessage(UUID user, UUID target, Scene startScene)
private bool CanInstantMessage(UUID user, UUID target)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
// If the sender is an object, check owner instead
//
SceneObjectPart part = startScene.GetSceneObjectPart(user);
SceneObjectPart part = m_scene.GetSceneObjectPart(user);
if (part != null)
user = part.OwnerID;
return GenericCommunicationPermission(user, target);
}
private bool CanInventoryTransfer(UUID user, UUID target, Scene startScene)
private bool CanInventoryTransfer(UUID user, UUID target)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1464,7 +1534,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericCommunicationPermission(user, target);
}
private bool CanIssueEstateCommand(UUID user, Scene requestFromScene, bool ownerCommand)
private bool CanIssueEstateCommand(UUID user, bool ownerCommand)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1498,7 +1568,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene)
private bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@ -1506,8 +1576,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
float newY = newPoint.Y;
// allow outside region this is needed for crossings
if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
if (newX < -1f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) ||
newY < -1f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
if(sog == null || sog.IsDeleted)
@ -1516,7 +1586,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_bypassPermissions)
return m_bypassPermissionsValue;
ILandObject parcel = scene.LandChannel.GetLandObject(newX, newY);
ILandObject parcel = m_scene.LandChannel.GetLandObject(newX, newY);
if (parcel == null)
return false;
@ -1554,12 +1624,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene)
private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
ScenePresence sp = scene.GetScenePresence(user);
ScenePresence sp = m_scene.GetScenePresence(user);
if (sp == null)
return false;
@ -1591,7 +1661,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
else
{
Vector3 pos = g.AbsolutePosition;
l = scene.LandChannel.GetLandObject(pos.X, pos.Y);
l = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
}
// If it's not over any land, then we can't do a thing
@ -1662,7 +1732,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanRezObject(int objectCount, UUID userID, Vector3 objectPosition, Scene scene)
private bool CanRezObject(int objectCount, UUID userID, Vector3 objectPosition)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions)
@ -1670,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
ILandObject parcel = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
if (parcel == null || parcel.LandData == null)
return false;
@ -1696,7 +1766,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
private bool CanRunConsoleCommand(UUID user, Scene requestFromScene)
private bool CanRunConsoleCommand(UUID user)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1741,7 +1811,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericEstatePermission(part.OwnerID);
}
private bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
private bool CanSellParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1749,7 +1819,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale, true);
}
private bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
private bool CanSellGroupObject(UUID userID, UUID groupID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1823,7 +1893,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanTerraformLand(UUID userID, Vector3 position, Scene requestFromScene)
private bool CanTerraformLand(UUID userID, Vector3 position)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1873,7 +1943,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// <param name="user"></param>
/// <param name="scene"></param>
/// <returns></returns>
private bool CanViewScript(UUID script, UUID objectID, UUID userID, Scene scene)
private bool CanViewScript(UUID script, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1915,7 +1985,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
SceneObjectPart part = scene.GetSceneObjectPart(objectID);
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return false;
@ -1962,7 +2032,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// <param name="user"></param>
/// <param name="scene"></param>
/// <returns></returns>
private bool CanViewNotecard(UUID notecard, UUID objectID, UUID userID, Scene scene)
private bool CanViewNotecard(UUID notecard, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -1988,7 +2058,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
SceneObjectPart part = scene.GetSceneObjectPart(objectID);
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return false;
@ -2051,7 +2121,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene)
private bool CanBuyLand(UUID userID, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -2319,7 +2389,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanResetScript(UUID primID, UUID script, UUID agentID, Scene scene)
private bool CanResetScript(UUID primID, UUID script, UUID agentID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@ -2334,7 +2404,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene)
private bool CanCompileScript(UUID ownerUUID, int scriptType)
{
//m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
switch (scriptType) {

View File

@ -41,47 +41,47 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void SetBypassPermissionsHandler(bool value);
public delegate bool BypassPermissionsHandler();
public delegate bool PropagatePermissionsHandler();
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter, Scene scene);
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition);
public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter);
public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient);
public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp, Scene scenen);
public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene);
public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene);
public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene);
public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene);
public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user, Scene scene);
public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects);
public delegate bool InstantMessageHandler(UUID user, UUID target);
public delegate bool InventoryTransferHandler(UUID user, UUID target);
public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user);
public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user);
public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user);
public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user);
public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene);
public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType);
public delegate bool StartScriptHandler(UUID script, UUID user);
public delegate bool StopScriptHandler(UUID script, UUID user);
public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user);
public delegate bool TerraformLandHandler(UUID user, Vector3 position);
public delegate bool RunConsoleCommandHandler(UUID user);
public delegate bool IssueEstateCommandHandler(UUID user, bool ownerCommand);
public delegate bool IsGodHandler(UUID user);
public delegate bool IsGridGodHandler(UUID user);
public delegate bool IsAdministratorHandler(UUID user);
public delegate bool IsEstateManagerHandler(UUID user);
public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager);
public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool EditParcelHandler(UUID user, ILandObject parcel);
public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, bool allowManager);
public delegate bool SellParcelHandler(UUID user, ILandObject parcel);
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel);
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel);
public delegate bool DeedParcelHandler(UUID user, ILandObject parcel);
public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool BuyLandHandler(UUID user, ILandObject parcel);
public delegate bool LinkObjectHandler(UUID user, UUID objectID);
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
@ -254,7 +254,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (RezObjectHandler h in list)
{
if (h(objectCount, owner,objectPosition, m_scene) == false)
if (h(objectCount, owner,objectPosition) == false)
return false;
}
}
@ -274,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (DeleteObjectHandlerByIDs h in list)
{
if (h(objectID, deleter, m_scene) == false)
if (h(objectID, deleter) == false)
{
result = false;
break;
@ -321,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (TransferObjectHandler h in list)
{
if (h(objectID, recipient, m_scene) == false)
if (h(objectID, recipient) == false)
{
result = false;
break;
@ -366,7 +366,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region SELL GROUP OBJECT
public bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
public bool CanSellGroupObject(UUID userID, UUID groupID)
{
bool result = true;
@ -376,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (SellGroupObjectHandler h in list)
{
if (h(userID, groupID, scene) == false)
if (h(userID, groupID) == false)
{
result = false;
break;
@ -438,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (DuplicateObjectHandler h in list)
{
if (h(sog, sp, m_scene) == false)
if (h(sog, sp) == false)
return false;
}
}
@ -470,7 +470,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditObjectByIDsHandler h in list)
{
if (h(objectID, editorID, m_scene) == false)
if (h(objectID, editorID) == false)
return false;
}
}
@ -505,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditObjectInventoryHandler h in list)
{
if (h(objectID, editorID, m_scene) == false)
if (h(objectID, editorID) == false)
return false;
}
}
@ -546,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ObjectEntryHandler h in list)
{
if (h(sog, enteringRegion, newPoint, m_scene) == false)
if (h(sog, enteringRegion, newPoint) == false)
return false;
}
}
@ -566,7 +566,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ReturnObjectsHandler h in list)
{
if (h(land, user, objects, m_scene) == false)
if (h(land, user, objects) == false)
{
result = false;
break;
@ -592,7 +592,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (InstantMessageHandler h in list)
{
if (h(user, target, m_scene) == false)
if (h(user, target) == false)
return false;
}
}
@ -610,7 +610,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (InventoryTransferHandler h in list)
{
if (h(user, target, m_scene) == false)
if (h(user, target) == false)
return false;
}
}
@ -628,7 +628,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ViewScriptHandler h in list)
{
if (h(script, objectID, user, m_scene) == false)
if (h(script, objectID, user) == false)
return false;
}
}
@ -643,7 +643,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ViewNotecardHandler h in list)
{
if (h(script, objectID, user, m_scene) == false)
if (h(script, objectID, user) == false)
return false;
}
}
@ -661,7 +661,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditScriptHandler h in list)
{
if (h(script, objectID, user, m_scene) == false)
if (h(script, objectID, user) == false)
return false;
}
}
@ -676,7 +676,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditNotecardHandler h in list)
{
if (h(script, objectID, user, m_scene) == false)
if (h(script, objectID, user) == false)
return false;
}
}
@ -694,7 +694,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (RunScriptHandlerByIDs h in list)
{
if (h(script, objectID, user, m_scene) == false)
if (h(script, objectID, user) == false)
return false;
}
}
@ -730,7 +730,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (CompileScriptHandler h in list)
{
if (h(ownerUUID, scriptType, m_scene) == false)
if (h(ownerUUID, scriptType) == false)
return false;
}
}
@ -748,7 +748,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (StartScriptHandler h in list)
{
if (h(script, user, m_scene) == false)
if (h(script, user) == false)
return false;
}
}
@ -766,7 +766,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (StopScriptHandler h in list)
{
if (h(script, user, m_scene) == false)
if (h(script, user) == false)
return false;
}
}
@ -784,7 +784,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ResetScriptHandler h in list)
{
if (h(prim, script, user, m_scene) == false)
if (h(prim, script, user) == false)
return false;
}
}
@ -802,7 +802,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (TerraformLandHandler h in list)
{
if (h(user, pos, m_scene) == false)
if (h(user, pos) == false)
return false;
}
}
@ -820,7 +820,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (RunConsoleCommandHandler h in list)
{
if (h(user, m_scene) == false)
if (h(user) == false)
return false;
}
}
@ -838,7 +838,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (IssueEstateCommandHandler h in list)
{
if (h(user, m_scene, ownerCommand) == false)
if (h(user, ownerCommand) == false)
return false;
}
}
@ -918,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditParcelPropertiesHandler h in list)
{
if (h(user, parcel, p, m_scene, allowManager) == false)
if (h(user, parcel, p, allowManager) == false)
return false;
}
}
@ -935,7 +935,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (SellParcelHandler h in list)
{
if (h(user, parcel, m_scene) == false)
if (h(user, parcel) == false)
return false;
}
}
@ -952,7 +952,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (AbandonParcelHandler h in list)
{
if (h(user, parcel, m_scene) == false)
if (h(user, parcel) == false)
return false;
}
}
@ -968,7 +968,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ReclaimParcelHandler h in list)
{
if (h(user, parcel, m_scene) == false)
if (h(user, parcel) == false)
return false;
}
}
@ -983,7 +983,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (DeedParcelHandler h in list)
{
if (h(user, parcel, m_scene) == false)
if (h(user, parcel) == false)
return false;
}
}
@ -1018,7 +1018,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (BuyLandHandler h in list)
{
if (h(user, parcel, m_scene) == false)
if (h(user, parcel) == false)
return false;
}
}

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.OptionalModules
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_enabled;
private Scene m_scene;
public string Name { get { return "PrimLimitsModule"; } }
public Type ReplaceableInterface { get { return null; } }
@ -80,6 +81,7 @@ namespace OpenSim.Region.OptionalModules
{
return;
}
m_scene = scene;
scene.Permissions.OnRezObject += CanRezObject;
scene.Permissions.OnObjectEntry += CanObjectEnter;
scene.Permissions.OnDuplicateObject += CanDuplicateObject;
@ -94,9 +96,9 @@ namespace OpenSim.Region.OptionalModules
return;
}
scene.Permissions.OnRezObject -= CanRezObject;
scene.Permissions.OnObjectEntry -= CanObjectEnter;
scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
m_scene.Permissions.OnRezObject -= CanRezObject;
m_scene.Permissions.OnObjectEntry -= CanObjectEnter;
m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
}
public void RegionLoaded(Scene scene)
@ -104,12 +106,12 @@ namespace OpenSim.Region.OptionalModules
m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
}
private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition)
{
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
string response = DoCommonChecks(objectCount, ownerID, lo, scene);
string response = DoCommonChecks(objectCount, ownerID, lo);
if (response != null)
{
@ -120,12 +122,12 @@ namespace OpenSim.Region.OptionalModules
}
//OnDuplicateObject
private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp)
{
Vector3 objectPosition = sog.AbsolutePosition;
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo, scene);
string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo);
if (response != null)
{
@ -135,18 +137,18 @@ namespace OpenSim.Region.OptionalModules
return true;
}
private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene)
private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
{
float newX = newPoint.X;
float newY = newPoint.Y;
if (newX < -1.0f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
newY < -1.0f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
if (newX < -1.0f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) ||
newY < -1.0f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
if (sog == null)
return false;
ILandObject newParcel = scene.LandChannel.GetLandObject(newX, newY);
ILandObject newParcel = m_scene.LandChannel.GetLandObject(newX, newY);
if (newParcel == null)
return true;
@ -154,7 +156,7 @@ namespace OpenSim.Region.OptionalModules
if(!enteringRegion)
{
Vector3 oldPoint = sog.AbsolutePosition;
ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
ILandObject oldParcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
if(oldParcel != null && oldParcel.Equals(newParcel))
return true;
}
@ -163,7 +165,7 @@ namespace OpenSim.Region.OptionalModules
// TODO: Add Special Case here for temporary prims
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel, scene);
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
if (response != null)
{
@ -174,25 +176,25 @@ namespace OpenSim.Region.OptionalModules
return true;
}
private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene)
private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo)
{
string response = null;
int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
{
response = "Unable to rez object because the region is too full";
response = "Unable to rez object because the parcel is full";
}
else
{
int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser;
int maxPrimsPerUser = m_scene.RegionInfo.MaxPrimsPerUser;
if (maxPrimsPerUser >= 0)
{
// per-user prim limit is set
if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
{
// caller is not the sole Parcel owner
EstateSettings estateSettings = scene.RegionInfo.EstateSettings;
EstateSettings estateSettings = m_scene.RegionInfo.EstateSettings;
if (ownerID != estateSettings.EstateOwner)
{
// caller is NOT the Estate owner