diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 353 |
1 files changed, 173 insertions, 180 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cb06540..2f016fa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -338,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
338 | // Update item with new asset | 338 | // Update item with new asset |
339 | item.AssetID = asset.FullID; | 339 | item.AssetID = asset.FullID; |
340 | group.UpdateInventoryItem(item); | 340 | group.UpdateInventoryItem(item); |
341 | group.AggregatePerms(); | ||
341 | 342 | ||
342 | part.SendPropertiesToClient(remoteClient); | 343 | part.SendPropertiesToClient(remoteClient); |
343 | 344 | ||
@@ -647,7 +648,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | // Modify | 648 | // Modify |
648 | uint permsMask = ~ ((uint)PermissionMask.Copy | | 649 | uint permsMask = ~ ((uint)PermissionMask.Copy | |
649 | (uint)PermissionMask.Transfer | | 650 | (uint)PermissionMask.Transfer | |
650 | (uint)PermissionMask.Modify); | 651 | (uint)PermissionMask.Modify | |
652 | (uint)PermissionMask.Export); | ||
651 | 653 | ||
652 | // Now, reduce the next perms to the mask bits | 654 | // Now, reduce the next perms to the mask bits |
653 | // relevant to the operation | 655 | // relevant to the operation |
@@ -677,6 +679,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
677 | (uint)PermissionMask.Move; | 679 | (uint)PermissionMask.Move; |
678 | uint ownerPerms = item.CurrentPermissions; | 680 | uint ownerPerms = item.CurrentPermissions; |
679 | 681 | ||
682 | // These will be applied to the root prim at next rez. | ||
683 | // The legacy slam bit (bit 3) and folded permission (bits 0-2) | ||
684 | // are preserved due to the above mangling | ||
685 | ownerPerms &= nextPerms; | ||
686 | |||
687 | // Mask the base permissions. This is a conservative | ||
688 | // approach altering only the three main perms | ||
689 | basePerms &= nextPerms; | ||
690 | |||
691 | // Mask out the folded portion of the base mask. | ||
692 | // While the owner mask carries the actual folded | ||
693 | // permissions, the base mask carries the original | ||
694 | // base mask, before masking with the folded perms. | ||
695 | // We need this later for rezzing. | ||
696 | basePerms &= ~(uint)PermissionMask.FoldedMask; | ||
697 | basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); | ||
698 | |||
680 | // If this is an object, root prim perms may be more | 699 | // If this is an object, root prim perms may be more |
681 | // permissive than folded perms. Use folded perms as | 700 | // permissive than folded perms. Use folded perms as |
682 | // a mask | 701 | // a mask |
@@ -684,6 +703,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
684 | { | 703 | { |
685 | // Create a safe mask for the current perms | 704 | // Create a safe mask for the current perms |
686 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | 705 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; |
706 | if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0) | ||
707 | foldedPerms |= (uint)PermissionMask.Export; | ||
708 | |||
687 | foldedPerms |= permsMask; | 709 | foldedPerms |= permsMask; |
688 | 710 | ||
689 | bool isRootMod = (item.CurrentPermissions & | 711 | bool isRootMod = (item.CurrentPermissions & |
@@ -691,6 +713,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
691 | true : false; | 713 | true : false; |
692 | 714 | ||
693 | // Mask the owner perms to the folded perms | 715 | // Mask the owner perms to the folded perms |
716 | // Note that this is only to satisfy the viewer. | ||
717 | // The effect of this will be reversed on rez. | ||
694 | ownerPerms &= foldedPerms; | 718 | ownerPerms &= foldedPerms; |
695 | basePerms &= foldedPerms; | 719 | basePerms &= foldedPerms; |
696 | 720 | ||
@@ -705,15 +729,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
705 | } | 729 | } |
706 | } | 730 | } |
707 | 731 | ||
708 | // These will be applied to the root prim at next rez. | ||
709 | // The slam bit (bit 3) and folded permission (bits 0-2) | ||
710 | // are preserved due to the above mangling | ||
711 | ownerPerms &= nextPerms; | ||
712 | |||
713 | // Mask the base permissions. This is a conservative | ||
714 | // approach altering only the three main perms | ||
715 | basePerms &= nextPerms; | ||
716 | |||
717 | // Assign to the actual item. Make sure the slam bit is | 732 | // Assign to the actual item. Make sure the slam bit is |
718 | // set, if it wasn't set before. | 733 | // set, if it wasn't set before. |
719 | itemCopy.BasePermissions = basePerms; | 734 | itemCopy.BasePermissions = basePerms; |
@@ -1200,6 +1215,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1200 | } | 1215 | } |
1201 | 1216 | ||
1202 | group.RemoveInventoryItem(localID, itemID); | 1217 | group.RemoveInventoryItem(localID, itemID); |
1218 | group.AggregatePerms(); | ||
1203 | } | 1219 | } |
1204 | 1220 | ||
1205 | part.SendPropertiesToClient(remoteClient); | 1221 | part.SendPropertiesToClient(remoteClient); |
@@ -1244,6 +1260,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1244 | agentItem.InvType = taskItem.InvType; | 1260 | agentItem.InvType = taskItem.InvType; |
1245 | agentItem.Flags = taskItem.Flags; | 1261 | agentItem.Flags = taskItem.Flags; |
1246 | 1262 | ||
1263 | // The code below isn't OK. It doesn't account for flags being changed | ||
1264 | // in the object inventory, so it will break when you do it. That | ||
1265 | // is the previous behaviour, so no matter at this moment. However, there is a lot | ||
1266 | // TODO: Fix this after the inventory fixer exists and has beenr run | ||
1247 | if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) | 1267 | if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) |
1248 | { | 1268 | { |
1249 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1269 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
@@ -1252,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1252 | else | 1272 | else |
1253 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 1273 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
1254 | 1274 | ||
1255 | agentItem.CurrentPermissions = agentItem.BasePermissions; | 1275 | agentItem.BasePermissions = agentItem.CurrentPermissions; |
1256 | 1276 | ||
1257 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 1277 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
1258 | agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); | 1278 | agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); |
@@ -1360,18 +1380,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1360 | return; | 1380 | return; |
1361 | } | 1381 | } |
1362 | 1382 | ||
1363 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1383 | if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId)) |
1364 | { | ||
1365 | // If the item to be moved is no copy, we need to be able to | ||
1366 | // edit the prim. | ||
1367 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
1368 | return; | ||
1369 | } | ||
1370 | else | ||
1371 | { | 1384 | { |
1372 | // If the item is copiable, then we just need to have perms | 1385 | // check also if we can delete the no copy item |
1373 | // on it. The delete check is a pure rights check | 1386 | if(!Permissions.CanEditObject(part.UUID, remoteClient.AgentId)) |
1374 | if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId)) | ||
1375 | return; | 1387 | return; |
1376 | } | 1388 | } |
1377 | 1389 | ||
@@ -1449,29 +1461,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1449 | return; | 1461 | return; |
1450 | } | 1462 | } |
1451 | 1463 | ||
1452 | // Can't transfer this | 1464 | if(!Permissions.CanDoObjectInvToObjectInv(srcTaskItem, part, destPart)) |
1453 | // | ||
1454 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1455 | return; | 1465 | return; |
1456 | 1466 | ||
1457 | bool overrideNoMod = false; | ||
1458 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1459 | overrideNoMod = true; | ||
1460 | |||
1461 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1462 | { | ||
1463 | // object cannot copy items to an object owned by a different owner | ||
1464 | // unless llAllowInventoryDrop has been called | ||
1465 | |||
1466 | return; | ||
1467 | } | ||
1468 | |||
1469 | // must have both move and modify permission to put an item in an object | ||
1470 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) | ||
1471 | { | ||
1472 | return; | ||
1473 | } | ||
1474 | |||
1475 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1467 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1476 | 1468 | ||
1477 | destTaskItem.ItemID = UUID.Random(); | 1469 | destTaskItem.ItemID = UUID.Random(); |
@@ -1512,9 +1504,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1512 | destTaskItem.Type = srcTaskItem.Type; | 1504 | destTaskItem.Type = srcTaskItem.Type; |
1513 | 1505 | ||
1514 | destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID); | 1506 | destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID); |
1515 | |||
1516 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1507 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1508 | { | ||
1517 | part.Inventory.RemoveInventoryItem(itemId); | 1509 | part.Inventory.RemoveInventoryItem(itemId); |
1510 | } | ||
1518 | 1511 | ||
1519 | ScenePresence avatar; | 1512 | ScenePresence avatar; |
1520 | 1513 | ||
@@ -1652,76 +1645,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
1652 | uint primLocalID) | 1645 | uint primLocalID) |
1653 | { | 1646 | { |
1654 | UUID itemID = itemInfo.ItemID; | 1647 | UUID itemID = itemInfo.ItemID; |
1648 | if (itemID == UUID.Zero) | ||
1649 | { | ||
1650 | m_log.ErrorFormat( | ||
1651 | "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero on update for {1}!", | ||
1652 | remoteClient.Name); | ||
1653 | return; | ||
1654 | } | ||
1655 | 1655 | ||
1656 | // Find the prim we're dealing with | 1656 | // Find the prim we're dealing with |
1657 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 1657 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
1658 | if(part == null) | ||
1659 | { | ||
1660 | m_log.WarnFormat( | ||
1661 | "[PRIM INVENTORY]: " + | ||
1662 | "Update with item {0} requested of prim {1} for {2} but this prim does not exist", | ||
1663 | itemID, primLocalID, remoteClient.Name); | ||
1664 | return; | ||
1665 | } | ||
1658 | 1666 | ||
1659 | if (part != null) | 1667 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); |
1668 | |||
1669 | if (currentItem == null) | ||
1660 | { | 1670 | { |
1661 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); | 1671 | InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); |
1662 | bool allowInventoryDrop = (part.GetEffectiveObjectFlags() | ||
1663 | & (uint)PrimFlags.AllowInventoryDrop) != 0; | ||
1664 | 1672 | ||
1665 | // Explicity allow anyone to add to the inventory if the | 1673 | // if not found Try library |
1666 | // AllowInventoryDrop flag has been set. Don't however let | 1674 | if (item == null && LibraryService != null && LibraryService.LibraryRootFolder != null) |
1667 | // them update an item unless they pass the external checks | 1675 | item = LibraryService.LibraryRootFolder.FindItem(itemID); |
1668 | // | ||
1669 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId) | ||
1670 | && (currentItem != null || !allowInventoryDrop)) | ||
1671 | return; | ||
1672 | 1676 | ||
1673 | if (currentItem == null) | 1677 | if(item == null) |
1674 | { | 1678 | { |
1675 | UUID copyID = UUID.Random(); | 1679 | m_log.ErrorFormat( |
1676 | if (itemID != UUID.Zero) | 1680 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", |
1677 | { | 1681 | itemID, remoteClient.Name); |
1678 | InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); | 1682 | return; |
1683 | } | ||
1679 | 1684 | ||
1680 | // Try library | 1685 | if (!Permissions.CanDropInObjectInv(item, remoteClient, part)) |
1681 | if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) | 1686 | return; |
1682 | { | ||
1683 | item = LibraryService.LibraryRootFolder.FindItem(itemID); | ||
1684 | } | ||
1685 | 1687 | ||
1686 | // If we've found the item in the user's inventory or in the library | 1688 | UUID copyID = UUID.Random(); |
1687 | if (item != null) | 1689 | bool modrights = Permissions.CanEditObject(part.ParentGroup, remoteClient); |
1688 | { | 1690 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID, modrights); |
1689 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID); | 1691 | m_log.InfoFormat( |
1690 | m_log.InfoFormat( | 1692 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
1691 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 1693 | item.Name, primLocalID, remoteClient.Name); |
1692 | item.Name, primLocalID, remoteClient.Name); | 1694 | part.SendPropertiesToClient(remoteClient); |
1693 | part.SendPropertiesToClient(remoteClient); | 1695 | if (!Permissions.BypassPermissions()) |
1694 | if (!Permissions.BypassPermissions()) | 1696 | { |
1695 | { | 1697 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1696 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1698 | { |
1697 | { | 1699 | List<UUID> uuids = new List<UUID>(); |
1698 | List<UUID> uuids = new List<UUID>(); | 1700 | uuids.Add(itemID); |
1699 | uuids.Add(itemID); | 1701 | RemoveInventoryItem(remoteClient, uuids); |
1700 | RemoveInventoryItem(remoteClient, uuids); | ||
1701 | } | ||
1702 | } | ||
1703 | } | ||
1704 | else | ||
1705 | { | ||
1706 | m_log.ErrorFormat( | ||
1707 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", | ||
1708 | itemID, remoteClient.Name); | ||
1709 | } | ||
1710 | } | 1702 | } |
1711 | } | 1703 | } |
1712 | else // Updating existing item with new perms etc | 1704 | } |
1713 | { | 1705 | else // Updating existing item with new perms etc |
1706 | { | ||
1714 | // m_log.DebugFormat( | 1707 | // m_log.DebugFormat( |
1715 | // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", | 1708 | // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", |
1716 | // currentItem.Name, part.Name); | 1709 | // currentItem.Name, part.Name); |
1717 | 1710 | ||
1718 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the | 1711 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
1719 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) | 1712 | return; |
1720 | // will not pass in a transaction ID in the update message. | 1713 | |
1721 | if (transactionID != UUID.Zero && AgentTransactionsModule != null) | 1714 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the |
1722 | { | 1715 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) |
1723 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1716 | // will not pass in a transaction ID in the update message. |
1724 | remoteClient, part, transactionID, currentItem); | 1717 | if (transactionID != UUID.Zero && AgentTransactionsModule != null) |
1718 | { | ||
1719 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | ||
1720 | remoteClient, part, transactionID, currentItem); | ||
1725 | 1721 | ||
1726 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1722 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1727 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1723 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
@@ -1729,49 +1725,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1729 | // remoteClient.SendAgentAlertMessage("Script saved", false); | 1725 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1730 | // else | 1726 | // else |
1731 | // remoteClient.SendAgentAlertMessage("Item saved", false); | 1727 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1732 | } | 1728 | } |
1733 | 1729 | ||
1734 | // Base ALWAYS has move | 1730 | // Base ALWAYS has move |
1735 | currentItem.BasePermissions |= (uint)PermissionMask.Move; | 1731 | currentItem.BasePermissions |= (uint)PermissionMask.Move; |
1736 | 1732 | ||
1737 | itemInfo.Flags = currentItem.Flags; | 1733 | itemInfo.Flags = currentItem.Flags; |
1738 | 1734 | ||
1739 | // Check if we're allowed to mess with permissions | 1735 | // Check if we're allowed to mess with permissions |
1740 | if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god | 1736 | if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god |
1737 | { | ||
1738 | if (remoteClient.AgentId != part.OwnerID) // Not owner | ||
1741 | { | 1739 | { |
1742 | if (remoteClient.AgentId != part.OwnerID) // Not owner | 1740 | // Friends and group members can't change any perms |
1743 | { | 1741 | itemInfo.BasePermissions = currentItem.BasePermissions; |
1744 | // Friends and group members can't change any perms | 1742 | itemInfo.EveryonePermissions = currentItem.EveryonePermissions; |
1745 | itemInfo.BasePermissions = currentItem.BasePermissions; | 1743 | itemInfo.GroupPermissions = currentItem.GroupPermissions; |
1746 | itemInfo.EveryonePermissions = currentItem.EveryonePermissions; | 1744 | itemInfo.NextPermissions = currentItem.NextPermissions; |
1747 | itemInfo.GroupPermissions = currentItem.GroupPermissions; | 1745 | itemInfo.CurrentPermissions = currentItem.CurrentPermissions; |
1748 | itemInfo.NextPermissions = currentItem.NextPermissions; | ||
1749 | itemInfo.CurrentPermissions = currentItem.CurrentPermissions; | ||
1750 | } | ||
1751 | else | ||
1752 | { | ||
1753 | // Owner can't change base, and can change other | ||
1754 | // only up to base | ||
1755 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1756 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | ||
1757 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | ||
1758 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | ||
1759 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; | ||
1760 | if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) | ||
1761 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | ||
1762 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | ||
1763 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | ||
1764 | itemInfo.EveryonePermissions &= currentItem.BasePermissions; | ||
1765 | itemInfo.GroupPermissions &= currentItem.BasePermissions; | ||
1766 | itemInfo.CurrentPermissions &= currentItem.BasePermissions; | ||
1767 | itemInfo.NextPermissions &= currentItem.BasePermissions; | ||
1768 | } | ||
1769 | |||
1770 | } | 1746 | } |
1771 | else | 1747 | else |
1772 | { | 1748 | { |
1773 | if (itemInfo.BasePermissions != currentItem.BasePermissions) | 1749 | // Owner can't change base, and can change other |
1774 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase; | 1750 | // only up to base |
1751 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1775 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | 1752 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) |
1776 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | 1753 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; |
1777 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | 1754 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) |
@@ -1780,24 +1757,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
1780 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | 1757 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; |
1781 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | 1758 | if (itemInfo.NextPermissions != currentItem.NextPermissions) |
1782 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | 1759 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; |
1760 | itemInfo.EveryonePermissions &= currentItem.BasePermissions; | ||
1761 | itemInfo.GroupPermissions &= currentItem.BasePermissions; | ||
1762 | itemInfo.CurrentPermissions &= currentItem.BasePermissions; | ||
1763 | itemInfo.NextPermissions &= currentItem.BasePermissions; | ||
1783 | } | 1764 | } |
1784 | 1765 | ||
1785 | // Next ALWAYS has move | 1766 | } |
1786 | itemInfo.NextPermissions |= (uint)PermissionMask.Move; | 1767 | else |
1768 | { | ||
1769 | if (itemInfo.BasePermissions != currentItem.BasePermissions) | ||
1770 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase; | ||
1771 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | ||
1772 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | ||
1773 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | ||
1774 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; | ||
1775 | if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) | ||
1776 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | ||
1777 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | ||
1778 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | ||
1779 | } | ||
1787 | 1780 | ||
1788 | if (part.Inventory.UpdateInventoryItem(itemInfo)) | 1781 | // Next ALWAYS has move |
1789 | { | 1782 | itemInfo.NextPermissions |= (uint)PermissionMask.Move; |
1790 | part.SendPropertiesToClient(remoteClient); | 1783 | |
1791 | } | 1784 | if (part.Inventory.UpdateInventoryItem(itemInfo)) |
1785 | { | ||
1786 | part.SendPropertiesToClient(remoteClient); | ||
1792 | } | 1787 | } |
1793 | } | 1788 | } |
1794 | else | ||
1795 | { | ||
1796 | m_log.WarnFormat( | ||
1797 | "[PRIM INVENTORY]: " + | ||
1798 | "Update with item {0} requested of prim {1} for {2} but this prim does not exist", | ||
1799 | itemID, primLocalID, remoteClient.Name); | ||
1800 | } | ||
1801 | } | 1789 | } |
1802 | 1790 | ||
1803 | /// <summary> | 1791 | /// <summary> |
@@ -1960,6 +1948,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1960 | part.Inventory.AddInventoryItem(taskItem, false); | 1948 | part.Inventory.AddInventoryItem(taskItem, false); |
1961 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); | 1949 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); |
1962 | 1950 | ||
1951 | part.ParentGroup.AggregatePerms(); | ||
1952 | |||
1963 | // tell anyone managing scripts that a new script exists | 1953 | // tell anyone managing scripts that a new script exists |
1964 | EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); | 1954 | EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); |
1965 | 1955 | ||
@@ -2095,13 +2085,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | /// <param name='action'>DeRezAction</param> | 2085 | /// <param name='action'>DeRezAction</param> |
2096 | /// <param name='destinationID'>User folder ID to place derezzed object</param> | 2086 | /// <param name='destinationID'>User folder ID to place derezzed object</param> |
2097 | public virtual void DeRezObjects( | 2087 | public virtual void DeRezObjects( |
2098 | IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID) | 2088 | IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true) |
2099 | { | 2089 | { |
2100 | // First, see of we can perform the requested action and | 2090 | // First, see of we can perform the requested action and |
2101 | // build a list of eligible objects | 2091 | // build a list of eligible objects |
2102 | List<uint> deleteIDs = new List<uint>(); | 2092 | List<uint> deleteIDs = new List<uint>(); |
2103 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 2093 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
2104 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | 2094 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); |
2095 | List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>(); | ||
2096 | |||
2097 | ScenePresence sp = null; | ||
2098 | if(remoteClient != null) | ||
2099 | sp = remoteClient.SceneAgent as ScenePresence; | ||
2100 | else if(action != DeRezAction.Return) | ||
2101 | return; // only Return can be called without a client | ||
2105 | 2102 | ||
2106 | // Start with true for both, then remove the flags if objects | 2103 | // Start with true for both, then remove the flags if objects |
2107 | // that we can't derez are part of the selection | 2104 | // that we can't derez are part of the selection |
@@ -2157,17 +2154,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2157 | { | 2154 | { |
2158 | if (action == DeRezAction.TakeCopy) | 2155 | if (action == DeRezAction.TakeCopy) |
2159 | { | 2156 | { |
2160 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2157 | if (!Permissions.CanTakeCopyObject(grp, sp)) |
2161 | permissionToTakeCopy = false; | 2158 | permissionToTakeCopy = false; |
2162 | } | 2159 | } |
2163 | else | 2160 | else |
2164 | { | 2161 | { |
2165 | permissionToTakeCopy = false; | 2162 | permissionToTakeCopy = false; |
2166 | } | 2163 | } |
2167 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2164 | if (!Permissions.CanTakeObject(grp, sp)) |
2168 | permissionToTake = false; | 2165 | permissionToTake = false; |
2169 | 2166 | ||
2170 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2167 | if (!Permissions.CanDeleteObject(grp, remoteClient)) |
2171 | permissionToDelete = false; | 2168 | permissionToDelete = false; |
2172 | } | 2169 | } |
2173 | 2170 | ||
@@ -2208,13 +2205,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2208 | { | 2205 | { |
2209 | if (Permissions.CanReturnObjects( | 2206 | if (Permissions.CanReturnObjects( |
2210 | null, | 2207 | null, |
2211 | remoteClient.AgentId, | 2208 | remoteClient, |
2212 | new List<SceneObjectGroup>() {grp})) | 2209 | new List<SceneObjectGroup>() {grp})) |
2213 | { | 2210 | { |
2214 | permissionToTake = true; | 2211 | permissionToTake = true; |
2215 | permissionToDelete = true; | 2212 | permissionToDelete = true; |
2216 | 2213 | if(AddToReturns) | |
2217 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | 2214 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, |
2215 | "parcel owner return"); | ||
2218 | } | 2216 | } |
2219 | } | 2217 | } |
2220 | else // Auto return passes through here with null agent | 2218 | else // Auto return passes through here with null agent |
@@ -2224,26 +2222,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2224 | } | 2222 | } |
2225 | } | 2223 | } |
2226 | 2224 | ||
2227 | if (permissionToTake && (!permissionToDelete)) | ||
2228 | takeGroups.Add(grp); | ||
2229 | |||
2230 | if (permissionToDelete) | 2225 | if (permissionToDelete) |
2231 | { | 2226 | { |
2232 | if (permissionToTake) | 2227 | if (permissionToTake) |
2228 | takeDeleteGroups.Add(grp); | ||
2229 | else | ||
2233 | deleteGroups.Add(grp); | 2230 | deleteGroups.Add(grp); |
2234 | deleteIDs.Add(grp.LocalId); | 2231 | deleteIDs.Add(grp.LocalId); |
2235 | } | 2232 | } |
2233 | else if(permissionToTake) | ||
2234 | takeGroups.Add(grp); | ||
2236 | } | 2235 | } |
2237 | 2236 | ||
2238 | SendKillObject(deleteIDs); | 2237 | SendKillObject(deleteIDs); |
2239 | 2238 | ||
2240 | if (deleteGroups.Count > 0) | 2239 | if (takeDeleteGroups.Count > 0) |
2241 | { | 2240 | { |
2242 | foreach (SceneObjectGroup g in deleteGroups) | ||
2243 | deleteIDs.Remove(g.LocalId); | ||
2244 | |||
2245 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2241 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2246 | action, destinationID, deleteGroups, remoteClient, | 2242 | action, destinationID, takeDeleteGroups, remoteClient, |
2247 | true); | 2243 | true); |
2248 | } | 2244 | } |
2249 | if (takeGroups.Count > 0) | 2245 | if (takeGroups.Count > 0) |
@@ -2252,7 +2248,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2252 | action, destinationID, takeGroups, remoteClient, | 2248 | action, destinationID, takeGroups, remoteClient, |
2253 | false); | 2249 | false); |
2254 | } | 2250 | } |
2255 | if (deleteIDs.Count > 0) | 2251 | if (deleteGroups.Count > 0) |
2256 | { | 2252 | { |
2257 | foreach (SceneObjectGroup g in deleteGroups) | 2253 | foreach (SceneObjectGroup g in deleteGroups) |
2258 | DeleteSceneObject(g, true); | 2254 | DeleteSceneObject(g, true); |
@@ -2640,6 +2636,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2640 | 2636 | ||
2641 | // We can only call this after adding the scene object, since the scene object references the scene | 2637 | // We can only call this after adding the scene object, since the scene object references the scene |
2642 | // to find out if scripts should be activated at all. | 2638 | // to find out if scripts should be activated at all. |
2639 | group.AggregatePerms(); | ||
2643 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); | 2640 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); |
2644 | 2641 | ||
2645 | group.ScheduleGroupForFullUpdate(); | 2642 | group.ScheduleGroupForFullUpdate(); |
@@ -2649,7 +2646,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2649 | } | 2646 | } |
2650 | 2647 | ||
2651 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, | 2648 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, |
2652 | UUID AgentId) | 2649 | IClientAPI client) |
2653 | { | 2650 | { |
2654 | List<uint> localIDs = new List<uint>(); | 2651 | List<uint> localIDs = new List<uint>(); |
2655 | 2652 | ||
@@ -2659,8 +2656,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2659 | "parcel owner return"); | 2656 | "parcel owner return"); |
2660 | localIDs.Add(grp.RootPart.LocalId); | 2657 | localIDs.Add(grp.RootPart.LocalId); |
2661 | } | 2658 | } |
2662 | DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, | 2659 | DeRezObjects(client, localIDs, UUID.Zero, DeRezAction.Return, |
2663 | UUID.Zero); | 2660 | UUID.Zero, false); |
2664 | 2661 | ||
2665 | return true; | 2662 | return true; |
2666 | } | 2663 | } |
@@ -2691,9 +2688,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2691 | { | 2688 | { |
2692 | if (ownerID != UUID.Zero) | 2689 | if (ownerID != UUID.Zero) |
2693 | return; | 2690 | return; |
2694 | |||
2695 | if (!Permissions.CanDeedObject(remoteClient.AgentId, groupID)) | ||
2696 | return; | ||
2697 | } | 2691 | } |
2698 | 2692 | ||
2699 | List<SceneObjectGroup> groups = new List<SceneObjectGroup>(); | 2693 | List<SceneObjectGroup> groups = new List<SceneObjectGroup>(); |
@@ -2724,21 +2718,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2724 | child.TriggerScriptChangedEvent(Changed.OWNER); | 2718 | child.TriggerScriptChangedEvent(Changed.OWNER); |
2725 | } | 2719 | } |
2726 | } | 2720 | } |
2727 | else // The object was deeded to the group | 2721 | else // The object deeded to the group |
2728 | { | 2722 | { |
2729 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) | 2723 | if (!Permissions.CanDeedObject(remoteClient, sog, groupID)) |
2730 | continue; | 2724 | continue; |
2731 | 2725 | ||
2732 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | 2726 | sog.SetOwnerId(groupID); |
2733 | continue; | ||
2734 | 2727 | ||
2735 | if (sog.GroupID != groupID) | 2728 | // this is wrong, GroupMask is used for group sharing, still possible to set |
2736 | continue; | 2729 | // this whould give owner rights to users that are member of group but don't have role powers to edit |
2730 | // sog.RootPart.GroupMask = sog.RootPart.OwnerMask; | ||
2737 | 2731 | ||
2738 | sog.SetOwnerId(groupID); | 2732 | // we should keep all permissions on deed to group |
2739 | // Make the group mask be the previous owner mask | 2733 | // and with this comented code, if user does not set next permissions on the object |
2740 | sog.RootPart.GroupMask = sog.RootPart.OwnerMask; | 2734 | // and on ALL contents of ALL prims, he may loose rights, making the object useless |
2741 | sog.ApplyNextOwnerPermissions(); | 2735 | sog.ApplyNextOwnerPermissions(); |
2736 | sog.AggregatePerms(); | ||
2742 | 2737 | ||
2743 | sog.ScheduleGroupForFullUpdate(); | 2738 | sog.ScheduleGroupForFullUpdate(); |
2744 | 2739 | ||
@@ -2748,8 +2743,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2748 | child.Inventory.ChangeInventoryOwner(groupID); | 2743 | child.Inventory.ChangeInventoryOwner(groupID); |
2749 | child.TriggerScriptChangedEvent(Changed.OWNER); | 2744 | child.TriggerScriptChangedEvent(Changed.OWNER); |
2750 | } | 2745 | } |
2751 | |||
2752 | |||
2753 | } | 2746 | } |
2754 | } | 2747 | } |
2755 | 2748 | ||