diff options
author | Melanie | 2010-03-18 18:57:29 +0000 |
---|---|---|
committer | Melanie | 2010-03-18 18:58:37 +0000 |
commit | f35eb8819c6a872e7c4727940ffc560f7d5d68bd (patch) | |
tree | 3b71a9aa31991d5b9b5c05ecc648d7d055f960c1 | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff) | |
download | opensim-SC-f35eb8819c6a872e7c4727940ffc560f7d5d68bd.zip opensim-SC-f35eb8819c6a872e7c4727940ffc560f7d5d68bd.tar.gz opensim-SC-f35eb8819c6a872e7c4727940ffc560f7d5d68bd.tar.bz2 opensim-SC-f35eb8819c6a872e7c4727940ffc560f7d5d68bd.tar.xz |
Unify a previous refactor of object return with the older solution. We
really don't need two methods doing the same thing, but differently.
Diffstat (limited to '')
6 files changed, 21 insertions, 102 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 1c65965..b8c35f7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -915,7 +915,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
915 | 915 | ||
916 | foreach (List<SceneObjectGroup> ol in returns.Values) | 916 | foreach (List<SceneObjectGroup> ol in returns.Values) |
917 | { | 917 | { |
918 | if (m_scene.Permissions.CanUseObjectReturn(this, type, remote_client, ol)) | 918 | if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) |
919 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); | 919 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); |
920 | } | 920 | } |
921 | } | 921 | } |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 1533462..7159dc6 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
200 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED | 200 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED |
201 | m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED | 201 | m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED |
202 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; | 202 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; |
203 | m_scene.Permissions.OnReturnObject += CanReturnObject; //NOT YET IMPLEMENTED | 203 | m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED |
204 | m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED | 204 | m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED |
205 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; | 205 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; |
206 | m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED | 206 | m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED |
@@ -230,7 +230,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
230 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED | 230 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED |
231 | 231 | ||
232 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED | 232 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED |
233 | m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED | ||
234 | 233 | ||
235 | m_scene.AddCommand(this, "bypass permissions", | 234 | m_scene.AddCommand(this, "bypass permissions", |
236 | "bypass permissions <true / false>", | 235 | "bypass permissions <true / false>", |
@@ -1258,12 +1257,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1258 | return false; | 1257 | return false; |
1259 | } | 1258 | } |
1260 | 1259 | ||
1261 | private bool CanReturnObject(UUID objectID, UUID returnerID, Scene scene) | 1260 | private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene) |
1262 | { | 1261 | { |
1262 | if (objects.Count == 0) | ||
1263 | return false; | ||
1264 | |||
1263 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1265 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1264 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1266 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1265 | 1267 | ||
1266 | return GenericObjectPermission(returnerID, objectID, false); | 1268 | return GenericObjectPermission(user, objects[0].UUID, false); |
1267 | } | 1269 | } |
1268 | 1270 | ||
1269 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) | 1271 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) |
@@ -1730,67 +1732,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1730 | return GenericObjectPermission(agentID, prim, false); | 1732 | return GenericObjectPermission(agentID, prim, false); |
1731 | } | 1733 | } |
1732 | 1734 | ||
1733 | private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene) | ||
1734 | { | ||
1735 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1736 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1737 | |||
1738 | long powers = 0; | ||
1739 | if (parcel.LandData.GroupID != UUID.Zero) | ||
1740 | client.GetGroupPowers(parcel.LandData.GroupID); | ||
1741 | |||
1742 | switch (type) | ||
1743 | { | ||
1744 | case (uint)ObjectReturnType.Owner: | ||
1745 | // Don't let group members return owner's objects, ever | ||
1746 | // | ||
1747 | if (parcel.LandData.IsGroupOwned) | ||
1748 | { | ||
1749 | if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0) | ||
1750 | return true; | ||
1751 | } | ||
1752 | else | ||
1753 | { | ||
1754 | if (parcel.LandData.OwnerID != client.AgentId) | ||
1755 | return false; | ||
1756 | } | ||
1757 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned); | ||
1758 | case (uint)ObjectReturnType.Group: | ||
1759 | if (parcel.LandData.OwnerID != client.AgentId) | ||
1760 | { | ||
1761 | // If permissionis granted through a group... | ||
1762 | // | ||
1763 | if ((powers & (long)GroupPowers.ReturnGroupSet) != 0) | ||
1764 | { | ||
1765 | foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist)) | ||
1766 | { | ||
1767 | // check for and remove group owned objects unless | ||
1768 | // the user also has permissions to return those | ||
1769 | // | ||
1770 | if (g.OwnerID == g.GroupID && | ||
1771 | ((powers & (long)GroupPowers.ReturnGroupOwned) == 0)) | ||
1772 | { | ||
1773 | retlist.Remove(g); | ||
1774 | } | ||
1775 | } | ||
1776 | // And allow the operation | ||
1777 | // | ||
1778 | return true; | ||
1779 | } | ||
1780 | } | ||
1781 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupSet); | ||
1782 | case (uint)ObjectReturnType.Other: | ||
1783 | if ((powers & (long)GroupPowers.ReturnNonGroup) != 0) | ||
1784 | return true; | ||
1785 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnNonGroup); | ||
1786 | case (uint)ObjectReturnType.List: | ||
1787 | break; | ||
1788 | } | ||
1789 | |||
1790 | return GenericParcelOwnerPermission(client.AgentId, parcel, 0); | ||
1791 | // Is it correct to be less restrictive for lists of objects to be returned? | ||
1792 | } | ||
1793 | |||
1794 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { | 1735 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { |
1795 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); | 1736 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); |
1796 | switch (scriptType) { | 1737 | switch (scriptType) { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b2b061e..ffbf745 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1581,9 +1581,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1581 | if (remoteClient != null) | 1581 | if (remoteClient != null) |
1582 | { | 1582 | { |
1583 | permissionToTake = | 1583 | permissionToTake = |
1584 | Permissions.CanReturnObject( | 1584 | Permissions.CanReturnObjects( |
1585 | grp.UUID, | 1585 | null, |
1586 | remoteClient.AgentId); | 1586 | remoteClient.AgentId, |
1587 | new List<SceneObjectGroup>() {grp}); | ||
1587 | permissionToDelete = permissionToTake; | 1588 | permissionToDelete = permissionToTake; |
1588 | 1589 | ||
1589 | if (permissionToDelete) | 1590 | 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 92f060b..0b8771c 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | |||
@@ -922,7 +922,7 @@ namespace OpenSim.Region.RegionCombinerModule | |||
922 | VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED | 922 | VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED |
923 | VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED | 923 | VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED |
924 | VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry; | 924 | VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry; |
925 | VirtualRegion.Permissions.OnReturnObject += BigRegion.PermissionModule.CanReturnObject; //NOT YET IMPLEMENTED | 925 | VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED |
926 | VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED | 926 | VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED |
927 | VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand; | 927 | VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand; |
928 | VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED | 928 | VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED |
@@ -948,7 +948,6 @@ namespace OpenSim.Region.RegionCombinerModule | |||
948 | VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED | 948 | VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED |
949 | VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED | 949 | VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED |
950 | VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED | 950 | VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED |
951 | VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED | ||
952 | } | 951 | } |
953 | 952 | ||
954 | #region console commands | 953 | #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 | } |