diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 348 |
1 files changed, 263 insertions, 85 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 92bf85a..9f0a0e2 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, 1); |
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 | ||
@@ -793,6 +788,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
793 | return; | 788 | return; |
794 | } | 789 | } |
795 | 790 | ||
791 | if (newName == null) newName = item.Name; | ||
792 | |||
796 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 793 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
797 | 794 | ||
798 | if (asset != null) | 795 | if (asset != null) |
@@ -853,6 +850,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | } | 850 | } |
854 | 851 | ||
855 | /// <summary> | 852 | /// <summary> |
853 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
854 | /// </summary> | ||
855 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
856 | { | ||
857 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
858 | foreach (InventoryItemBase b in items) | ||
859 | { | ||
860 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
861 | InventoryItemBase n = InventoryService.GetItem(b); | ||
862 | n.Folder = destfolder; | ||
863 | moveitems.Add(n); | ||
864 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
865 | } | ||
866 | |||
867 | MoveInventoryItem(remoteClient, moveitems); | ||
868 | } | ||
869 | |||
870 | /// <summary> | ||
856 | /// Move an item within the agent's inventory. | 871 | /// Move an item within the agent's inventory. |
857 | /// </summary> | 872 | /// </summary> |
858 | /// <param name="remoteClient"></param> | 873 | /// <param name="remoteClient"></param> |
@@ -887,11 +902,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
887 | public void CreateNewInventoryItem( | 902 | public void CreateNewInventoryItem( |
888 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 903 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
889 | string name, string description, uint flags, uint callbackID, | 904 | string name, string description, uint flags, uint callbackID, |
890 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 905 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) |
891 | { | 906 | { |
892 | CreateNewInventoryItem( | 907 | CreateNewInventoryItem( |
893 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 908 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
894 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); | 909 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate, transationID); |
910 | } | ||
911 | |||
912 | |||
913 | private void CreateNewInventoryItem( | ||
914 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | ||
915 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | ||
916 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | ||
917 | { | ||
918 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, | ||
919 | name, description, flags, callbackID, asset, invType, | ||
920 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); | ||
895 | } | 921 | } |
896 | 922 | ||
897 | /// <summary> | 923 | /// <summary> |
@@ -916,7 +942,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
916 | private void CreateNewInventoryItem( | 942 | private void CreateNewInventoryItem( |
917 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 943 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
918 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 944 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
919 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 945 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) |
920 | { | 946 | { |
921 | InventoryItemBase item = new InventoryItemBase(); | 947 | InventoryItemBase item = new InventoryItemBase(); |
922 | item.Owner = remoteClient.AgentId; | 948 | item.Owner = remoteClient.AgentId; |
@@ -939,7 +965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
939 | 965 | ||
940 | if (AddInventoryItem(item)) | 966 | if (AddInventoryItem(item)) |
941 | { | 967 | { |
942 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 968 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); |
943 | } | 969 | } |
944 | else | 970 | else |
945 | { | 971 | { |
@@ -1214,6 +1240,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1214 | { | 1240 | { |
1215 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1241 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1216 | 1242 | ||
1243 | // Can't move a null item | ||
1244 | if (itemId == UUID.Zero) | ||
1245 | return; | ||
1246 | |||
1217 | if (null == part) | 1247 | if (null == part) |
1218 | { | 1248 | { |
1219 | m_log.WarnFormat( | 1249 | m_log.WarnFormat( |
@@ -1318,21 +1348,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1318 | return; | 1348 | return; |
1319 | } | 1349 | } |
1320 | 1350 | ||
1321 | if (part.OwnerID != destPart.OwnerID) | 1351 | // Can't transfer this |
1352 | // | ||
1353 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1354 | return; | ||
1355 | |||
1356 | bool overrideNoMod = false; | ||
1357 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1358 | overrideNoMod = true; | ||
1359 | |||
1360 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1322 | { | 1361 | { |
1323 | // Source must have transfer permissions | 1362 | // object cannot copy items to an object owned by a different owner |
1324 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1363 | // unless llAllowInventoryDrop has been called |
1325 | return; | ||
1326 | 1364 | ||
1327 | // Object cannot copy items to an object owned by a different owner | 1365 | return; |
1328 | // unless llAllowInventoryDrop has been called on the destination | ||
1329 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1330 | return; | ||
1331 | } | 1366 | } |
1332 | 1367 | ||
1333 | // must have both move and modify permission to put an item in an object | 1368 | // must have both move and modify permission to put an item in an object |
1334 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1369 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1370 | { | ||
1335 | return; | 1371 | return; |
1372 | } | ||
1336 | 1373 | ||
1337 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1374 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1338 | 1375 | ||
@@ -1388,6 +1425,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1388 | 1425 | ||
1389 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1426 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1390 | { | 1427 | { |
1428 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1429 | if (destPart != null) // Move into a prim | ||
1430 | { | ||
1431 | foreach(UUID itemID in items) | ||
1432 | MoveTaskInventoryItem(destID, host, itemID); | ||
1433 | return destID; // Prim folder ID == prim ID | ||
1434 | } | ||
1435 | |||
1391 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1436 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1392 | 1437 | ||
1393 | UUID newFolderID = UUID.Random(); | 1438 | UUID newFolderID = UUID.Random(); |
@@ -1570,12 +1615,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1570 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1615 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1571 | remoteClient, part, transactionID, currentItem); | 1616 | remoteClient, part, transactionID, currentItem); |
1572 | 1617 | ||
1573 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1618 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1574 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1619 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1575 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1620 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1576 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1621 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1577 | else | 1622 | // else |
1578 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1623 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1579 | } | 1624 | } |
1580 | 1625 | ||
1581 | // Base ALWAYS has move | 1626 | // Base ALWAYS has move |
@@ -1945,23 +1990,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1945 | // build a list of eligible objects | 1990 | // build a list of eligible objects |
1946 | List<uint> deleteIDs = new List<uint>(); | 1991 | List<uint> deleteIDs = new List<uint>(); |
1947 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1992 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1948 | 1993 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1949 | // Start with true for both, then remove the flags if objects | ||
1950 | // that we can't derez are part of the selection | ||
1951 | bool permissionToTake = true; | ||
1952 | bool permissionToTakeCopy = true; | ||
1953 | bool permissionToDelete = true; | ||
1954 | 1994 | ||
1955 | foreach (uint localID in localIDs) | 1995 | foreach (uint localID in localIDs) |
1956 | { | 1996 | { |
1997 | // Start with true for both, then remove the flags if objects | ||
1998 | // that we can't derez are part of the selection | ||
1999 | bool permissionToTake = true; | ||
2000 | bool permissionToTakeCopy = true; | ||
2001 | bool permissionToDelete = true; | ||
2002 | |||
1957 | // Invalid id | 2003 | // Invalid id |
1958 | SceneObjectPart part = GetSceneObjectPart(localID); | 2004 | SceneObjectPart part = GetSceneObjectPart(localID); |
1959 | if (part == null) | 2005 | if (part == null) |
2006 | { | ||
2007 | //Client still thinks the object exists, kill it | ||
2008 | deleteIDs.Add(localID); | ||
1960 | continue; | 2009 | continue; |
2010 | } | ||
1961 | 2011 | ||
1962 | // Already deleted by someone else | 2012 | // Already deleted by someone else |
1963 | if (part.ParentGroup.IsDeleted) | 2013 | if (part.ParentGroup.IsDeleted) |
2014 | { | ||
2015 | //Client still thinks the object exists, kill it | ||
2016 | deleteIDs.Add(localID); | ||
1964 | continue; | 2017 | continue; |
2018 | } | ||
1965 | 2019 | ||
1966 | // Can't delete child prims | 2020 | // Can't delete child prims |
1967 | if (part != part.ParentGroup.RootPart) | 2021 | if (part != part.ParentGroup.RootPart) |
@@ -1969,8 +2023,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1969 | 2023 | ||
1970 | SceneObjectGroup grp = part.ParentGroup; | 2024 | SceneObjectGroup grp = part.ParentGroup; |
1971 | 2025 | ||
1972 | deleteIDs.Add(localID); | 2026 | // If child prims have invalid perms, fix them |
1973 | deleteGroups.Add(grp); | 2027 | grp.AdjustChildPrimPermissions(); |
1974 | 2028 | ||
1975 | // If child prims have invalid perms, fix them | 2029 | // If child prims have invalid perms, fix them |
1976 | grp.AdjustChildPrimPermissions(); | 2030 | grp.AdjustChildPrimPermissions(); |
@@ -1991,81 +2045,193 @@ namespace OpenSim.Region.Framework.Scenes | |||
1991 | } | 2045 | } |
1992 | else | 2046 | else |
1993 | { | 2047 | { |
1994 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2048 | if (action == DeRezAction.TakeCopy) |
2049 | { | ||
2050 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
2051 | permissionToTakeCopy = false; | ||
2052 | } | ||
2053 | else | ||
2054 | { | ||
1995 | permissionToTakeCopy = false; | 2055 | permissionToTakeCopy = false; |
1996 | 2056 | } | |
1997 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2057 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1998 | permissionToTake = false; | 2058 | permissionToTake = false; |
1999 | 2059 | ||
2000 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2060 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
2001 | permissionToDelete = false; | 2061 | permissionToDelete = false; |
2002 | } | 2062 | } |
2003 | } | ||
2004 | 2063 | ||
2005 | // Handle god perms | 2064 | // Handle god perms |
2006 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 2065 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
2007 | { | 2066 | { |
2008 | permissionToTake = true; | 2067 | permissionToTake = true; |
2009 | permissionToTakeCopy = true; | 2068 | permissionToTakeCopy = true; |
2010 | permissionToDelete = true; | 2069 | permissionToDelete = true; |
2011 | } | 2070 | } |
2012 | 2071 | ||
2013 | // If we're re-saving, we don't even want to delete | 2072 | // If we're re-saving, we don't even want to delete |
2014 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 2073 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
2015 | permissionToDelete = false; | 2074 | permissionToDelete = false; |
2016 | 2075 | ||
2017 | // if we want to take a copy, we also don't want to delete | 2076 | // if we want to take a copy, we also don't want to delete |
2018 | // Note: after this point, the permissionToTakeCopy flag | 2077 | // Note: after this point, the permissionToTakeCopy flag |
2019 | // becomes irrelevant. It already includes the permissionToTake | 2078 | // becomes irrelevant. It already includes the permissionToTake |
2020 | // permission and after excluding no copy items here, we can | 2079 | // permission and after excluding no copy items here, we can |
2021 | // just use that. | 2080 | // just use that. |
2022 | if (action == DeRezAction.TakeCopy) | 2081 | if (action == DeRezAction.TakeCopy) |
2023 | { | 2082 | { |
2024 | // If we don't have permission, stop right here | 2083 | // If we don't have permission, stop right here |
2025 | if (!permissionToTakeCopy) | 2084 | if (!permissionToTakeCopy) |
2026 | return; | 2085 | return; |
2027 | 2086 | ||
2028 | permissionToTake = true; | 2087 | permissionToTake = true; |
2029 | // Don't delete | 2088 | // Don't delete |
2030 | permissionToDelete = false; | 2089 | permissionToDelete = false; |
2031 | } | 2090 | } |
2032 | 2091 | ||
2033 | if (action == DeRezAction.Return) | 2092 | if (action == DeRezAction.Return) |
2034 | { | ||
2035 | if (remoteClient != null) | ||
2036 | { | 2093 | { |
2037 | if (Permissions.CanReturnObjects( | 2094 | if (remoteClient != null) |
2038 | null, | ||
2039 | remoteClient.AgentId, | ||
2040 | deleteGroups)) | ||
2041 | { | 2095 | { |
2042 | permissionToTake = true; | 2096 | if (Permissions.CanReturnObjects( |
2043 | permissionToDelete = true; | 2097 | null, |
2044 | 2098 | remoteClient.AgentId, | |
2045 | foreach (SceneObjectGroup g in deleteGroups) | 2099 | new List<SceneObjectGroup>() {grp})) |
2046 | { | 2100 | { |
2047 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2101 | permissionToTake = true; |
2102 | permissionToDelete = true; | ||
2103 | |||
2104 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
2048 | } | 2105 | } |
2049 | } | 2106 | } |
2107 | else // Auto return passes through here with null agent | ||
2108 | { | ||
2109 | permissionToTake = true; | ||
2110 | permissionToDelete = true; | ||
2111 | } | ||
2050 | } | 2112 | } |
2051 | else // Auto return passes through here with null agent | 2113 | |
2114 | if (permissionToTake && (!permissionToDelete)) | ||
2115 | takeGroups.Add(grp); | ||
2116 | |||
2117 | if (permissionToDelete) | ||
2052 | { | 2118 | { |
2053 | permissionToTake = true; | 2119 | if (permissionToTake) |
2054 | permissionToDelete = true; | 2120 | deleteGroups.Add(grp); |
2121 | deleteIDs.Add(grp.LocalId); | ||
2055 | } | 2122 | } |
2056 | } | 2123 | } |
2057 | 2124 | ||
2058 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2125 | SendKillObject(deleteIDs); |
2126 | |||
2127 | if (deleteGroups.Count > 0) | ||
2059 | { | 2128 | { |
2129 | foreach (SceneObjectGroup g in deleteGroups) | ||
2130 | deleteIDs.Remove(g.LocalId); | ||
2131 | |||
2060 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2132 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2061 | action, destinationID, deleteGroups, remoteClient, | 2133 | action, destinationID, deleteGroups, remoteClient, |
2062 | permissionToDelete); | 2134 | true); |
2135 | } | ||
2136 | if (takeGroups.Count > 0) | ||
2137 | { | ||
2138 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2139 | action, destinationID, takeGroups, remoteClient, | ||
2140 | false); | ||
2063 | } | 2141 | } |
2064 | else if (permissionToDelete) | 2142 | if (deleteIDs.Count > 0) |
2065 | { | 2143 | { |
2066 | foreach (SceneObjectGroup g in deleteGroups) | 2144 | foreach (SceneObjectGroup g in deleteGroups) |
2067 | DeleteSceneObject(g, false); | 2145 | DeleteSceneObject(g, true); |
2146 | } | ||
2147 | } | ||
2148 | |||
2149 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2150 | { | ||
2151 | itemID = UUID.Zero; | ||
2152 | if (grp != null) | ||
2153 | { | ||
2154 | Vector3 inventoryStoredPosition = new Vector3 | ||
2155 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2156 | ? 250 | ||
2157 | : grp.AbsolutePosition.X) | ||
2158 | , | ||
2159 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2160 | ? 250 | ||
2161 | : grp.AbsolutePosition.X, | ||
2162 | grp.AbsolutePosition.Z); | ||
2163 | |||
2164 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2165 | |||
2166 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2167 | |||
2168 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2169 | |||
2170 | grp.AbsolutePosition = originalPosition; | ||
2171 | |||
2172 | AssetBase asset = CreateAsset( | ||
2173 | grp.GetPartName(grp.LocalId), | ||
2174 | grp.GetPartDescription(grp.LocalId), | ||
2175 | (sbyte)AssetType.Object, | ||
2176 | Utils.StringToBytes(sceneObjectXml), | ||
2177 | remoteClient.AgentId); | ||
2178 | AssetService.Store(asset); | ||
2179 | |||
2180 | InventoryItemBase item = new InventoryItemBase(); | ||
2181 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2182 | item.CreatorData = grp.RootPart.CreatorData; | ||
2183 | item.Owner = remoteClient.AgentId; | ||
2184 | item.ID = UUID.Random(); | ||
2185 | item.AssetID = asset.FullID; | ||
2186 | item.Description = asset.Description; | ||
2187 | item.Name = asset.Name; | ||
2188 | item.AssetType = asset.Type; | ||
2189 | item.InvType = (int)InventoryType.Object; | ||
2190 | |||
2191 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2192 | if (folder != null) | ||
2193 | item.Folder = folder.ID; | ||
2194 | else // oopsies | ||
2195 | item.Folder = UUID.Zero; | ||
2196 | |||
2197 | // Set up base perms properly | ||
2198 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2199 | permsBase &= grp.RootPart.BaseMask; | ||
2200 | permsBase |= (uint)PermissionMask.Move; | ||
2201 | |||
2202 | // Make sure we don't lock it | ||
2203 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2204 | |||
2205 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2206 | { | ||
2207 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2208 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2209 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2210 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2211 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2212 | } | ||
2213 | else | ||
2214 | { | ||
2215 | item.BasePermissions = permsBase; | ||
2216 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2217 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2218 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2219 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2220 | } | ||
2221 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2222 | |||
2223 | // sets itemID so client can show item as 'attached' in inventory | ||
2224 | grp.FromItemID = item.ID; | ||
2225 | |||
2226 | if (AddInventoryItem(item)) | ||
2227 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2228 | else | ||
2229 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2230 | |||
2231 | itemID = item.ID; | ||
2232 | return item.AssetID; | ||
2068 | } | 2233 | } |
2234 | return UUID.Zero; | ||
2069 | } | 2235 | } |
2070 | 2236 | ||
2071 | /// <summary> | 2237 | /// <summary> |
@@ -2195,6 +2361,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2195 | 2361 | ||
2196 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2362 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2197 | { | 2363 | { |
2364 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2365 | return; | ||
2366 | |||
2198 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2367 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2199 | if (part == null) | 2368 | if (part == null) |
2200 | return; | 2369 | return; |
@@ -2251,7 +2420,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2251 | } | 2420 | } |
2252 | else | 2421 | else |
2253 | { | 2422 | { |
2254 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2423 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2424 | continue; | ||
2425 | |||
2426 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2255 | continue; | 2427 | continue; |
2256 | 2428 | ||
2257 | if (sog.GroupID != groupID) | 2429 | if (sog.GroupID != groupID) |
@@ -2363,6 +2535,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2363 | } | 2535 | } |
2364 | 2536 | ||
2365 | m_sceneGraph.LinkObjects(root, children); | 2537 | m_sceneGraph.LinkObjects(root, children); |
2538 | |||
2539 | ScenePresence sp; | ||
2540 | if (TryGetScenePresence(agentId, out sp)) | ||
2541 | { | ||
2542 | root.SendPropertiesToClient(sp.ControllingClient); | ||
2543 | } | ||
2366 | } | 2544 | } |
2367 | 2545 | ||
2368 | private string PermissionString(uint permissions) | 2546 | private string PermissionString(uint permissions) |