mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
Permissions modules where made NONShared modules. Make them so, removing incoerences and their potencial bugs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user