*Added SceneExternalChecks.cs that is used to manage checking the results of multiple functions that register with the class and return the result (usually true/false) based on those results. This is useful for module wanting to put their opinion in decisions such as 'can the user rez this object?'
parent
5afe6c3ed9
commit
6551f17966
|
@ -4047,6 +4047,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
//RayEnd: <61.97724, 141.995, 92.58341>
|
||||
//RayTargetID: 00000000-0000-0000-0000-000000000000
|
||||
|
||||
//Check to see if adding the prim is allowed; useful for any module wanting to restrict the
|
||||
//object from rezing initially
|
||||
|
||||
handlerAddPrim = OnAddPrim;
|
||||
if (handlerAddPrim != null)
|
||||
handlerAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection);
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Interfaces
|
|||
|
||||
#region Object Permissions
|
||||
|
||||
bool CanRezObject(LLUUID user, LLVector3 position);
|
||||
bool CanRezObject(LLUUID user, LLVector3 position, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Permissions check - can user delete an object?
|
||||
|
|
|
@ -140,12 +140,21 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual bool CanRezObject(LLUUID user, LLVector3 position)
|
||||
public virtual bool CanRezObject(LLUUID user, LLVector3 position, int objectCount)
|
||||
{
|
||||
bool permission = false;
|
||||
|
||||
|
||||
|
||||
string reason = "Insufficient permission";
|
||||
|
||||
//Perform ExternalChecks first!
|
||||
bool results = m_scene.ExternalChecks.ExternalChecksCanRezObject(objectCount, user, position);
|
||||
if (results == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y);
|
||||
if (land == null) return false;
|
||||
|
||||
|
|
|
@ -1267,10 +1267,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
|
||||
BypassRayCast, bRayEndIsIntersection,true,scale, false);
|
||||
|
||||
if (!Permissions.CanRezObject(remoteClient.AgentId, pos) && !attachment)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Rez object
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
@ -1288,6 +1285,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
string xmlData = Helpers.FieldToUTF8String(rezAsset.Data);
|
||||
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
|
||||
if (!Permissions.CanRezObject(remoteClient.AgentId, pos, group.Children.Count) && !attachment)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
group.ResetIDs();
|
||||
AddEntity(group);
|
||||
|
||||
|
@ -1361,10 +1363,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
LLUUID ownerID = item.OwnerID;
|
||||
|
||||
if (!Permissions.CanRezObject(ownerID, pos))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false);
|
||||
|
||||
|
@ -1372,6 +1370,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
string xmlData = Helpers.FieldToUTF8String(rezAsset.Data);
|
||||
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
|
||||
|
||||
if (!Permissions.CanRezObject(ownerID, pos, group.Children.Count))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
group.ResetIDs();
|
||||
AddEntity(group);
|
||||
|
||||
|
|
|
@ -241,6 +241,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor;
|
||||
|
||||
m_eventManager = new EventManager();
|
||||
m_externalChecks = new SceneExternalChecks(this);
|
||||
|
||||
//Bind Storage Manager functions to some land manager functions for this scene
|
||||
EventManager.OnLandObjectAdded +=
|
||||
|
@ -1244,7 +1245,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false);
|
||||
|
||||
if (Permissions.CanRezObject(ownerID, pos))
|
||||
if (Permissions.CanRezObject(ownerID, pos, 1))
|
||||
{
|
||||
// rez ON the ground, not IN the ground
|
||||
pos.Z += 0.25F;
|
||||
|
@ -3217,5 +3218,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return visualParams;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
|
||||
protected SceneExternalChecks m_externalChecks;
|
||||
public SceneExternalChecks ExternalChecks
|
||||
{
|
||||
get { return m_externalChecks; }
|
||||
}
|
||||
|
||||
protected string m_datastore;
|
||||
|
||||
private uint m_nextLocalId = 8880000;
|
||||
|
|
Loading…
Reference in New Issue