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 8ddaa60..d2e41f8 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 | ||
@@ -835,6 +830,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
835 | return; | 830 | return; |
836 | } | 831 | } |
837 | 832 | ||
833 | if (newName == null) newName = item.Name; | ||
834 | |||
838 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 835 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
839 | 836 | ||
840 | if (asset != null) | 837 | if (asset != null) |
@@ -895,6 +892,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
895 | } | 892 | } |
896 | 893 | ||
897 | /// <summary> | 894 | /// <summary> |
895 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
896 | /// </summary> | ||
897 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
898 | { | ||
899 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
900 | foreach (InventoryItemBase b in items) | ||
901 | { | ||
902 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
903 | InventoryItemBase n = InventoryService.GetItem(b); | ||
904 | n.Folder = destfolder; | ||
905 | moveitems.Add(n); | ||
906 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
907 | } | ||
908 | |||
909 | MoveInventoryItem(remoteClient, moveitems); | ||
910 | } | ||
911 | |||
912 | /// <summary> | ||
898 | /// Move an item within the agent's inventory. | 913 | /// Move an item within the agent's inventory. |
899 | /// </summary> | 914 | /// </summary> |
900 | /// <param name="remoteClient"></param> | 915 | /// <param name="remoteClient"></param> |
@@ -929,11 +944,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
929 | public void CreateNewInventoryItem( | 944 | public void CreateNewInventoryItem( |
930 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 945 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
931 | string name, string description, uint flags, uint callbackID, | 946 | string name, string description, uint flags, uint callbackID, |
932 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 947 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) |
933 | { | 948 | { |
934 | CreateNewInventoryItem( | 949 | CreateNewInventoryItem( |
935 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 950 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
936 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); | 951 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, transationID); |
952 | } | ||
953 | |||
954 | |||
955 | private void CreateNewInventoryItem( | ||
956 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | ||
957 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | ||
958 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | ||
959 | { | ||
960 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, | ||
961 | name, description, flags, callbackID, asset, invType, | ||
962 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); | ||
937 | } | 963 | } |
938 | 964 | ||
939 | /// <summary> | 965 | /// <summary> |
@@ -958,7 +984,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
958 | private void CreateNewInventoryItem( | 984 | private void CreateNewInventoryItem( |
959 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 985 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
960 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 986 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
961 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 987 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) |
962 | { | 988 | { |
963 | InventoryItemBase item = new InventoryItemBase(); | 989 | InventoryItemBase item = new InventoryItemBase(); |
964 | item.Owner = remoteClient.AgentId; | 990 | item.Owner = remoteClient.AgentId; |
@@ -981,7 +1007,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
981 | 1007 | ||
982 | if (AddInventoryItem(item)) | 1008 | if (AddInventoryItem(item)) |
983 | { | 1009 | { |
984 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 1010 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); |
985 | } | 1011 | } |
986 | else | 1012 | else |
987 | { | 1013 | { |
@@ -1256,6 +1282,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1256 | { | 1282 | { |
1257 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1283 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1258 | 1284 | ||
1285 | // Can't move a null item | ||
1286 | if (itemId == UUID.Zero) | ||
1287 | return; | ||
1288 | |||
1259 | if (null == part) | 1289 | if (null == part) |
1260 | { | 1290 | { |
1261 | m_log.WarnFormat( | 1291 | m_log.WarnFormat( |
@@ -1360,21 +1390,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1360 | return; | 1390 | return; |
1361 | } | 1391 | } |
1362 | 1392 | ||
1363 | if (part.OwnerID != destPart.OwnerID) | 1393 | // Can't transfer this |
1394 | // | ||
1395 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1396 | return; | ||
1397 | |||
1398 | bool overrideNoMod = false; | ||
1399 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1400 | overrideNoMod = true; | ||
1401 | |||
1402 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1364 | { | 1403 | { |
1365 | // Source must have transfer permissions | 1404 | // object cannot copy items to an object owned by a different owner |
1366 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1405 | // unless llAllowInventoryDrop has been called |
1367 | return; | ||
1368 | 1406 | ||
1369 | // Object cannot copy items to an object owned by a different owner | 1407 | return; |
1370 | // unless llAllowInventoryDrop has been called on the destination | ||
1371 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1372 | return; | ||
1373 | } | 1408 | } |
1374 | 1409 | ||
1375 | // must have both move and modify permission to put an item in an object | 1410 | // must have both move and modify permission to put an item in an object |
1376 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1411 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1412 | { | ||
1377 | return; | 1413 | return; |
1414 | } | ||
1378 | 1415 | ||
1379 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1416 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1380 | 1417 | ||
@@ -1430,6 +1467,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1430 | 1467 | ||
1431 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1468 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1432 | { | 1469 | { |
1470 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1471 | if (destPart != null) // Move into a prim | ||
1472 | { | ||
1473 | foreach(UUID itemID in items) | ||
1474 | MoveTaskInventoryItem(destID, host, itemID); | ||
1475 | return destID; // Prim folder ID == prim ID | ||
1476 | } | ||
1477 | |||
1433 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1478 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1434 | 1479 | ||
1435 | UUID newFolderID = UUID.Random(); | 1480 | UUID newFolderID = UUID.Random(); |
@@ -1612,12 +1657,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1612 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1657 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1613 | remoteClient, part, transactionID, currentItem); | 1658 | remoteClient, part, transactionID, currentItem); |
1614 | 1659 | ||
1615 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1660 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1616 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1661 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1617 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1662 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1618 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1663 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1619 | else | 1664 | // else |
1620 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1665 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1621 | } | 1666 | } |
1622 | 1667 | ||
1623 | // Base ALWAYS has move | 1668 | // Base ALWAYS has move |
@@ -1987,23 +2032,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1987 | // build a list of eligible objects | 2032 | // build a list of eligible objects |
1988 | List<uint> deleteIDs = new List<uint>(); | 2033 | List<uint> deleteIDs = new List<uint>(); |
1989 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 2034 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1990 | 2035 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1991 | // Start with true for both, then remove the flags if objects | ||
1992 | // that we can't derez are part of the selection | ||
1993 | bool permissionToTake = true; | ||
1994 | bool permissionToTakeCopy = true; | ||
1995 | bool permissionToDelete = true; | ||
1996 | 2036 | ||
1997 | foreach (uint localID in localIDs) | 2037 | foreach (uint localID in localIDs) |
1998 | { | 2038 | { |
2039 | // Start with true for both, then remove the flags if objects | ||
2040 | // that we can't derez are part of the selection | ||
2041 | bool permissionToTake = true; | ||
2042 | bool permissionToTakeCopy = true; | ||
2043 | bool permissionToDelete = true; | ||
2044 | |||
1999 | // Invalid id | 2045 | // Invalid id |
2000 | SceneObjectPart part = GetSceneObjectPart(localID); | 2046 | SceneObjectPart part = GetSceneObjectPart(localID); |
2001 | if (part == null) | 2047 | if (part == null) |
2048 | { | ||
2049 | //Client still thinks the object exists, kill it | ||
2050 | deleteIDs.Add(localID); | ||
2002 | continue; | 2051 | continue; |
2052 | } | ||
2003 | 2053 | ||
2004 | // Already deleted by someone else | 2054 | // Already deleted by someone else |
2005 | if (part.ParentGroup.IsDeleted) | 2055 | if (part.ParentGroup.IsDeleted) |
2056 | { | ||
2057 | //Client still thinks the object exists, kill it | ||
2058 | deleteIDs.Add(localID); | ||
2006 | continue; | 2059 | continue; |
2060 | } | ||
2007 | 2061 | ||
2008 | // Can't delete child prims | 2062 | // Can't delete child prims |
2009 | if (part != part.ParentGroup.RootPart) | 2063 | if (part != part.ParentGroup.RootPart) |
@@ -2011,8 +2065,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2011 | 2065 | ||
2012 | SceneObjectGroup grp = part.ParentGroup; | 2066 | SceneObjectGroup grp = part.ParentGroup; |
2013 | 2067 | ||
2014 | deleteIDs.Add(localID); | 2068 | // If child prims have invalid perms, fix them |
2015 | deleteGroups.Add(grp); | 2069 | grp.AdjustChildPrimPermissions(); |
2016 | 2070 | ||
2017 | // If child prims have invalid perms, fix them | 2071 | // If child prims have invalid perms, fix them |
2018 | grp.AdjustChildPrimPermissions(); | 2072 | grp.AdjustChildPrimPermissions(); |
@@ -2033,81 +2087,193 @@ namespace OpenSim.Region.Framework.Scenes | |||
2033 | } | 2087 | } |
2034 | else | 2088 | else |
2035 | { | 2089 | { |
2036 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2090 | if (action == DeRezAction.TakeCopy) |
2091 | { | ||
2092 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
2093 | permissionToTakeCopy = false; | ||
2094 | } | ||
2095 | else | ||
2096 | { | ||
2037 | permissionToTakeCopy = false; | 2097 | permissionToTakeCopy = false; |
2038 | 2098 | } | |
2039 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2099 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
2040 | permissionToTake = false; | 2100 | permissionToTake = false; |
2041 | 2101 | ||
2042 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2102 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
2043 | permissionToDelete = false; | 2103 | permissionToDelete = false; |
2044 | } | 2104 | } |
2045 | } | ||
2046 | 2105 | ||
2047 | // Handle god perms | 2106 | // Handle god perms |
2048 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 2107 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
2049 | { | 2108 | { |
2050 | permissionToTake = true; | 2109 | permissionToTake = true; |
2051 | permissionToTakeCopy = true; | 2110 | permissionToTakeCopy = true; |
2052 | permissionToDelete = true; | 2111 | permissionToDelete = true; |
2053 | } | 2112 | } |
2054 | 2113 | ||
2055 | // If we're re-saving, we don't even want to delete | 2114 | // If we're re-saving, we don't even want to delete |
2056 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 2115 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
2057 | permissionToDelete = false; | 2116 | permissionToDelete = false; |
2058 | 2117 | ||
2059 | // if we want to take a copy, we also don't want to delete | 2118 | // if we want to take a copy, we also don't want to delete |
2060 | // Note: after this point, the permissionToTakeCopy flag | 2119 | // Note: after this point, the permissionToTakeCopy flag |
2061 | // becomes irrelevant. It already includes the permissionToTake | 2120 | // becomes irrelevant. It already includes the permissionToTake |
2062 | // permission and after excluding no copy items here, we can | 2121 | // permission and after excluding no copy items here, we can |
2063 | // just use that. | 2122 | // just use that. |
2064 | if (action == DeRezAction.TakeCopy) | 2123 | if (action == DeRezAction.TakeCopy) |
2065 | { | 2124 | { |
2066 | // If we don't have permission, stop right here | 2125 | // If we don't have permission, stop right here |
2067 | if (!permissionToTakeCopy) | 2126 | if (!permissionToTakeCopy) |
2068 | return; | 2127 | return; |
2069 | 2128 | ||
2070 | permissionToTake = true; | 2129 | permissionToTake = true; |
2071 | // Don't delete | 2130 | // Don't delete |
2072 | permissionToDelete = false; | 2131 | permissionToDelete = false; |
2073 | } | 2132 | } |
2074 | 2133 | ||
2075 | if (action == DeRezAction.Return) | 2134 | if (action == DeRezAction.Return) |
2076 | { | ||
2077 | if (remoteClient != null) | ||
2078 | { | 2135 | { |
2079 | if (Permissions.CanReturnObjects( | 2136 | if (remoteClient != null) |
2080 | null, | ||
2081 | remoteClient.AgentId, | ||
2082 | deleteGroups)) | ||
2083 | { | 2137 | { |
2084 | permissionToTake = true; | 2138 | if (Permissions.CanReturnObjects( |
2085 | permissionToDelete = true; | 2139 | null, |
2086 | 2140 | remoteClient.AgentId, | |
2087 | foreach (SceneObjectGroup g in deleteGroups) | 2141 | new List<SceneObjectGroup>() {grp})) |
2088 | { | 2142 | { |
2089 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2143 | permissionToTake = true; |
2144 | permissionToDelete = true; | ||
2145 | |||
2146 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
2090 | } | 2147 | } |
2091 | } | 2148 | } |
2149 | else // Auto return passes through here with null agent | ||
2150 | { | ||
2151 | permissionToTake = true; | ||
2152 | permissionToDelete = true; | ||
2153 | } | ||
2092 | } | 2154 | } |
2093 | else // Auto return passes through here with null agent | 2155 | |
2156 | if (permissionToTake && (!permissionToDelete)) | ||
2157 | takeGroups.Add(grp); | ||
2158 | |||
2159 | if (permissionToDelete) | ||
2094 | { | 2160 | { |
2095 | permissionToTake = true; | 2161 | if (permissionToTake) |
2096 | permissionToDelete = true; | 2162 | deleteGroups.Add(grp); |
2163 | deleteIDs.Add(grp.LocalId); | ||
2097 | } | 2164 | } |
2098 | } | 2165 | } |
2099 | 2166 | ||
2100 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2167 | SendKillObject(deleteIDs); |
2168 | |||
2169 | if (deleteGroups.Count > 0) | ||
2101 | { | 2170 | { |
2171 | foreach (SceneObjectGroup g in deleteGroups) | ||
2172 | deleteIDs.Remove(g.LocalId); | ||
2173 | |||
2102 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2174 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2103 | action, destinationID, deleteGroups, remoteClient, | 2175 | action, destinationID, deleteGroups, remoteClient, |
2104 | permissionToDelete); | 2176 | true); |
2177 | } | ||
2178 | if (takeGroups.Count > 0) | ||
2179 | { | ||
2180 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2181 | action, destinationID, takeGroups, remoteClient, | ||
2182 | false); | ||
2105 | } | 2183 | } |
2106 | else if (permissionToDelete) | 2184 | if (deleteIDs.Count > 0) |
2107 | { | 2185 | { |
2108 | foreach (SceneObjectGroup g in deleteGroups) | 2186 | foreach (SceneObjectGroup g in deleteGroups) |
2109 | DeleteSceneObject(g, false); | 2187 | DeleteSceneObject(g, true); |
2188 | } | ||
2189 | } | ||
2190 | |||
2191 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2192 | { | ||
2193 | itemID = UUID.Zero; | ||
2194 | if (grp != null) | ||
2195 | { | ||
2196 | Vector3 inventoryStoredPosition = new Vector3 | ||
2197 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2198 | ? 250 | ||
2199 | : grp.AbsolutePosition.X) | ||
2200 | , | ||
2201 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2202 | ? 250 | ||
2203 | : grp.AbsolutePosition.X, | ||
2204 | grp.AbsolutePosition.Z); | ||
2205 | |||
2206 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2207 | |||
2208 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2209 | |||
2210 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2211 | |||
2212 | grp.AbsolutePosition = originalPosition; | ||
2213 | |||
2214 | AssetBase asset = CreateAsset( | ||
2215 | grp.GetPartName(grp.LocalId), | ||
2216 | grp.GetPartDescription(grp.LocalId), | ||
2217 | (sbyte)AssetType.Object, | ||
2218 | Utils.StringToBytes(sceneObjectXml), | ||
2219 | remoteClient.AgentId); | ||
2220 | AssetService.Store(asset); | ||
2221 | |||
2222 | InventoryItemBase item = new InventoryItemBase(); | ||
2223 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2224 | item.CreatorData = grp.RootPart.CreatorData; | ||
2225 | item.Owner = remoteClient.AgentId; | ||
2226 | item.ID = UUID.Random(); | ||
2227 | item.AssetID = asset.FullID; | ||
2228 | item.Description = asset.Description; | ||
2229 | item.Name = asset.Name; | ||
2230 | item.AssetType = asset.Type; | ||
2231 | item.InvType = (int)InventoryType.Object; | ||
2232 | |||
2233 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2234 | if (folder != null) | ||
2235 | item.Folder = folder.ID; | ||
2236 | else // oopsies | ||
2237 | item.Folder = UUID.Zero; | ||
2238 | |||
2239 | // Set up base perms properly | ||
2240 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2241 | permsBase &= grp.RootPart.BaseMask; | ||
2242 | permsBase |= (uint)PermissionMask.Move; | ||
2243 | |||
2244 | // Make sure we don't lock it | ||
2245 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2246 | |||
2247 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2248 | { | ||
2249 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2250 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2251 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2252 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2253 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2254 | } | ||
2255 | else | ||
2256 | { | ||
2257 | item.BasePermissions = permsBase; | ||
2258 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2259 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2260 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2261 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2262 | } | ||
2263 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2264 | |||
2265 | // sets itemID so client can show item as 'attached' in inventory | ||
2266 | grp.FromItemID = item.ID; | ||
2267 | |||
2268 | if (AddInventoryItem(item)) | ||
2269 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2270 | else | ||
2271 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2272 | |||
2273 | itemID = item.ID; | ||
2274 | return item.AssetID; | ||
2110 | } | 2275 | } |
2276 | return UUID.Zero; | ||
2111 | } | 2277 | } |
2112 | 2278 | ||
2113 | /// <summary> | 2279 | /// <summary> |
@@ -2237,6 +2403,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2237 | 2403 | ||
2238 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2404 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2239 | { | 2405 | { |
2406 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2407 | return; | ||
2408 | |||
2240 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2409 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2241 | if (part == null) | 2410 | if (part == null) |
2242 | return; | 2411 | return; |
@@ -2293,7 +2462,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2293 | } | 2462 | } |
2294 | else | 2463 | else |
2295 | { | 2464 | { |
2296 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2465 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2466 | continue; | ||
2467 | |||
2468 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2297 | continue; | 2469 | continue; |
2298 | 2470 | ||
2299 | if (sog.GroupID != groupID) | 2471 | if (sog.GroupID != groupID) |
@@ -2405,6 +2577,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2405 | } | 2577 | } |
2406 | 2578 | ||
2407 | m_sceneGraph.LinkObjects(root, children); | 2579 | m_sceneGraph.LinkObjects(root, children); |
2580 | |||
2581 | ScenePresence sp; | ||
2582 | if (TryGetScenePresence(agentId, out sp)) | ||
2583 | { | ||
2584 | root.SendPropertiesToClient(sp.ControllingClient); | ||
2585 | } | ||
2408 | } | 2586 | } |
2409 | 2587 | ||
2410 | private string PermissionString(uint permissions) | 2588 | private string PermissionString(uint permissions) |