diff options
Diffstat (limited to '')
5 files changed, 118 insertions, 71 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 93aeb94..2ab46aa 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -119,9 +119,22 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
119 | /// | 119 | /// |
120 | /// DeleteToInventory | 120 | /// DeleteToInventory |
121 | /// | 121 | /// |
122 | public override UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) | 122 | public override UUID DeleteToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) |
123 | { | 123 | { |
124 | UUID assetID = base.DeleteToInventory(action, folderID, objectGroup, remoteClient); | 124 | UUID ret = UUID.Zero; |
125 | |||
126 | // HACK: Only works for lists of length one. | ||
127 | // Intermediate version, just to make things compile | ||
128 | foreach (SceneObjectGroup g in objectGroups) | ||
129 | ret = DeleteToInventory(action, folderID, g, remoteClient); | ||
130 | |||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | ||
135 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | ||
136 | { | ||
137 | UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient); | ||
125 | 138 | ||
126 | if (!assetID.Equals(UUID.Zero)) | 139 | if (!assetID.Equals(UUID.Zero)) |
127 | { | 140 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 901dcba..3035d88 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -189,6 +189,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
189 | /// <param name="objectGroup"></param> | 189 | /// <param name="objectGroup"></param> |
190 | /// <param name="remoteClient"> </param> | 190 | /// <param name="remoteClient"> </param> |
191 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | 191 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, |
192 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) | ||
193 | { | ||
194 | // HACK: This is only working for lists containing a single item! | ||
195 | // It's just a hack to make this WIP compile and run. Nothing | ||
196 | // currently calls this with multiple items. | ||
197 | UUID ret = UUID.Zero; | ||
198 | |||
199 | foreach (SceneObjectGroup g in objectGroups) | ||
200 | ret = DeleteToInventory(action, folderID, g, remoteClient); | ||
201 | |||
202 | return ret; | ||
203 | } | ||
204 | |||
205 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | ||
192 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | 206 | SceneObjectGroup objectGroup, IClientAPI remoteClient) |
193 | { | 207 | { |
194 | UUID assetID = UUID.Zero; | 208 | UUID assetID = UUID.Zero; |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 8185258..97f4188 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
38 | public interface IInventoryAccessModule | 38 | public interface IInventoryAccessModule |
39 | { | 39 | { |
40 | UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); | 40 | UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); |
41 | UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient); | 41 | UUID DeleteToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient); |
42 | SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | 42 | SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, |
43 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 43 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
44 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); | 44 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index c08b961..241cac0 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
40 | { | 40 | { |
41 | public DeRezAction action; | 41 | public DeRezAction action; |
42 | public IClientAPI remoteClient; | 42 | public IClientAPI remoteClient; |
43 | public SceneObjectGroup objectGroup; | 43 | public List<SceneObjectGroup> objectGroups; |
44 | public UUID folderID; | 44 | public UUID folderID; |
45 | public bool permissionToDelete; | 45 | public bool permissionToDelete; |
46 | } | 46 | } |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | /// Delete the given object from the scene | 75 | /// Delete the given object from the scene |
76 | /// </summary> | 76 | /// </summary> |
77 | public void DeleteToInventory(DeRezAction action, UUID folderID, | 77 | public void DeleteToInventory(DeRezAction action, UUID folderID, |
78 | SceneObjectGroup objectGroup, IClientAPI remoteClient, | 78 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, |
79 | bool permissionToDelete) | 79 | bool permissionToDelete) |
80 | { | 80 | { |
81 | if (Enabled) | 81 | if (Enabled) |
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
87 | DeleteToInventoryHolder dtis = new DeleteToInventoryHolder(); | 87 | DeleteToInventoryHolder dtis = new DeleteToInventoryHolder(); |
88 | dtis.action = action; | 88 | dtis.action = action; |
89 | dtis.folderID = folderID; | 89 | dtis.folderID = folderID; |
90 | dtis.objectGroup = objectGroup; | 90 | dtis.objectGroups = objectGroups; |
91 | dtis.remoteClient = remoteClient; | 91 | dtis.remoteClient = remoteClient; |
92 | dtis.permissionToDelete = permissionToDelete; | 92 | dtis.permissionToDelete = permissionToDelete; |
93 | 93 | ||
@@ -103,7 +103,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | // This is not ideal since the object will still be available for manipulation when it should be, but it's | 103 | // This is not ideal since the object will still be available for manipulation when it should be, but it's |
104 | // better than losing the object for now. | 104 | // better than losing the object for now. |
105 | if (permissionToDelete) | 105 | if (permissionToDelete) |
106 | objectGroup.DeleteGroup(false); | 106 | { |
107 | foreach (SceneObjectGroup g in objectGroups) | ||
108 | g.DeleteGroup(false); | ||
109 | } | ||
107 | } | 110 | } |
108 | 111 | ||
109 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) | 112 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) |
@@ -140,9 +143,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | { | 143 | { |
141 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 144 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
142 | if (invAccess != null) | 145 | if (invAccess != null) |
143 | invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); | 146 | invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient); |
144 | if (x.permissionToDelete) | 147 | if (x.permissionToDelete) |
145 | m_scene.DeleteSceneObject(x.objectGroup, false); | 148 | { |
149 | foreach (SceneObjectGroup g in x.objectGroups) | ||
150 | m_scene.DeleteSceneObject(g, false); | ||
151 | } | ||
146 | } | 152 | } |
147 | catch (Exception e) | 153 | catch (Exception e) |
148 | { | 154 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cbe3456..e1128a6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1550,79 +1550,98 @@ namespace OpenSim.Region.Framework.Scenes | |||
1550 | public virtual void DeRezObject(IClientAPI remoteClient, uint localID, | 1550 | public virtual void DeRezObject(IClientAPI remoteClient, uint localID, |
1551 | UUID groupID, DeRezAction action, UUID destinationID) | 1551 | UUID groupID, DeRezAction action, UUID destinationID) |
1552 | { | 1552 | { |
1553 | SceneObjectPart part = GetSceneObjectPart(localID); | 1553 | DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID); |
1554 | if (part == null) | 1554 | } |
1555 | return; | ||
1556 | 1555 | ||
1557 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1556 | public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, |
1558 | return; | 1557 | UUID groupID, DeRezAction action, UUID destinationID) |
1558 | { | ||
1559 | // First, see of we can perform the requested action and | ||
1560 | // build a list of eligible objects | ||
1561 | List<uint> deleteIDs = new List<uint>(); | ||
1562 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | ||
1559 | 1563 | ||
1560 | // Can't delete child prims | 1564 | // Start with true for both, then remove the flags if objects |
1561 | if (part != part.ParentGroup.RootPart) | 1565 | // that we can't derez are part of the selection |
1562 | return; | 1566 | bool permissionToTake = true; |
1567 | bool permissionToTakeCopy = true; | ||
1568 | bool permissionToDelete = true; | ||
1563 | 1569 | ||
1564 | SceneObjectGroup grp = part.ParentGroup; | 1570 | foreach (uint localID in localIDs) |
1571 | { | ||
1572 | // Invalid id | ||
1573 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1574 | if (part == null) | ||
1575 | continue; | ||
1565 | 1576 | ||
1566 | //force a database backup/update on this SceneObjectGroup | 1577 | // Already deleted by someone else |
1567 | //So that we know the database is upto date, for when deleting the object from it | 1578 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1568 | ForceSceneObjectBackup(grp); | 1579 | continue; |
1569 | 1580 | ||
1570 | bool permissionToTake = false; | 1581 | // Can't delete child prims |
1571 | bool permissionToDelete = false; | 1582 | if (part != part.ParentGroup.RootPart) |
1583 | continue; | ||
1572 | 1584 | ||
1573 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 1585 | SceneObjectGroup grp = part.ParentGroup; |
1574 | { | 1586 | |
1575 | if (grp.OwnerID == remoteClient.AgentId && grp.RootPart.FromUserInventoryItemID != UUID.Zero) | 1587 | deleteIDs.Add(localID); |
1576 | { | 1588 | deleteGroups.Add(grp); |
1577 | permissionToTake = true; | 1589 | |
1590 | // Force a database backup/update on this SceneObjectGroup | ||
1591 | // So that we know the database is upto date, | ||
1592 | // for when deleting the object from it | ||
1593 | ForceSceneObjectBackup(grp); | ||
1594 | |||
1595 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1596 | permissionToTakeCopy = false; | ||
1597 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | ||
1598 | permissionToTake = false; | ||
1599 | |||
1600 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | ||
1578 | permissionToDelete = false; | 1601 | permissionToDelete = false; |
1579 | } | 1602 | |
1580 | } | 1603 | } |
1581 | else if (action == DeRezAction.TakeCopy) | 1604 | |
1605 | // Handle god perms | ||
1606 | if (Permissions.IsGod(remoteClient.AgentId)) | ||
1582 | { | 1607 | { |
1583 | permissionToTake = | 1608 | permissionToTake = true; |
1584 | Permissions.CanTakeCopyObject( | 1609 | permissionToTakeCopy = true; |
1585 | grp.UUID, | 1610 | permissionToDelete = true; |
1586 | remoteClient.AgentId); | ||
1587 | } | 1611 | } |
1588 | else if (action == DeRezAction.GodTakeCopy) | ||
1589 | { | ||
1590 | permissionToTake = | ||
1591 | Permissions.IsGod( | ||
1592 | remoteClient.AgentId); | ||
1593 | } | ||
1594 | else if (action == DeRezAction.Take) | ||
1595 | { | ||
1596 | permissionToTake = | ||
1597 | Permissions.CanTakeObject( | ||
1598 | grp.UUID, | ||
1599 | remoteClient.AgentId); | ||
1600 | 1612 | ||
1601 | //If they can take, they can delete! | 1613 | // If we're re-saving, we don't even want to delete |
1602 | permissionToDelete = permissionToTake; | 1614 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1603 | } | 1615 | permissionToDelete = false; |
1604 | else if (action == DeRezAction.Delete) | 1616 | |
1617 | // if we want to take a copy,, we also don't want to delete | ||
1618 | // Note: after this point, the permissionToTakeCopy flag | ||
1619 | // becomes irrelevant. It already includes the permissionToTake | ||
1620 | // permission and after excluding no copy items here, we can | ||
1621 | // just use that. | ||
1622 | if (action == DeRezAction.TakeCopy) | ||
1605 | { | 1623 | { |
1606 | permissionToTake = | 1624 | // If we don't have permission, stop right here |
1607 | Permissions.CanDeleteObject( | 1625 | if (!permissionToTakeCopy) |
1608 | grp.UUID, | 1626 | return; |
1609 | remoteClient.AgentId); | 1627 | |
1610 | permissionToDelete = permissionToTake; | 1628 | // Don't delete |
1629 | permissionToDelete = false; | ||
1611 | } | 1630 | } |
1612 | else if (action == DeRezAction.Return) | 1631 | |
1632 | if (action == DeRezAction.Return) | ||
1613 | { | 1633 | { |
1614 | if (remoteClient != null) | 1634 | if (remoteClient != null) |
1615 | { | 1635 | { |
1616 | permissionToTake = | 1636 | if (Permissions.CanReturnObjects( |
1617 | Permissions.CanReturnObjects( | ||
1618 | null, | 1637 | null, |
1619 | remoteClient.AgentId, | 1638 | remoteClient.AgentId, |
1620 | new List<SceneObjectGroup>() {grp}); | 1639 | deleteGroups)) |
1621 | permissionToDelete = permissionToTake; | 1640 | foreach (SceneObjectGroup g in deleteGroups) |
1622 | |||
1623 | if (permissionToDelete) | ||
1624 | { | 1641 | { |
1625 | AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | 1642 | AddReturn(g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); |
1643 | DeleteSceneObject(g, false); | ||
1644 | return; | ||
1626 | } | 1645 | } |
1627 | } | 1646 | } |
1628 | else // Auto return passes through here with null agent | 1647 | else // Auto return passes through here with null agent |
@@ -1631,22 +1650,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1631 | permissionToDelete = true; | 1650 | permissionToDelete = true; |
1632 | } | 1651 | } |
1633 | } | 1652 | } |
1634 | else | ||
1635 | { | ||
1636 | m_log.DebugFormat( | ||
1637 | "[AGENT INVENTORY]: Ignoring unexpected derez action {0} for {1}", action, remoteClient.Name); | ||
1638 | return; | ||
1639 | } | ||
1640 | 1653 | ||
1641 | if (permissionToTake) | 1654 | if (permissionToTake) |
1642 | { | 1655 | { |
1643 | m_asyncSceneObjectDeleter.DeleteToInventory( | 1656 | m_asyncSceneObjectDeleter.DeleteToInventory( |
1644 | action, destinationID, grp, remoteClient, | 1657 | action, destinationID, deleteGroups, remoteClient, |
1645 | permissionToDelete); | 1658 | permissionToDelete); |
1646 | } | 1659 | } |
1647 | else if (permissionToDelete) | 1660 | else if (permissionToDelete) |
1648 | { | 1661 | { |
1649 | DeleteSceneObject(grp, false); | 1662 | foreach (SceneObjectGroup g in deleteGroups) |
1663 | DeleteSceneObject(g, false); | ||
1650 | } | 1664 | } |
1651 | } | 1665 | } |
1652 | 1666 | ||