diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 344 |
1 files changed, 258 insertions, 86 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b23ddb4..30bf744 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -101,12 +101,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | engine.StartProcessing(); | 101 | engine.StartProcessing(); |
102 | } | 102 | } |
103 | 103 | ||
104 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) | 104 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint cost) |
105 | { | 105 | { |
106 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); | 106 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); |
107 | if (money != null) | 107 | if (money != null) |
108 | { | 108 | { |
109 | money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); | 109 | money.ApplyUploadCharge(agentID, (int)cost, "Asset upload"); |
110 | } | 110 | } |
111 | 111 | ||
112 | AddInventoryItem(item); | 112 | AddInventoryItem(item); |
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | return false; | 169 | return false; |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | if (InventoryService.AddItem(item)) | 173 | if (InventoryService.AddItem(item)) |
174 | { | 174 | { |
175 | int userlevel = 0; | 175 | int userlevel = 0; |
@@ -324,8 +324,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
324 | 324 | ||
325 | // Update item with new asset | 325 | // Update item with new asset |
326 | item.AssetID = asset.FullID; | 326 | item.AssetID = asset.FullID; |
327 | if (group.UpdateInventoryItem(item)) | 327 | group.UpdateInventoryItem(item); |
328 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
329 | 328 | ||
330 | part.SendPropertiesToClient(remoteClient); | 329 | part.SendPropertiesToClient(remoteClient); |
331 | 330 | ||
@@ -336,12 +335,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
336 | { | 335 | { |
337 | // Needs to determine which engine was running it and use that | 336 | // Needs to determine which engine was running it and use that |
338 | // | 337 | // |
339 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 338 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); |
340 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
345 | } | 339 | } |
346 | 340 | ||
347 | // Tell anyone managing scripts that a script has been reloaded/changed | 341 | // Tell anyone managing scripts that a script has been reloaded/changed |
@@ -409,6 +403,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | 403 | ||
410 | if (UUID.Zero == transactionID) | 404 | if (UUID.Zero == transactionID) |
411 | { | 405 | { |
406 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); | ||
412 | item.Name = itemUpd.Name; | 407 | item.Name = itemUpd.Name; |
413 | item.Description = itemUpd.Description; | 408 | item.Description = itemUpd.Description; |
414 | 409 | ||
@@ -795,6 +790,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
795 | return; | 790 | return; |
796 | } | 791 | } |
797 | 792 | ||
793 | if (newName == null) newName = item.Name; | ||
794 | |||
798 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 795 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
799 | 796 | ||
800 | if (asset != null) | 797 | if (asset != null) |
@@ -855,6 +852,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
855 | } | 852 | } |
856 | 853 | ||
857 | /// <summary> | 854 | /// <summary> |
855 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
856 | /// </summary> | ||
857 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
858 | { | ||
859 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
860 | foreach (InventoryItemBase b in items) | ||
861 | { | ||
862 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
863 | InventoryItemBase n = InventoryService.GetItem(b); | ||
864 | n.Folder = destfolder; | ||
865 | moveitems.Add(n); | ||
866 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
867 | } | ||
868 | |||
869 | MoveInventoryItem(remoteClient, moveitems); | ||
870 | } | ||
871 | |||
872 | /// <summary> | ||
858 | /// Move an item within the agent's inventory. | 873 | /// Move an item within the agent's inventory. |
859 | /// </summary> | 874 | /// </summary> |
860 | /// <param name="remoteClient"></param> | 875 | /// <param name="remoteClient"></param> |
@@ -889,11 +904,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
889 | public void CreateNewInventoryItem( | 904 | public void CreateNewInventoryItem( |
890 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 905 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
891 | string name, string description, uint flags, uint callbackID, | 906 | string name, string description, uint flags, uint callbackID, |
892 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 907 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) |
893 | { | 908 | { |
894 | CreateNewInventoryItem( | 909 | CreateNewInventoryItem( |
895 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 910 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
896 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); | 911 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate, transationID); |
912 | } | ||
913 | |||
914 | |||
915 | private void CreateNewInventoryItem( | ||
916 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | ||
917 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | ||
918 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | ||
919 | { | ||
920 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, | ||
921 | name, description, flags, callbackID, asset, invType, | ||
922 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); | ||
897 | } | 923 | } |
898 | 924 | ||
899 | /// <summary> | 925 | /// <summary> |
@@ -918,7 +944,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
918 | private void CreateNewInventoryItem( | 944 | private void CreateNewInventoryItem( |
919 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 945 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
920 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 946 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
921 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 947 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) |
922 | { | 948 | { |
923 | InventoryItemBase item = new InventoryItemBase(); | 949 | InventoryItemBase item = new InventoryItemBase(); |
924 | item.Owner = remoteClient.AgentId; | 950 | item.Owner = remoteClient.AgentId; |
@@ -941,7 +967,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
941 | 967 | ||
942 | if (AddInventoryItem(item)) | 968 | if (AddInventoryItem(item)) |
943 | { | 969 | { |
944 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 970 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); |
945 | } | 971 | } |
946 | else | 972 | else |
947 | { | 973 | { |
@@ -1216,6 +1242,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1216 | { | 1242 | { |
1217 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1243 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1218 | 1244 | ||
1245 | // Can't move a null item | ||
1246 | if (itemId == UUID.Zero) | ||
1247 | return; | ||
1248 | |||
1219 | if (null == part) | 1249 | if (null == part) |
1220 | { | 1250 | { |
1221 | m_log.WarnFormat( | 1251 | m_log.WarnFormat( |
@@ -1320,21 +1350,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1320 | return; | 1350 | return; |
1321 | } | 1351 | } |
1322 | 1352 | ||
1323 | if (part.OwnerID != destPart.OwnerID) | 1353 | // Can't transfer this |
1354 | // | ||
1355 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1356 | return; | ||
1357 | |||
1358 | bool overrideNoMod = false; | ||
1359 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1360 | overrideNoMod = true; | ||
1361 | |||
1362 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1324 | { | 1363 | { |
1325 | // Source must have transfer permissions | 1364 | // object cannot copy items to an object owned by a different owner |
1326 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1365 | // unless llAllowInventoryDrop has been called |
1327 | return; | ||
1328 | 1366 | ||
1329 | // Object cannot copy items to an object owned by a different owner | 1367 | return; |
1330 | // unless llAllowInventoryDrop has been called on the destination | ||
1331 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1332 | return; | ||
1333 | } | 1368 | } |
1334 | 1369 | ||
1335 | // must have both move and modify permission to put an item in an object | 1370 | // must have both move and modify permission to put an item in an object |
1336 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1371 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1372 | { | ||
1337 | return; | 1373 | return; |
1374 | } | ||
1338 | 1375 | ||
1339 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1376 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1340 | 1377 | ||
@@ -1390,6 +1427,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1390 | 1427 | ||
1391 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1428 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1392 | { | 1429 | { |
1430 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1431 | if (destPart != null) // Move into a prim | ||
1432 | { | ||
1433 | foreach(UUID itemID in items) | ||
1434 | MoveTaskInventoryItem(destID, host, itemID); | ||
1435 | return destID; // Prim folder ID == prim ID | ||
1436 | } | ||
1437 | |||
1393 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1438 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1394 | 1439 | ||
1395 | UUID newFolderID = UUID.Random(); | 1440 | UUID newFolderID = UUID.Random(); |
@@ -1572,12 +1617,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1572 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1617 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1573 | remoteClient, part, transactionID, currentItem); | 1618 | remoteClient, part, transactionID, currentItem); |
1574 | 1619 | ||
1575 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1620 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1576 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1621 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1577 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1622 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1578 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1623 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1579 | else | 1624 | // else |
1580 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1625 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1581 | } | 1626 | } |
1582 | 1627 | ||
1583 | // Base ALWAYS has move | 1628 | // Base ALWAYS has move |
@@ -1760,7 +1805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1760 | } | 1805 | } |
1761 | 1806 | ||
1762 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1807 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1763 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1808 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1764 | agentID); | 1809 | agentID); |
1765 | AssetService.Store(asset); | 1810 | AssetService.Store(asset); |
1766 | 1811 | ||
@@ -1916,23 +1961,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1916 | // build a list of eligible objects | 1961 | // build a list of eligible objects |
1917 | List<uint> deleteIDs = new List<uint>(); | 1962 | List<uint> deleteIDs = new List<uint>(); |
1918 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1963 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1919 | 1964 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1920 | // Start with true for both, then remove the flags if objects | ||
1921 | // that we can't derez are part of the selection | ||
1922 | bool permissionToTake = true; | ||
1923 | bool permissionToTakeCopy = true; | ||
1924 | bool permissionToDelete = true; | ||
1925 | 1965 | ||
1926 | foreach (uint localID in localIDs) | 1966 | foreach (uint localID in localIDs) |
1927 | { | 1967 | { |
1968 | // Start with true for both, then remove the flags if objects | ||
1969 | // that we can't derez are part of the selection | ||
1970 | bool permissionToTake = true; | ||
1971 | bool permissionToTakeCopy = true; | ||
1972 | bool permissionToDelete = true; | ||
1973 | |||
1928 | // Invalid id | 1974 | // Invalid id |
1929 | SceneObjectPart part = GetSceneObjectPart(localID); | 1975 | SceneObjectPart part = GetSceneObjectPart(localID); |
1930 | if (part == null) | 1976 | if (part == null) |
1977 | { | ||
1978 | //Client still thinks the object exists, kill it | ||
1979 | deleteIDs.Add(localID); | ||
1931 | continue; | 1980 | continue; |
1981 | } | ||
1932 | 1982 | ||
1933 | // Already deleted by someone else | 1983 | // Already deleted by someone else |
1934 | if (part.ParentGroup.IsDeleted) | 1984 | if (part.ParentGroup.IsDeleted) |
1985 | { | ||
1986 | //Client still thinks the object exists, kill it | ||
1987 | deleteIDs.Add(localID); | ||
1935 | continue; | 1988 | continue; |
1989 | } | ||
1936 | 1990 | ||
1937 | // Can't delete child prims | 1991 | // Can't delete child prims |
1938 | if (part != part.ParentGroup.RootPart) | 1992 | if (part != part.ParentGroup.RootPart) |
@@ -1940,8 +1994,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1940 | 1994 | ||
1941 | SceneObjectGroup grp = part.ParentGroup; | 1995 | SceneObjectGroup grp = part.ParentGroup; |
1942 | 1996 | ||
1943 | deleteIDs.Add(localID); | 1997 | // If child prims have invalid perms, fix them |
1944 | deleteGroups.Add(grp); | 1998 | grp.AdjustChildPrimPermissions(); |
1945 | 1999 | ||
1946 | // If child prims have invalid perms, fix them | 2000 | // If child prims have invalid perms, fix them |
1947 | grp.AdjustChildPrimPermissions(); | 2001 | grp.AdjustChildPrimPermissions(); |
@@ -1962,83 +2016,195 @@ namespace OpenSim.Region.Framework.Scenes | |||
1962 | } | 2016 | } |
1963 | else | 2017 | else |
1964 | { | 2018 | { |
1965 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2019 | if (action == DeRezAction.TakeCopy) |
2020 | { | ||
2021 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
2022 | permissionToTakeCopy = false; | ||
2023 | } | ||
2024 | else | ||
2025 | { | ||
1966 | permissionToTakeCopy = false; | 2026 | permissionToTakeCopy = false; |
1967 | 2027 | } | |
1968 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2028 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1969 | permissionToTake = false; | 2029 | permissionToTake = false; |
1970 | 2030 | ||
1971 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2031 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1972 | permissionToDelete = false; | 2032 | permissionToDelete = false; |
1973 | } | 2033 | } |
1974 | } | ||
1975 | 2034 | ||
1976 | // Handle god perms | 2035 | // Handle god perms |
1977 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 2036 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1978 | { | 2037 | { |
1979 | permissionToTake = true; | 2038 | permissionToTake = true; |
1980 | permissionToTakeCopy = true; | 2039 | permissionToTakeCopy = true; |
1981 | permissionToDelete = true; | 2040 | permissionToDelete = true; |
1982 | } | 2041 | } |
1983 | 2042 | ||
1984 | // If we're re-saving, we don't even want to delete | 2043 | // If we're re-saving, we don't even want to delete |
1985 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 2044 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1986 | permissionToDelete = false; | 2045 | permissionToDelete = false; |
1987 | 2046 | ||
1988 | // if we want to take a copy, we also don't want to delete | 2047 | // if we want to take a copy, we also don't want to delete |
1989 | // Note: after this point, the permissionToTakeCopy flag | 2048 | // Note: after this point, the permissionToTakeCopy flag |
1990 | // becomes irrelevant. It already includes the permissionToTake | 2049 | // becomes irrelevant. It already includes the permissionToTake |
1991 | // permission and after excluding no copy items here, we can | 2050 | // permission and after excluding no copy items here, we can |
1992 | // just use that. | 2051 | // just use that. |
1993 | if (action == DeRezAction.TakeCopy) | 2052 | if (action == DeRezAction.TakeCopy) |
1994 | { | 2053 | { |
1995 | // If we don't have permission, stop right here | 2054 | // If we don't have permission, stop right here |
1996 | if (!permissionToTakeCopy) | 2055 | if (!permissionToTakeCopy) |
1997 | return; | 2056 | return; |
1998 | 2057 | ||
1999 | permissionToTake = true; | 2058 | permissionToTake = true; |
2000 | // Don't delete | 2059 | // Don't delete |
2001 | permissionToDelete = false; | 2060 | permissionToDelete = false; |
2002 | } | 2061 | } |
2003 | 2062 | ||
2004 | if (action == DeRezAction.Return) | 2063 | if (action == DeRezAction.Return) |
2005 | { | ||
2006 | if (remoteClient != null) | ||
2007 | { | 2064 | { |
2008 | if (Permissions.CanReturnObjects( | 2065 | if (remoteClient != null) |
2009 | null, | ||
2010 | remoteClient.AgentId, | ||
2011 | deleteGroups)) | ||
2012 | { | 2066 | { |
2013 | permissionToTake = true; | 2067 | if (Permissions.CanReturnObjects( |
2014 | permissionToDelete = true; | 2068 | null, |
2015 | 2069 | remoteClient.AgentId, | |
2016 | foreach (SceneObjectGroup g in deleteGroups) | 2070 | new List<SceneObjectGroup>() {grp})) |
2017 | { | 2071 | { |
2018 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2072 | permissionToTake = true; |
2073 | permissionToDelete = true; | ||
2074 | |||
2075 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
2019 | } | 2076 | } |
2020 | } | 2077 | } |
2078 | else // Auto return passes through here with null agent | ||
2079 | { | ||
2080 | permissionToTake = true; | ||
2081 | permissionToDelete = true; | ||
2082 | } | ||
2021 | } | 2083 | } |
2022 | else // Auto return passes through here with null agent | 2084 | |
2085 | if (permissionToTake && (!permissionToDelete)) | ||
2086 | takeGroups.Add(grp); | ||
2087 | |||
2088 | if (permissionToDelete) | ||
2023 | { | 2089 | { |
2024 | permissionToTake = true; | 2090 | if (permissionToTake) |
2025 | permissionToDelete = true; | 2091 | deleteGroups.Add(grp); |
2092 | deleteIDs.Add(grp.LocalId); | ||
2026 | } | 2093 | } |
2027 | } | 2094 | } |
2028 | 2095 | ||
2029 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2096 | SendKillObject(deleteIDs); |
2097 | |||
2098 | if (deleteGroups.Count > 0) | ||
2030 | { | 2099 | { |
2100 | foreach (SceneObjectGroup g in deleteGroups) | ||
2101 | deleteIDs.Remove(g.LocalId); | ||
2102 | |||
2031 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2103 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2032 | action, destinationID, deleteGroups, remoteClient, | 2104 | action, destinationID, deleteGroups, remoteClient, |
2033 | permissionToDelete); | 2105 | true); |
2034 | } | 2106 | } |
2035 | else if (permissionToDelete) | 2107 | if (takeGroups.Count > 0) |
2108 | { | ||
2109 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2110 | action, destinationID, takeGroups, remoteClient, | ||
2111 | false); | ||
2112 | } | ||
2113 | if (deleteIDs.Count > 0) | ||
2036 | { | 2114 | { |
2037 | foreach (SceneObjectGroup g in deleteGroups) | 2115 | foreach (SceneObjectGroup g in deleteGroups) |
2038 | DeleteSceneObject(g, false); | 2116 | DeleteSceneObject(g, true); |
2039 | } | 2117 | } |
2040 | } | 2118 | } |
2041 | 2119 | ||
2120 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2121 | { | ||
2122 | itemID = UUID.Zero; | ||
2123 | if (grp != null) | ||
2124 | { | ||
2125 | Vector3 inventoryStoredPosition = new Vector3 | ||
2126 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2127 | ? 250 | ||
2128 | : grp.AbsolutePosition.X) | ||
2129 | , | ||
2130 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2131 | ? 250 | ||
2132 | : grp.AbsolutePosition.X, | ||
2133 | grp.AbsolutePosition.Z); | ||
2134 | |||
2135 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2136 | |||
2137 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2138 | |||
2139 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2140 | |||
2141 | grp.AbsolutePosition = originalPosition; | ||
2142 | |||
2143 | AssetBase asset = CreateAsset( | ||
2144 | grp.GetPartName(grp.LocalId), | ||
2145 | grp.GetPartDescription(grp.LocalId), | ||
2146 | (sbyte)AssetType.Object, | ||
2147 | Utils.StringToBytes(sceneObjectXml), | ||
2148 | remoteClient.AgentId); | ||
2149 | AssetService.Store(asset); | ||
2150 | |||
2151 | InventoryItemBase item = new InventoryItemBase(); | ||
2152 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2153 | item.CreatorData = grp.RootPart.CreatorData; | ||
2154 | item.Owner = remoteClient.AgentId; | ||
2155 | item.ID = UUID.Random(); | ||
2156 | item.AssetID = asset.FullID; | ||
2157 | item.Description = asset.Description; | ||
2158 | item.Name = asset.Name; | ||
2159 | item.AssetType = asset.Type; | ||
2160 | item.InvType = (int)InventoryType.Object; | ||
2161 | |||
2162 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2163 | if (folder != null) | ||
2164 | item.Folder = folder.ID; | ||
2165 | else // oopsies | ||
2166 | item.Folder = UUID.Zero; | ||
2167 | |||
2168 | // Set up base perms properly | ||
2169 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2170 | permsBase &= grp.RootPart.BaseMask; | ||
2171 | permsBase |= (uint)PermissionMask.Move; | ||
2172 | |||
2173 | // Make sure we don't lock it | ||
2174 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2175 | |||
2176 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2177 | { | ||
2178 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2179 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2180 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2181 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2182 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2183 | } | ||
2184 | else | ||
2185 | { | ||
2186 | item.BasePermissions = permsBase; | ||
2187 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2188 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2189 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2190 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2191 | } | ||
2192 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2193 | |||
2194 | // sets itemID so client can show item as 'attached' in inventory | ||
2195 | grp.FromItemID = item.ID; | ||
2196 | |||
2197 | if (AddInventoryItem(item)) | ||
2198 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2199 | else | ||
2200 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2201 | |||
2202 | itemID = item.ID; | ||
2203 | return item.AssetID; | ||
2204 | } | ||
2205 | return UUID.Zero; | ||
2206 | } | ||
2207 | |||
2042 | /// <summary> | 2208 | /// <summary> |
2043 | /// Event Handler Rez an object into a scene | 2209 | /// Event Handler Rez an object into a scene |
2044 | /// Calls the non-void event handler | 2210 | /// Calls the non-void event handler |
@@ -2166,6 +2332,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2166 | 2332 | ||
2167 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2333 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2168 | { | 2334 | { |
2335 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2336 | return; | ||
2337 | |||
2169 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2338 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2170 | if (part == null) | 2339 | if (part == null) |
2171 | return; | 2340 | return; |
@@ -2222,7 +2391,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2222 | } | 2391 | } |
2223 | else | 2392 | else |
2224 | { | 2393 | { |
2225 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2394 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2395 | continue; | ||
2396 | |||
2397 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2226 | continue; | 2398 | continue; |
2227 | 2399 | ||
2228 | if (sog.GroupID != groupID) | 2400 | if (sog.GroupID != groupID) |