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 2ce778d..6a3fb24 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -102,12 +102,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
102 | engine.StartProcessing(); | 102 | engine.StartProcessing(); |
103 | } | 103 | } |
104 | 104 | ||
105 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) | 105 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint cost) |
106 | { | 106 | { |
107 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); | 107 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); |
108 | if (money != null) | 108 | if (money != null) |
109 | { | 109 | { |
110 | money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); | 110 | money.ApplyUploadCharge(agentID, (int)cost, "Asset upload"); |
111 | } | 111 | } |
112 | 112 | ||
113 | AddInventoryItem(item); | 113 | AddInventoryItem(item); |
@@ -170,7 +170,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
170 | return false; | 170 | return false; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | if (InventoryService.AddItem(item)) | 174 | if (InventoryService.AddItem(item)) |
175 | { | 175 | { |
176 | int userlevel = 0; | 176 | int userlevel = 0; |
@@ -325,8 +325,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | 325 | ||
326 | // Update item with new asset | 326 | // Update item with new asset |
327 | item.AssetID = asset.FullID; | 327 | item.AssetID = asset.FullID; |
328 | if (group.UpdateInventoryItem(item)) | 328 | group.UpdateInventoryItem(item); |
329 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
330 | 329 | ||
331 | part.SendPropertiesToClient(remoteClient); | 330 | part.SendPropertiesToClient(remoteClient); |
332 | 331 | ||
@@ -337,12 +336,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
337 | { | 336 | { |
338 | // Needs to determine which engine was running it and use that | 337 | // Needs to determine which engine was running it and use that |
339 | // | 338 | // |
340 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 339 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 1); |
341 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
342 | } | ||
343 | else | ||
344 | { | ||
345 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
346 | } | 340 | } |
347 | 341 | ||
348 | // Tell anyone managing scripts that a script has been reloaded/changed | 342 | // Tell anyone managing scripts that a script has been reloaded/changed |
@@ -408,6 +402,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
408 | if (item.Owner != remoteClient.AgentId) | 402 | if (item.Owner != remoteClient.AgentId) |
409 | return; | 403 | return; |
410 | 404 | ||
405 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); | ||
411 | item.Name = itemUpd.Name; | 406 | item.Name = itemUpd.Name; |
412 | item.Description = itemUpd.Description; | 407 | item.Description = itemUpd.Description; |
413 | 408 | ||
@@ -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.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); | 911 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 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 |
@@ -1947,23 +1992,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1947 | // build a list of eligible objects | 1992 | // build a list of eligible objects |
1948 | List<uint> deleteIDs = new List<uint>(); | 1993 | List<uint> deleteIDs = new List<uint>(); |
1949 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1994 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1950 | 1995 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1951 | // Start with true for both, then remove the flags if objects | ||
1952 | // that we can't derez are part of the selection | ||
1953 | bool permissionToTake = true; | ||
1954 | bool permissionToTakeCopy = true; | ||
1955 | bool permissionToDelete = true; | ||
1956 | 1996 | ||
1957 | foreach (uint localID in localIDs) | 1997 | foreach (uint localID in localIDs) |
1958 | { | 1998 | { |
1999 | // Start with true for both, then remove the flags if objects | ||
2000 | // that we can't derez are part of the selection | ||
2001 | bool permissionToTake = true; | ||
2002 | bool permissionToTakeCopy = true; | ||
2003 | bool permissionToDelete = true; | ||
2004 | |||
1959 | // Invalid id | 2005 | // Invalid id |
1960 | SceneObjectPart part = GetSceneObjectPart(localID); | 2006 | SceneObjectPart part = GetSceneObjectPart(localID); |
1961 | if (part == null) | 2007 | if (part == null) |
2008 | { | ||
2009 | //Client still thinks the object exists, kill it | ||
2010 | deleteIDs.Add(localID); | ||
1962 | continue; | 2011 | continue; |
2012 | } | ||
1963 | 2013 | ||
1964 | // Already deleted by someone else | 2014 | // Already deleted by someone else |
1965 | if (part.ParentGroup.IsDeleted) | 2015 | if (part.ParentGroup.IsDeleted) |
2016 | { | ||
2017 | //Client still thinks the object exists, kill it | ||
2018 | deleteIDs.Add(localID); | ||
1966 | continue; | 2019 | continue; |
2020 | } | ||
1967 | 2021 | ||
1968 | // Can't delete child prims | 2022 | // Can't delete child prims |
1969 | if (part != part.ParentGroup.RootPart) | 2023 | if (part != part.ParentGroup.RootPart) |
@@ -1971,8 +2025,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1971 | 2025 | ||
1972 | SceneObjectGroup grp = part.ParentGroup; | 2026 | SceneObjectGroup grp = part.ParentGroup; |
1973 | 2027 | ||
1974 | deleteIDs.Add(localID); | 2028 | // If child prims have invalid perms, fix them |
1975 | deleteGroups.Add(grp); | 2029 | grp.AdjustChildPrimPermissions(); |
1976 | 2030 | ||
1977 | // If child prims have invalid perms, fix them | 2031 | // If child prims have invalid perms, fix them |
1978 | grp.AdjustChildPrimPermissions(); | 2032 | grp.AdjustChildPrimPermissions(); |
@@ -1993,81 +2047,193 @@ namespace OpenSim.Region.Framework.Scenes | |||
1993 | } | 2047 | } |
1994 | else | 2048 | else |
1995 | { | 2049 | { |
1996 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2050 | if (action == DeRezAction.TakeCopy) |
2051 | { | ||
2052 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
2053 | permissionToTakeCopy = false; | ||
2054 | } | ||
2055 | else | ||
2056 | { | ||
1997 | permissionToTakeCopy = false; | 2057 | permissionToTakeCopy = false; |
1998 | 2058 | } | |
1999 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2059 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
2000 | permissionToTake = false; | 2060 | permissionToTake = false; |
2001 | 2061 | ||
2002 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2062 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
2003 | permissionToDelete = false; | 2063 | permissionToDelete = false; |
2004 | } | 2064 | } |
2005 | } | ||
2006 | 2065 | ||
2007 | // Handle god perms | 2066 | // Handle god perms |
2008 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 2067 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
2009 | { | 2068 | { |
2010 | permissionToTake = true; | 2069 | permissionToTake = true; |
2011 | permissionToTakeCopy = true; | 2070 | permissionToTakeCopy = true; |
2012 | permissionToDelete = true; | 2071 | permissionToDelete = true; |
2013 | } | 2072 | } |
2014 | 2073 | ||
2015 | // If we're re-saving, we don't even want to delete | 2074 | // If we're re-saving, we don't even want to delete |
2016 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 2075 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
2017 | permissionToDelete = false; | 2076 | permissionToDelete = false; |
2018 | 2077 | ||
2019 | // if we want to take a copy, we also don't want to delete | 2078 | // if we want to take a copy, we also don't want to delete |
2020 | // Note: after this point, the permissionToTakeCopy flag | 2079 | // Note: after this point, the permissionToTakeCopy flag |
2021 | // becomes irrelevant. It already includes the permissionToTake | 2080 | // becomes irrelevant. It already includes the permissionToTake |
2022 | // permission and after excluding no copy items here, we can | 2081 | // permission and after excluding no copy items here, we can |
2023 | // just use that. | 2082 | // just use that. |
2024 | if (action == DeRezAction.TakeCopy) | 2083 | if (action == DeRezAction.TakeCopy) |
2025 | { | 2084 | { |
2026 | // If we don't have permission, stop right here | 2085 | // If we don't have permission, stop right here |
2027 | if (!permissionToTakeCopy) | 2086 | if (!permissionToTakeCopy) |
2028 | return; | 2087 | return; |
2029 | 2088 | ||
2030 | permissionToTake = true; | 2089 | permissionToTake = true; |
2031 | // Don't delete | 2090 | // Don't delete |
2032 | permissionToDelete = false; | 2091 | permissionToDelete = false; |
2033 | } | 2092 | } |
2034 | 2093 | ||
2035 | if (action == DeRezAction.Return) | 2094 | if (action == DeRezAction.Return) |
2036 | { | ||
2037 | if (remoteClient != null) | ||
2038 | { | 2095 | { |
2039 | if (Permissions.CanReturnObjects( | 2096 | if (remoteClient != null) |
2040 | null, | ||
2041 | remoteClient.AgentId, | ||
2042 | deleteGroups)) | ||
2043 | { | 2097 | { |
2044 | permissionToTake = true; | 2098 | if (Permissions.CanReturnObjects( |
2045 | permissionToDelete = true; | 2099 | null, |
2046 | 2100 | remoteClient.AgentId, | |
2047 | foreach (SceneObjectGroup g in deleteGroups) | 2101 | new List<SceneObjectGroup>() {grp})) |
2048 | { | 2102 | { |
2049 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2103 | permissionToTake = true; |
2104 | permissionToDelete = true; | ||
2105 | |||
2106 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
2050 | } | 2107 | } |
2051 | } | 2108 | } |
2109 | else // Auto return passes through here with null agent | ||
2110 | { | ||
2111 | permissionToTake = true; | ||
2112 | permissionToDelete = true; | ||
2113 | } | ||
2052 | } | 2114 | } |
2053 | else // Auto return passes through here with null agent | 2115 | |
2116 | if (permissionToTake && (!permissionToDelete)) | ||
2117 | takeGroups.Add(grp); | ||
2118 | |||
2119 | if (permissionToDelete) | ||
2054 | { | 2120 | { |
2055 | permissionToTake = true; | 2121 | if (permissionToTake) |
2056 | permissionToDelete = true; | 2122 | deleteGroups.Add(grp); |
2123 | deleteIDs.Add(grp.LocalId); | ||
2057 | } | 2124 | } |
2058 | } | 2125 | } |
2059 | 2126 | ||
2060 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2127 | SendKillObject(deleteIDs); |
2128 | |||
2129 | if (deleteGroups.Count > 0) | ||
2061 | { | 2130 | { |
2131 | foreach (SceneObjectGroup g in deleteGroups) | ||
2132 | deleteIDs.Remove(g.LocalId); | ||
2133 | |||
2062 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2134 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2063 | action, destinationID, deleteGroups, remoteClient, | 2135 | action, destinationID, deleteGroups, remoteClient, |
2064 | permissionToDelete); | 2136 | true); |
2137 | } | ||
2138 | if (takeGroups.Count > 0) | ||
2139 | { | ||
2140 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2141 | action, destinationID, takeGroups, remoteClient, | ||
2142 | false); | ||
2065 | } | 2143 | } |
2066 | else if (permissionToDelete) | 2144 | if (deleteIDs.Count > 0) |
2067 | { | 2145 | { |
2068 | foreach (SceneObjectGroup g in deleteGroups) | 2146 | foreach (SceneObjectGroup g in deleteGroups) |
2069 | DeleteSceneObject(g, false); | 2147 | DeleteSceneObject(g, true); |
2148 | } | ||
2149 | } | ||
2150 | |||
2151 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2152 | { | ||
2153 | itemID = UUID.Zero; | ||
2154 | if (grp != null) | ||
2155 | { | ||
2156 | Vector3 inventoryStoredPosition = new Vector3 | ||
2157 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2158 | ? 250 | ||
2159 | : grp.AbsolutePosition.X) | ||
2160 | , | ||
2161 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2162 | ? 250 | ||
2163 | : grp.AbsolutePosition.X, | ||
2164 | grp.AbsolutePosition.Z); | ||
2165 | |||
2166 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2167 | |||
2168 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2169 | |||
2170 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2171 | |||
2172 | grp.AbsolutePosition = originalPosition; | ||
2173 | |||
2174 | AssetBase asset = CreateAsset( | ||
2175 | grp.GetPartName(grp.LocalId), | ||
2176 | grp.GetPartDescription(grp.LocalId), | ||
2177 | (sbyte)AssetType.Object, | ||
2178 | Utils.StringToBytes(sceneObjectXml), | ||
2179 | remoteClient.AgentId); | ||
2180 | AssetService.Store(asset); | ||
2181 | |||
2182 | InventoryItemBase item = new InventoryItemBase(); | ||
2183 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2184 | item.CreatorData = grp.RootPart.CreatorData; | ||
2185 | item.Owner = remoteClient.AgentId; | ||
2186 | item.ID = UUID.Random(); | ||
2187 | item.AssetID = asset.FullID; | ||
2188 | item.Description = asset.Description; | ||
2189 | item.Name = asset.Name; | ||
2190 | item.AssetType = asset.Type; | ||
2191 | item.InvType = (int)InventoryType.Object; | ||
2192 | |||
2193 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2194 | if (folder != null) | ||
2195 | item.Folder = folder.ID; | ||
2196 | else // oopsies | ||
2197 | item.Folder = UUID.Zero; | ||
2198 | |||
2199 | // Set up base perms properly | ||
2200 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2201 | permsBase &= grp.RootPart.BaseMask; | ||
2202 | permsBase |= (uint)PermissionMask.Move; | ||
2203 | |||
2204 | // Make sure we don't lock it | ||
2205 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2206 | |||
2207 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2208 | { | ||
2209 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2210 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2211 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2212 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2213 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2214 | } | ||
2215 | else | ||
2216 | { | ||
2217 | item.BasePermissions = permsBase; | ||
2218 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2219 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2220 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2221 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2222 | } | ||
2223 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2224 | |||
2225 | // sets itemID so client can show item as 'attached' in inventory | ||
2226 | grp.FromItemID = item.ID; | ||
2227 | |||
2228 | if (AddInventoryItem(item)) | ||
2229 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2230 | else | ||
2231 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2232 | |||
2233 | itemID = item.ID; | ||
2234 | return item.AssetID; | ||
2070 | } | 2235 | } |
2236 | return UUID.Zero; | ||
2071 | } | 2237 | } |
2072 | 2238 | ||
2073 | /// <summary> | 2239 | /// <summary> |
@@ -2197,6 +2363,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2197 | 2363 | ||
2198 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2364 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2199 | { | 2365 | { |
2366 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2367 | return; | ||
2368 | |||
2200 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2369 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2201 | if (part == null) | 2370 | if (part == null) |
2202 | return; | 2371 | return; |
@@ -2253,7 +2422,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2253 | } | 2422 | } |
2254 | else | 2423 | else |
2255 | { | 2424 | { |
2256 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2425 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2426 | continue; | ||
2427 | |||
2428 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2257 | continue; | 2429 | continue; |
2258 | 2430 | ||
2259 | if (sog.GroupID != groupID) | 2431 | if (sog.GroupID != groupID) |
@@ -2365,6 +2537,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2365 | } | 2537 | } |
2366 | 2538 | ||
2367 | m_sceneGraph.LinkObjects(root, children); | 2539 | m_sceneGraph.LinkObjects(root, children); |
2540 | |||
2541 | ScenePresence sp; | ||
2542 | if (TryGetScenePresence(agentId, out sp)) | ||
2543 | { | ||
2544 | root.SendPropertiesToClient(sp.ControllingClient); | ||
2545 | } | ||
2368 | } | 2546 | } |
2369 | 2547 | ||
2370 | private string PermissionString(uint permissions) | 2548 | private string PermissionString(uint permissions) |