diff options
author | mingchen | 2008-05-07 17:33:57 +0000 |
---|---|---|
committer | mingchen | 2008-05-07 17:33:57 +0000 |
commit | 6551f17966975081ac9b9f4c3b19d33e9d2c69a5 (patch) | |
tree | 24fee3acb4381334e3e4cdc46712e20d63803839 /OpenSim/Region | |
parent | From: Kurt Taylor <krtaylor@us.ibm.com> (diff) | |
download | opensim-SC-6551f17966975081ac9b9f4c3b19d33e9d2c69a5.zip opensim-SC-6551f17966975081ac9b9f4c3b19d33e9d2c69a5.tar.gz opensim-SC-6551f17966975081ac9b9f4c3b19d33e9d2c69a5.tar.bz2 opensim-SC-6551f17966975081ac9b9f4c3b19d33e9d2c69a5.tar.xz |
*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?'
Diffstat (limited to 'OpenSim/Region')
6 files changed, 37 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d183f4a..3a670d9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -4047,6 +4047,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4047 | //RayEnd: <61.97724, 141.995, 92.58341> | 4047 | //RayEnd: <61.97724, 141.995, 92.58341> |
4048 | //RayTargetID: 00000000-0000-0000-0000-000000000000 | 4048 | //RayTargetID: 00000000-0000-0000-0000-000000000000 |
4049 | 4049 | ||
4050 | //Check to see if adding the prim is allowed; useful for any module wanting to restrict the | ||
4051 | //object from rezing initially | ||
4052 | |||
4050 | handlerAddPrim = OnAddPrim; | 4053 | handlerAddPrim = OnAddPrim; |
4051 | if (handlerAddPrim != null) | 4054 | if (handlerAddPrim != null) |
4052 | handlerAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection); | 4055 | 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 ad8e139..5d161bb 100644 --- a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs +++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs | |||
@@ -34,8 +34,8 @@ namespace OpenSim.Region.Environment.Interfaces | |||
34 | bool BypassPermissions { get; set; } | 34 | bool BypassPermissions { get; set; } |
35 | 35 | ||
36 | #region Object Permissions | 36 | #region Object Permissions |
37 | 37 | ||
38 | bool CanRezObject(LLUUID user, LLVector3 position); | 38 | bool CanRezObject(LLUUID user, LLVector3 position, int count); |
39 | 39 | ||
40 | /// <summary> | 40 | /// <summary> |
41 | /// Permissions check - can user delete an object? | 41 | /// 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 75e9e57..5203b94 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 | |||
140 | return false; | 140 | return false; |
141 | } | 141 | } |
142 | 142 | ||
143 | public virtual bool CanRezObject(LLUUID user, LLVector3 position) | 143 | public virtual bool CanRezObject(LLUUID user, LLVector3 position, int objectCount) |
144 | { | 144 | { |
145 | bool permission = false; | 145 | bool permission = false; |
146 | 146 | ||
147 | |||
148 | |||
147 | string reason = "Insufficient permission"; | 149 | string reason = "Insufficient permission"; |
148 | 150 | ||
151 | //Perform ExternalChecks first! | ||
152 | bool results = m_scene.ExternalChecks.ExternalChecksCanRezObject(objectCount, user, position); | ||
153 | if (results == false) | ||
154 | { | ||
155 | return false; | ||
156 | } | ||
157 | |||
149 | ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y); | 158 | ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y); |
150 | if (land == null) return false; | 159 | if (land == null) return false; |
151 | 160 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 65e6fd8..b536048 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 | |||
1267 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), | 1267 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), |
1268 | BypassRayCast, bRayEndIsIntersection,true,scale, false); | 1268 | BypassRayCast, bRayEndIsIntersection,true,scale, false); |
1269 | 1269 | ||
1270 | if (!Permissions.CanRezObject(remoteClient.AgentId, pos) && !attachment) | 1270 | |
1271 | { | ||
1272 | return null; | ||
1273 | } | ||
1274 | 1271 | ||
1275 | // Rez object | 1272 | // Rez object |
1276 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 1273 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
@@ -1288,6 +1285,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1288 | { | 1285 | { |
1289 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | 1286 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); |
1290 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 1287 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
1288 | if (!Permissions.CanRezObject(remoteClient.AgentId, pos, group.Children.Count) && !attachment) | ||
1289 | { | ||
1290 | return null; | ||
1291 | } | ||
1292 | |||
1291 | group.ResetIDs(); | 1293 | group.ResetIDs(); |
1292 | AddEntity(group); | 1294 | AddEntity(group); |
1293 | 1295 | ||
@@ -1361,10 +1363,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1361 | { | 1363 | { |
1362 | LLUUID ownerID = item.OwnerID; | 1364 | LLUUID ownerID = item.OwnerID; |
1363 | 1365 | ||
1364 | if (!Permissions.CanRezObject(ownerID, pos)) | ||
1365 | { | ||
1366 | return null; | ||
1367 | } | ||
1368 | 1366 | ||
1369 | AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); | 1367 | AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); |
1370 | 1368 | ||
@@ -1372,6 +1370,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1372 | { | 1370 | { |
1373 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | 1371 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); |
1374 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 1372 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
1373 | |||
1374 | if (!Permissions.CanRezObject(ownerID, pos, group.Children.Count)) | ||
1375 | { | ||
1376 | return null; | ||
1377 | } | ||
1375 | group.ResetIDs(); | 1378 | group.ResetIDs(); |
1376 | AddEntity(group); | 1379 | AddEntity(group); |
1377 | 1380 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a875051..72512c7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -241,6 +241,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
241 | m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; | 241 | m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; |
242 | 242 | ||
243 | m_eventManager = new EventManager(); | 243 | m_eventManager = new EventManager(); |
244 | m_externalChecks = new SceneExternalChecks(this); | ||
244 | 245 | ||
245 | //Bind Storage Manager functions to some land manager functions for this scene | 246 | //Bind Storage Manager functions to some land manager functions for this scene |
246 | EventManager.OnLandObjectAdded += | 247 | EventManager.OnLandObjectAdded += |
@@ -829,7 +830,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
829 | { | 830 | { |
830 | ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); }); | 831 | ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); }); |
831 | } | 832 | } |
832 | 833 | ||
833 | /// <summary> | 834 | /// <summary> |
834 | /// | 835 | /// |
835 | /// </summary> | 836 | /// </summary> |
@@ -1244,7 +1245,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1244 | 1245 | ||
1245 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false); | 1246 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false); |
1246 | 1247 | ||
1247 | if (Permissions.CanRezObject(ownerID, pos)) | 1248 | if (Permissions.CanRezObject(ownerID, pos, 1)) |
1248 | { | 1249 | { |
1249 | // rez ON the ground, not IN the ground | 1250 | // rez ON the ground, not IN the ground |
1250 | pos.Z += 0.25F; | 1251 | pos.Z += 0.25F; |
@@ -3217,5 +3218,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
3217 | return visualParams; | 3218 | return visualParams; |
3218 | } | 3219 | } |
3219 | #endregion | 3220 | #endregion |
3221 | |||
3222 | |||
3220 | } | 3223 | } |
3221 | } | 3224 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index d9dc1da..dc67436 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -71,6 +71,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
71 | get { return m_eventManager; } | 71 | get { return m_eventManager; } |
72 | } | 72 | } |
73 | 73 | ||
74 | |||
75 | protected SceneExternalChecks m_externalChecks; | ||
76 | public SceneExternalChecks ExternalChecks | ||
77 | { | ||
78 | get { return m_externalChecks; } | ||
79 | } | ||
74 | 80 | ||
75 | protected string m_datastore; | 81 | protected string m_datastore; |
76 | 82 | ||