diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d183f4aa21..3a670d9c9d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -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); diff --git a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs index ad8e139640..5d161bbc91 100644 --- a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs +++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs @@ -34,8 +34,8 @@ namespace OpenSim.Region.Environment.Interfaces bool BypassPermissions { get; set; } #region Object Permissions - - bool CanRezObject(LLUUID user, LLVector3 position); + + bool CanRezObject(LLUUID user, LLVector3 position, int count); /// /// Permissions check - can user delete an object? diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 75e9e5754d..5203b9460a 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs @@ -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; diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 65e6fd8a96..b5360485f0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -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); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a875051ff8..72512c7579 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -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 += @@ -829,7 +830,7 @@ namespace OpenSim.Region.Environment.Scenes { ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); }); } - + /// /// /// @@ -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 + + } } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index d9dc1dadb6..dc67436c96 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -71,6 +71,12 @@ namespace OpenSim.Region.Environment.Scenes get { return m_eventManager; } } + + protected SceneExternalChecks m_externalChecks; + public SceneExternalChecks ExternalChecks + { + get { return m_externalChecks; } + } protected string m_datastore;