aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs162
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs29
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs3
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs11
6 files changed, 112 insertions, 102 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index b2d9b66..aca5514 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -894,7 +894,7 @@ namespace OpenSim.Region.CoreModules.World.Land
894 894
895 foreach (List<SceneObjectGroup> ol in returns.Values) 895 foreach (List<SceneObjectGroup> ol in returns.Values)
896 { 896 {
897 if (m_scene.Permissions.CanUseObjectReturn(this, type, remote_client, ol)) 897 if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol))
898 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); 898 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
899 } 899 }
900 } 900 }
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 5c7f3b7..4dbdb01 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
217 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 217 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
218 m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED 218 m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED
219 m_scene.Permissions.OnObjectEntry += CanObjectEntry; 219 m_scene.Permissions.OnObjectEntry += CanObjectEntry;
220 m_scene.Permissions.OnReturnObject += CanReturnObject; //NOT YET IMPLEMENTED 220 m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED
221 m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED 221 m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED
222 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; 222 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
223 m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED 223 m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED
@@ -247,7 +247,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
247 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED 247 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED
248 248
249 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED 249 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
250 m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED
251 250
252 m_scene.AddCommand(this, "bypass permissions", 251 m_scene.AddCommand(this, "bypass permissions",
253 "bypass permissions <true / false>", 252 "bypass permissions <true / false>",
@@ -1275,12 +1274,106 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1275 return false; 1274 return false;
1276 } 1275 }
1277 1276
1278 private bool CanReturnObject(UUID objectID, UUID returnerID, Scene scene) 1277 private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene)
1279 { 1278 {
1280 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1279 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1281 if (m_bypassPermissions) return m_bypassPermissionsValue; 1280 if (m_bypassPermissions) return m_bypassPermissionsValue;
1282 1281
1283 return GenericObjectPermission(returnerID, objectID, false); 1282 GroupPowers powers;
1283 ILandObject l;
1284
1285 ScenePresence sp = scene.GetScenePresence(user);
1286 if (sp == null)
1287 return false;
1288
1289 IClientAPI client = sp.ControllingClient;
1290
1291 foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects))
1292 {
1293 // Any user can return their own objects at any time
1294 //
1295 if (GenericObjectPermission(user, g.UUID, false))
1296 continue;
1297
1298 // This is a short cut for efficiency. If land is non-null,
1299 // then all objects are on that parcel and we can save
1300 // ourselves the checking for each prim. Much faster.
1301 //
1302 if (land != null)
1303 {
1304 l = land;
1305 }
1306 else
1307 {
1308 Vector3 pos = g.AbsolutePosition;
1309
1310 l = scene.LandChannel.GetLandObject(pos.X, pos.Y);
1311 }
1312
1313 // If it's not over any land, then we can't do a thing
1314 if (l == null)
1315 {
1316 objects.Remove(g);
1317 continue;
1318 }
1319
1320 // If we own the land outright, then allow
1321 //
1322 if (l.LandData.OwnerID == user)
1323 continue;
1324
1325 // Group voodoo
1326 //
1327 if (land.LandData.IsGroupOwned)
1328 {
1329 powers = (GroupPowers)client.GetGroupPowers(land.LandData.GroupID);
1330 // Not a group member, or no rights at all
1331 //
1332 if (powers == (GroupPowers)0)
1333 {
1334 objects.Remove(g);
1335 continue;
1336 }
1337
1338 // Group deeded object?
1339 //
1340 if (g.OwnerID == l.LandData.GroupID &&
1341 (powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0)
1342 {
1343 objects.Remove(g);
1344 continue;
1345 }
1346
1347 // Group set object?
1348 //
1349 if (g.GroupID == l.LandData.GroupID &&
1350 (powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0)
1351 {
1352 objects.Remove(g);
1353 continue;
1354 }
1355
1356 if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0)
1357 {
1358 objects.Remove(g);
1359 continue;
1360 }
1361
1362 // So we can remove all objects from this group land.
1363 // Fine.
1364 //
1365 continue;
1366 }
1367
1368 // By default, we can't remove
1369 //
1370 objects.Remove(g);
1371 }
1372
1373 if (objects.Count == 0)
1374 return false;
1375
1376 return true;
1284 } 1377 }
1285 1378
1286 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) 1379 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
@@ -1747,67 +1840,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1747 return GenericObjectPermission(agentID, prim, false); 1840 return GenericObjectPermission(agentID, prim, false);
1748 } 1841 }
1749 1842
1750 private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
1751 {
1752 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1753 if (m_bypassPermissions) return m_bypassPermissionsValue;
1754
1755 long powers = 0;
1756 if (parcel.LandData.GroupID != UUID.Zero)
1757 client.GetGroupPowers(parcel.LandData.GroupID);
1758
1759 switch (type)
1760 {
1761 case (uint)ObjectReturnType.Owner:
1762 // Don't let group members return owner's objects, ever
1763 //
1764 if (parcel.LandData.IsGroupOwned)
1765 {
1766 if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0)
1767 return true;
1768 }
1769 else
1770 {
1771 if (parcel.LandData.OwnerID != client.AgentId)
1772 return false;
1773 }
1774 return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned);
1775 case (uint)ObjectReturnType.Group:
1776 if (parcel.LandData.OwnerID != client.AgentId)
1777 {
1778 // If permissionis granted through a group...
1779 //
1780 if ((powers & (long)GroupPowers.ReturnGroupSet) != 0)
1781 {
1782 foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist))
1783 {
1784 // check for and remove group owned objects unless
1785 // the user also has permissions to return those
1786 //
1787 if (g.OwnerID == g.GroupID &&
1788 ((powers & (long)GroupPowers.ReturnGroupOwned) == 0))
1789 {
1790 retlist.Remove(g);
1791 }
1792 }
1793 // And allow the operation
1794 //
1795 return true;
1796 }
1797 }
1798 return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupSet);
1799 case (uint)ObjectReturnType.Other:
1800 if ((powers & (long)GroupPowers.ReturnNonGroup) != 0)
1801 return true;
1802 return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnNonGroup);
1803 case (uint)ObjectReturnType.List:
1804 break;
1805 }
1806
1807 return GenericParcelOwnerPermission(client.AgentId, parcel, 0);
1808 // Is it correct to be less restrictive for lists of objects to be returned?
1809 }
1810
1811 private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { 1843 private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) {
1812 //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); 1844 //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
1813 switch (scriptType) { 1845 switch (scriptType) {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 32311d8..31c0be1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1518,9 +1518,10 @@ namespace OpenSim.Region.Framework.Scenes
1518 if (remoteClient != null) 1518 if (remoteClient != null)
1519 { 1519 {
1520 permissionToTake = 1520 permissionToTake =
1521 Permissions.CanReturnObject( 1521 Permissions.CanReturnObjects(
1522 grp.UUID, 1522 null,
1523 remoteClient.AgentId); 1523 remoteClient.AgentId,
1524 new List<SceneObjectGroup>() {grp});
1524 permissionToDelete = permissionToTake; 1525 permissionToDelete = permissionToTake;
1525 1526
1526 if (permissionToDelete) 1527 if (permissionToDelete)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index d1d6b6a..7dab04f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.Framework.Scenes
48 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); 48 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
49 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene); 49 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
50 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); 50 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
51 public delegate bool ReturnObjectHandler(UUID objectID, UUID returnerID, Scene scene); 51 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene);
52 public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene); 52 public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
53 public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene); 53 public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene);
54 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 54 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
@@ -81,7 +81,6 @@ namespace OpenSim.Region.Framework.Scenes
81 public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID); 81 public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID);
82 public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); 82 public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
83 public delegate bool TeleportHandler(UUID userID, Scene scene); 83 public delegate bool TeleportHandler(UUID userID, Scene scene);
84 public delegate bool UseObjectReturnHandler(ILandObject landData, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene);
85 #endregion 84 #endregion
86 85
87 public class ScenePermissions 86 public class ScenePermissions
@@ -107,7 +106,7 @@ namespace OpenSim.Region.Framework.Scenes
107 public event EditObjectInventoryHandler OnEditObjectInventory; 106 public event EditObjectInventoryHandler OnEditObjectInventory;
108 public event MoveObjectHandler OnMoveObject; 107 public event MoveObjectHandler OnMoveObject;
109 public event ObjectEntryHandler OnObjectEntry; 108 public event ObjectEntryHandler OnObjectEntry;
110 public event ReturnObjectHandler OnReturnObject; 109 public event ReturnObjectsHandler OnReturnObjects;
111 public event InstantMessageHandler OnInstantMessage; 110 public event InstantMessageHandler OnInstantMessage;
112 public event InventoryTransferHandler OnInventoryTransfer; 111 public event InventoryTransferHandler OnInventoryTransfer;
113 public event ViewScriptHandler OnViewScript; 112 public event ViewScriptHandler OnViewScript;
@@ -140,7 +139,6 @@ namespace OpenSim.Region.Framework.Scenes
140 public event CopyUserInventoryHandler OnCopyUserInventory; 139 public event CopyUserInventoryHandler OnCopyUserInventory;
141 public event DeleteUserInventoryHandler OnDeleteUserInventory; 140 public event DeleteUserInventoryHandler OnDeleteUserInventory;
142 public event TeleportHandler OnTeleport; 141 public event TeleportHandler OnTeleport;
143 public event UseObjectReturnHandler OnUseObjectReturn;
144 #endregion 142 #endregion
145 143
146 #region Object Permission Checks 144 #region Object Permission Checks
@@ -377,15 +375,15 @@ namespace OpenSim.Region.Framework.Scenes
377 #endregion 375 #endregion
378 376
379 #region RETURN OBJECT 377 #region RETURN OBJECT
380 public bool CanReturnObject(UUID objectID, UUID returnerID) 378 public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects)
381 { 379 {
382 ReturnObjectHandler handler = OnReturnObject; 380 ReturnObjectsHandler handler = OnReturnObjects;
383 if (handler != null) 381 if (handler != null)
384 { 382 {
385 Delegate[] list = handler.GetInvocationList(); 383 Delegate[] list = handler.GetInvocationList();
386 foreach (ReturnObjectHandler h in list) 384 foreach (ReturnObjectsHandler h in list)
387 { 385 {
388 if (h(objectID, returnerID, m_scene) == false) 386 if (h(land, user, objects, m_scene) == false)
389 return false; 387 return false;
390 } 388 }
391 } 389 }
@@ -949,20 +947,5 @@ namespace OpenSim.Region.Framework.Scenes
949 } 947 }
950 return true; 948 return true;
951 } 949 }
952
953 public bool CanUseObjectReturn(ILandObject landData, uint type , IClientAPI client, List<SceneObjectGroup> retlist)
954 {
955 UseObjectReturnHandler handler = OnUseObjectReturn;
956 if (handler != null)
957 {
958 Delegate[] list = handler.GetInvocationList();
959 foreach (UseObjectReturnHandler h in list)
960 {
961 if (h(landData, type, client, retlist, m_scene) == false)
962 return false;
963 }
964 }
965 return true;
966 }
967 } 950 }
968} 951}
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 7a43537..9cb349a 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -1005,7 +1005,7 @@ namespace OpenSim.Region.RegionCombinerModule
1005 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED 1005 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
1006 VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED 1006 VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
1007 VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry; 1007 VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
1008 VirtualRegion.Permissions.OnReturnObject += BigRegion.PermissionModule.CanReturnObject; //NOT YET IMPLEMENTED 1008 VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED
1009 VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED 1009 VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
1010 VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand; 1010 VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
1011 VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED 1011 VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
@@ -1031,7 +1031,6 @@ namespace OpenSim.Region.RegionCombinerModule
1031 VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED 1031 VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
1032 VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED 1032 VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
1033 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED 1033 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
1034 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
1035 } 1034 }
1036 1035
1037 #region console commands 1036 #region console commands
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
index 4d1af57..393322d 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
@@ -135,9 +135,9 @@ namespace OpenSim.Region.RegionCombinerModule
135 return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint); 135 return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
136 } 136 }
137 137
138 public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene) 138 public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene)
139 { 139 {
140 return m_rootScene.Permissions.CanReturnObject(objectid, returnerid); 140 return m_rootScene.Permissions.CanReturnObjects(land, user, objects);
141 } 141 }
142 142
143 public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene) 143 public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
@@ -265,11 +265,6 @@ namespace OpenSim.Region.RegionCombinerModule
265 return m_rootScene.Permissions.CanTeleport(userid); 265 return m_rootScene.Permissions.CanTeleport(userid);
266 } 266 }
267 267
268 public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
269 {
270 return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
271 }
272
273 #endregion 268 #endregion
274 } 269 }
275} \ No newline at end of file 270}