aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs138
3 files changed, 89 insertions, 69 deletions
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 96f22a4..bad92a0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1531,79 +1531,98 @@ namespace OpenSim.Region.Framework.Scenes
1531 public virtual void DeRezObject(IClientAPI remoteClient, uint localID, 1531 public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
1532 UUID groupID, DeRezAction action, UUID destinationID) 1532 UUID groupID, DeRezAction action, UUID destinationID)
1533 { 1533 {
1534 SceneObjectPart part = GetSceneObjectPart(localID); 1534 DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID);
1535 if (part == null) 1535 }
1536 return;
1537 1536
1538 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 1537 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
1539 return; 1538 UUID groupID, DeRezAction action, UUID destinationID)
1539 {
1540 // First, see of we can perform the requested action and
1541 // build a list of eligible objects
1542 List<uint> deleteIDs = new List<uint>();
1543 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
1540 1544
1541 // Can't delete child prims 1545 // Start with true for both, then remove the flags if objects
1542 if (part != part.ParentGroup.RootPart) 1546 // that we can't derez are part of the selection
1543 return; 1547 bool permissionToTake = true;
1548 bool permissionToTakeCopy = true;
1549 bool permissionToDelete = true;
1544 1550
1545 SceneObjectGroup grp = part.ParentGroup; 1551 foreach (uint localID in localIDs)
1552 {
1553 // Invalid id
1554 SceneObjectPart part = GetSceneObjectPart(localID);
1555 if (part == null)
1556 continue;
1546 1557
1547 //force a database backup/update on this SceneObjectGroup 1558 // Already deleted by someone else
1548 //So that we know the database is upto date, for when deleting the object from it 1559 if (part.ParentGroup == null || part.ParentGroup.IsDeleted)
1549 ForceSceneObjectBackup(grp); 1560 continue;
1550 1561
1551 bool permissionToTake = false; 1562 // Can't delete child prims
1552 bool permissionToDelete = false; 1563 if (part != part.ParentGroup.RootPart)
1564 continue;
1553 1565
1554 if (action == DeRezAction.SaveToExistingUserInventoryItem) 1566 SceneObjectGroup grp = part.ParentGroup;
1555 { 1567
1556 if (grp.OwnerID == remoteClient.AgentId && grp.RootPart.FromUserInventoryItemID != UUID.Zero) 1568 deleteIDs.Add(localID);
1557 { 1569 deleteGroups.Add(grp);
1558 permissionToTake = true; 1570
1571 // Force a database backup/update on this SceneObjectGroup
1572 // So that we know the database is upto date,
1573 // for when deleting the object from it
1574 ForceSceneObjectBackup(grp);
1575
1576 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
1577 permissionToTakeCopy = false;
1578 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
1579 permissionToTake = false;
1580
1581 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
1559 permissionToDelete = false; 1582 permissionToDelete = false;
1560 } 1583
1561 } 1584 }
1562 else if (action == DeRezAction.TakeCopy) 1585
1586 // Handle god perms
1587 if (Permissions.IsGod(remoteClient.AgentId))
1563 { 1588 {
1564 permissionToTake = 1589 permissionToTake = true;
1565 Permissions.CanTakeCopyObject( 1590 permissionToTakeCopy = true;
1566 grp.UUID, 1591 permissionToDelete = true;
1567 remoteClient.AgentId);
1568 } 1592 }
1569 else if (action == DeRezAction.GodTakeCopy)
1570 {
1571 permissionToTake =
1572 Permissions.IsGod(
1573 remoteClient.AgentId);
1574 }
1575 else if (action == DeRezAction.Take)
1576 {
1577 permissionToTake =
1578 Permissions.CanTakeObject(
1579 grp.UUID,
1580 remoteClient.AgentId);
1581 1593
1582 //If they can take, they can delete! 1594 // If we're re-saving, we don't even want to delete
1583 permissionToDelete = permissionToTake; 1595 if (action == DeRezAction.SaveToExistingUserInventoryItem)
1584 } 1596 permissionToDelete = false;
1585 else if (action == DeRezAction.Delete) 1597
1598 // if we want to take a copy,, we also don't want to delete
1599 // Note: after this point, the permissionToTakeCopy flag
1600 // becomes irrelevant. It already includes the permissionToTake
1601 // permission and after excluding no copy items here, we can
1602 // just use that.
1603 if (action == DeRezAction.TakeCopy)
1586 { 1604 {
1587 permissionToTake = 1605 // If we don't have permission, stop right here
1588 Permissions.CanDeleteObject( 1606 if (!permissionToTakeCopy)
1589 grp.UUID, 1607 return;
1590 remoteClient.AgentId); 1608
1591 permissionToDelete = permissionToTake; 1609 // Don't delete
1610 permissionToDelete = false;
1592 } 1611 }
1593 else if (action == DeRezAction.Return) 1612
1613 if (action == DeRezAction.Return)
1594 { 1614 {
1595 if (remoteClient != null) 1615 if (remoteClient != null)
1596 { 1616 {
1597 permissionToTake = 1617 if (Permissions.CanReturnObjects(
1598 Permissions.CanReturnObjects(
1599 null, 1618 null,
1600 remoteClient.AgentId, 1619 remoteClient.AgentId,
1601 new List<SceneObjectGroup>() {grp}); 1620 deleteGroups))
1602 permissionToDelete = permissionToTake; 1621 foreach (SceneObjectGroup g in deleteGroups)
1603
1604 if (permissionToDelete)
1605 { 1622 {
1606 AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); 1623 AddReturn(g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return");
1624 DeleteSceneObject(g, false);
1625 return;
1607 } 1626 }
1608 } 1627 }
1609 else // Auto return passes through here with null agent 1628 else // Auto return passes through here with null agent
@@ -1612,22 +1631,17 @@ namespace OpenSim.Region.Framework.Scenes
1612 permissionToDelete = true; 1631 permissionToDelete = true;
1613 } 1632 }
1614 } 1633 }
1615 else
1616 {
1617 m_log.DebugFormat(
1618 "[AGENT INVENTORY]: Ignoring unexpected derez action {0} for {1}", action, remoteClient.Name);
1619 return;
1620 }
1621 1634
1622 if (permissionToTake) 1635 if (permissionToTake)
1623 { 1636 {
1624 m_asyncSceneObjectDeleter.DeleteToInventory( 1637 m_asyncSceneObjectDeleter.DeleteToInventory(
1625 action, destinationID, grp, remoteClient, 1638 action, destinationID, deleteGroups, remoteClient,
1626 permissionToDelete); 1639 permissionToDelete);
1627 } 1640 }
1628 else if (permissionToDelete) 1641 else if (permissionToDelete)
1629 { 1642 {
1630 DeleteSceneObject(grp, false); 1643 foreach (SceneObjectGroup g in deleteGroups)
1644 DeleteSceneObject(g, false);
1631 } 1645 }
1632 } 1646 }
1633 1647