aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2010-03-18 18:57:29 +0000
committerMelanie2010-03-18 18:57:29 +0000
commit734b0416deac953937df9cd6dd1d0bbfbdc03a58 (patch)
treea2fec4f069a72c70ee790ea28e2762471c01ee41 /OpenSim/Region/CoreModules
parentInconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminati... (diff)
downloadopensim-SC_OLD-734b0416deac953937df9cd6dd1d0bbfbdc03a58.zip
opensim-SC_OLD-734b0416deac953937df9cd6dd1d0bbfbdc03a58.tar.gz
opensim-SC_OLD-734b0416deac953937df9cd6dd1d0bbfbdc03a58.tar.bz2
opensim-SC_OLD-734b0416deac953937df9cd6dd1d0bbfbdc03a58.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 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs71
2 files changed, 7 insertions, 66 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index e85136a..331f183 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -892,7 +892,7 @@ namespace OpenSim.Region.CoreModules.World.Land
892 892
893 foreach (List<SceneObjectGroup> ol in returns.Values) 893 foreach (List<SceneObjectGroup> ol in returns.Values)
894 { 894 {
895 if (m_scene.Permissions.CanUseObjectReturn(this, type, remote_client, ol)) 895 if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol))
896 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); 896 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
897 } 897 }
898 } 898 }
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 5c7f3b7..38fc250 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,15 @@ 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 {
1279 if (objects.Count == 0)
1280 return false;
1281
1280 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1282 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1281 if (m_bypassPermissions) return m_bypassPermissionsValue; 1283 if (m_bypassPermissions) return m_bypassPermissionsValue;
1282 1284
1283 return GenericObjectPermission(returnerID, objectID, false); 1285 return GenericObjectPermission(user, objects[0].UUID, false);
1284 } 1286 }
1285 1287
1286 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) 1288 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
@@ -1747,67 +1749,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1747 return GenericObjectPermission(agentID, prim, false); 1749 return GenericObjectPermission(agentID, prim, false);
1748 } 1750 }
1749 1751
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) { 1752 private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) {
1812 //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); 1753 //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
1813 switch (scriptType) { 1754 switch (scriptType) {