diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 352 |
1 files changed, 265 insertions, 87 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c4b07a5..4337b5a 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.SendAlertMessage("Script saved"); | ||
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.SendAlertMessage("Script saved"); | ||
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 | ||
@@ -853,6 +848,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | return; | 848 | return; |
854 | } | 849 | } |
855 | 850 | ||
851 | if (newName == null) newName = item.Name; | ||
852 | |||
856 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 853 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
857 | 854 | ||
858 | if (asset != null) | 855 | if (asset != null) |
@@ -913,6 +910,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
913 | } | 910 | } |
914 | 911 | ||
915 | /// <summary> | 912 | /// <summary> |
913 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
914 | /// </summary> | ||
915 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
916 | { | ||
917 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
918 | foreach (InventoryItemBase b in items) | ||
919 | { | ||
920 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
921 | InventoryItemBase n = InventoryService.GetItem(b); | ||
922 | n.Folder = destfolder; | ||
923 | moveitems.Add(n); | ||
924 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
925 | } | ||
926 | |||
927 | MoveInventoryItem(remoteClient, moveitems); | ||
928 | } | ||
929 | |||
930 | /// <summary> | ||
916 | /// Move an item within the agent's inventory. | 931 | /// Move an item within the agent's inventory. |
917 | /// </summary> | 932 | /// </summary> |
918 | /// <param name="remoteClient"></param> | 933 | /// <param name="remoteClient"></param> |
@@ -947,11 +962,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
947 | public void CreateNewInventoryItem( | 962 | public void CreateNewInventoryItem( |
948 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 963 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
949 | string name, string description, uint flags, uint callbackID, | 964 | string name, string description, uint flags, uint callbackID, |
950 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 965 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) |
951 | { | 966 | { |
952 | CreateNewInventoryItem( | 967 | CreateNewInventoryItem( |
953 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 968 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
954 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); | 969 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, transationID); |
970 | } | ||
971 | |||
972 | |||
973 | private void CreateNewInventoryItem( | ||
974 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | ||
975 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | ||
976 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | ||
977 | { | ||
978 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, | ||
979 | name, description, flags, callbackID, asset, invType, | ||
980 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); | ||
955 | } | 981 | } |
956 | 982 | ||
957 | /// <summary> | 983 | /// <summary> |
@@ -976,7 +1002,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
976 | private void CreateNewInventoryItem( | 1002 | private void CreateNewInventoryItem( |
977 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 1003 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
978 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 1004 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
979 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 1005 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) |
980 | { | 1006 | { |
981 | InventoryItemBase item = new InventoryItemBase(); | 1007 | InventoryItemBase item = new InventoryItemBase(); |
982 | item.Owner = remoteClient.AgentId; | 1008 | item.Owner = remoteClient.AgentId; |
@@ -999,7 +1025,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
999 | 1025 | ||
1000 | if (AddInventoryItem(item)) | 1026 | if (AddInventoryItem(item)) |
1001 | { | 1027 | { |
1002 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 1028 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); |
1003 | } | 1029 | } |
1004 | else | 1030 | else |
1005 | { | 1031 | { |
@@ -1274,6 +1300,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1274 | { | 1300 | { |
1275 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1301 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1276 | 1302 | ||
1303 | // Can't move a null item | ||
1304 | if (itemId == UUID.Zero) | ||
1305 | return; | ||
1306 | |||
1277 | if (null == part) | 1307 | if (null == part) |
1278 | { | 1308 | { |
1279 | m_log.WarnFormat( | 1309 | m_log.WarnFormat( |
@@ -1378,21 +1408,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1378 | return; | 1408 | return; |
1379 | } | 1409 | } |
1380 | 1410 | ||
1381 | if (part.OwnerID != destPart.OwnerID) | 1411 | // Can't transfer this |
1412 | // | ||
1413 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1414 | return; | ||
1415 | |||
1416 | bool overrideNoMod = false; | ||
1417 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1418 | overrideNoMod = true; | ||
1419 | |||
1420 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1382 | { | 1421 | { |
1383 | // Source must have transfer permissions | 1422 | // object cannot copy items to an object owned by a different owner |
1384 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1423 | // unless llAllowInventoryDrop has been called |
1385 | return; | ||
1386 | 1424 | ||
1387 | // Object cannot copy items to an object owned by a different owner | 1425 | return; |
1388 | // unless llAllowInventoryDrop has been called on the destination | ||
1389 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1390 | return; | ||
1391 | } | 1426 | } |
1392 | 1427 | ||
1393 | // must have both move and modify permission to put an item in an object | 1428 | // must have both move and modify permission to put an item in an object |
1394 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1429 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1430 | { | ||
1395 | return; | 1431 | return; |
1432 | } | ||
1396 | 1433 | ||
1397 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1434 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1398 | 1435 | ||
@@ -1448,6 +1485,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1448 | 1485 | ||
1449 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1486 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1450 | { | 1487 | { |
1488 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1489 | if (destPart != null) // Move into a prim | ||
1490 | { | ||
1491 | foreach(UUID itemID in items) | ||
1492 | MoveTaskInventoryItem(destID, host, itemID); | ||
1493 | return destID; // Prim folder ID == prim ID | ||
1494 | } | ||
1495 | |||
1451 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1496 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1452 | 1497 | ||
1453 | UUID newFolderID = UUID.Random(); | 1498 | UUID newFolderID = UUID.Random(); |
@@ -1630,12 +1675,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1630 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1675 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1631 | remoteClient, part, transactionID, currentItem); | 1676 | remoteClient, part, transactionID, currentItem); |
1632 | 1677 | ||
1633 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1678 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1634 | remoteClient.SendAlertMessage("Notecard saved"); | 1679 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1635 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1680 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1636 | remoteClient.SendAlertMessage("Script saved"); | 1681 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1637 | else | 1682 | // else |
1638 | remoteClient.SendAlertMessage("Item saved"); | 1683 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1639 | } | 1684 | } |
1640 | 1685 | ||
1641 | // Base ALWAYS has move | 1686 | // Base ALWAYS has move |
@@ -2005,23 +2050,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
2005 | // build a list of eligible objects | 2050 | // build a list of eligible objects |
2006 | List<uint> deleteIDs = new List<uint>(); | 2051 | List<uint> deleteIDs = new List<uint>(); |
2007 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 2052 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
2008 | 2053 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
2009 | // Start with true for both, then remove the flags if objects | ||
2010 | // that we can't derez are part of the selection | ||
2011 | bool permissionToTake = true; | ||
2012 | bool permissionToTakeCopy = true; | ||
2013 | bool permissionToDelete = true; | ||
2014 | 2054 | ||
2015 | foreach (uint localID in localIDs) | 2055 | foreach (uint localID in localIDs) |
2016 | { | 2056 | { |
2057 | // Start with true for both, then remove the flags if objects | ||
2058 | // that we can't derez are part of the selection | ||
2059 | bool permissionToTake = true; | ||
2060 | bool permissionToTakeCopy = true; | ||
2061 | bool permissionToDelete = true; | ||
2062 | |||
2017 | // Invalid id | 2063 | // Invalid id |
2018 | SceneObjectPart part = GetSceneObjectPart(localID); | 2064 | SceneObjectPart part = GetSceneObjectPart(localID); |
2019 | if (part == null) | 2065 | if (part == null) |
2066 | { | ||
2067 | //Client still thinks the object exists, kill it | ||
2068 | deleteIDs.Add(localID); | ||
2020 | continue; | 2069 | continue; |
2070 | } | ||
2021 | 2071 | ||
2022 | // Already deleted by someone else | 2072 | // Already deleted by someone else |
2023 | if (part.ParentGroup.IsDeleted) | 2073 | if (part.ParentGroup.IsDeleted) |
2074 | { | ||
2075 | //Client still thinks the object exists, kill it | ||
2076 | deleteIDs.Add(localID); | ||
2024 | continue; | 2077 | continue; |
2078 | } | ||
2025 | 2079 | ||
2026 | // Can't delete child prims | 2080 | // Can't delete child prims |
2027 | if (part != part.ParentGroup.RootPart) | 2081 | if (part != part.ParentGroup.RootPart) |
@@ -2029,8 +2083,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2029 | 2083 | ||
2030 | SceneObjectGroup grp = part.ParentGroup; | 2084 | SceneObjectGroup grp = part.ParentGroup; |
2031 | 2085 | ||
2032 | deleteIDs.Add(localID); | 2086 | // If child prims have invalid perms, fix them |
2033 | deleteGroups.Add(grp); | 2087 | grp.AdjustChildPrimPermissions(); |
2034 | 2088 | ||
2035 | // If child prims have invalid perms, fix them | 2089 | // If child prims have invalid perms, fix them |
2036 | grp.AdjustChildPrimPermissions(); | 2090 | grp.AdjustChildPrimPermissions(); |
@@ -2051,86 +2105,198 @@ namespace OpenSim.Region.Framework.Scenes | |||
2051 | } | 2105 | } |
2052 | else | 2106 | else |
2053 | { | 2107 | { |
2054 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2108 | if (action == DeRezAction.TakeCopy) |
2109 | { | ||
2110 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
2111 | permissionToTakeCopy = false; | ||
2112 | } | ||
2113 | else | ||
2114 | { | ||
2055 | permissionToTakeCopy = false; | 2115 | permissionToTakeCopy = false; |
2056 | 2116 | } | |
2057 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2117 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
2058 | permissionToTake = false; | 2118 | permissionToTake = false; |
2059 | 2119 | ||
2060 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2120 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
2061 | permissionToDelete = false; | 2121 | permissionToDelete = false; |
2062 | } | 2122 | } |
2063 | } | ||
2064 | 2123 | ||
2065 | // Handle god perms | 2124 | // Handle god perms |
2066 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 2125 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
2067 | { | ||
2068 | permissionToTake = true; | ||
2069 | permissionToTakeCopy = true; | ||
2070 | permissionToDelete = true; | ||
2071 | } | ||
2072 | |||
2073 | // If we're re-saving, we don't even want to delete | ||
2074 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | ||
2075 | permissionToDelete = false; | ||
2076 | |||
2077 | // if we want to take a copy, we also don't want to delete | ||
2078 | // Note: after this point, the permissionToTakeCopy flag | ||
2079 | // becomes irrelevant. It already includes the permissionToTake | ||
2080 | // permission and after excluding no copy items here, we can | ||
2081 | // just use that. | ||
2082 | if (action == DeRezAction.TakeCopy) | ||
2083 | { | ||
2084 | // If we don't have permission, stop right here | ||
2085 | if (!permissionToTakeCopy) | ||
2086 | { | 2126 | { |
2087 | remoteClient.SendAlertMessage("You don't have permission to take the object"); | 2127 | permissionToTake = true; |
2088 | return; | 2128 | permissionToTakeCopy = true; |
2129 | permissionToDelete = true; | ||
2089 | } | 2130 | } |
2090 | 2131 | ||
2091 | permissionToTake = true; | 2132 | // If we're re-saving, we don't even want to delete |
2092 | // Don't delete | 2133 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
2093 | permissionToDelete = false; | 2134 | permissionToDelete = false; |
2094 | } | ||
2095 | 2135 | ||
2096 | if (action == DeRezAction.Return) | 2136 | // if we want to take a copy, we also don't want to delete |
2097 | { | 2137 | // Note: after this point, the permissionToTakeCopy flag |
2098 | if (remoteClient != null) | 2138 | // becomes irrelevant. It already includes the permissionToTake |
2139 | // permission and after excluding no copy items here, we can | ||
2140 | // just use that. | ||
2141 | if (action == DeRezAction.TakeCopy) | ||
2099 | { | 2142 | { |
2100 | if (Permissions.CanReturnObjects( | 2143 | // If we don't have permission, stop right here |
2101 | null, | 2144 | if (!permissionToTakeCopy) |
2102 | remoteClient.AgentId, | ||
2103 | deleteGroups)) | ||
2104 | { | 2145 | { |
2105 | permissionToTake = true; | 2146 | remoteClient.SendAlertMessage("You don't have permission to take the object"); |
2106 | permissionToDelete = true; | 2147 | return; |
2148 | } | ||
2107 | 2149 | ||
2108 | foreach (SceneObjectGroup g in deleteGroups) | 2150 | permissionToTake = true; |
2151 | // Don't delete | ||
2152 | permissionToDelete = false; | ||
2153 | } | ||
2154 | |||
2155 | if (action == DeRezAction.Return) | ||
2156 | { | ||
2157 | if (remoteClient != null) | ||
2158 | { | ||
2159 | if (Permissions.CanReturnObjects( | ||
2160 | null, | ||
2161 | remoteClient.AgentId, | ||
2162 | new List<SceneObjectGroup>() {grp})) | ||
2109 | { | 2163 | { |
2110 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2164 | permissionToTake = true; |
2165 | permissionToDelete = true; | ||
2166 | |||
2167 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
2111 | } | 2168 | } |
2112 | } | 2169 | } |
2170 | else // Auto return passes through here with null agent | ||
2171 | { | ||
2172 | permissionToTake = true; | ||
2173 | permissionToDelete = true; | ||
2174 | } | ||
2113 | } | 2175 | } |
2114 | else // Auto return passes through here with null agent | 2176 | |
2177 | if (permissionToTake && (!permissionToDelete)) | ||
2178 | takeGroups.Add(grp); | ||
2179 | |||
2180 | if (permissionToDelete) | ||
2115 | { | 2181 | { |
2116 | permissionToTake = true; | 2182 | if (permissionToTake) |
2117 | permissionToDelete = true; | 2183 | deleteGroups.Add(grp); |
2184 | deleteIDs.Add(grp.LocalId); | ||
2118 | } | 2185 | } |
2119 | } | 2186 | } |
2120 | 2187 | ||
2121 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2188 | SendKillObject(deleteIDs); |
2189 | |||
2190 | if (deleteGroups.Count > 0) | ||
2122 | { | 2191 | { |
2192 | foreach (SceneObjectGroup g in deleteGroups) | ||
2193 | deleteIDs.Remove(g.LocalId); | ||
2194 | |||
2123 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2195 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2124 | action, destinationID, deleteGroups, remoteClient, | 2196 | action, destinationID, deleteGroups, remoteClient, |
2125 | permissionToDelete); | 2197 | true); |
2198 | } | ||
2199 | if (takeGroups.Count > 0) | ||
2200 | { | ||
2201 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2202 | action, destinationID, takeGroups, remoteClient, | ||
2203 | false); | ||
2126 | } | 2204 | } |
2127 | else if (permissionToDelete) | 2205 | if (deleteIDs.Count > 0) |
2128 | { | 2206 | { |
2129 | foreach (SceneObjectGroup g in deleteGroups) | 2207 | foreach (SceneObjectGroup g in deleteGroups) |
2130 | DeleteSceneObject(g, false); | 2208 | DeleteSceneObject(g, true); |
2131 | } | 2209 | } |
2132 | } | 2210 | } |
2133 | 2211 | ||
2212 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2213 | { | ||
2214 | itemID = UUID.Zero; | ||
2215 | if (grp != null) | ||
2216 | { | ||
2217 | Vector3 inventoryStoredPosition = new Vector3 | ||
2218 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2219 | ? 250 | ||
2220 | : grp.AbsolutePosition.X) | ||
2221 | , | ||
2222 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2223 | ? 250 | ||
2224 | : grp.AbsolutePosition.X, | ||
2225 | grp.AbsolutePosition.Z); | ||
2226 | |||
2227 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2228 | |||
2229 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2230 | |||
2231 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2232 | |||
2233 | grp.AbsolutePosition = originalPosition; | ||
2234 | |||
2235 | AssetBase asset = CreateAsset( | ||
2236 | grp.GetPartName(grp.LocalId), | ||
2237 | grp.GetPartDescription(grp.LocalId), | ||
2238 | (sbyte)AssetType.Object, | ||
2239 | Utils.StringToBytes(sceneObjectXml), | ||
2240 | remoteClient.AgentId); | ||
2241 | AssetService.Store(asset); | ||
2242 | |||
2243 | InventoryItemBase item = new InventoryItemBase(); | ||
2244 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2245 | item.CreatorData = grp.RootPart.CreatorData; | ||
2246 | item.Owner = remoteClient.AgentId; | ||
2247 | item.ID = UUID.Random(); | ||
2248 | item.AssetID = asset.FullID; | ||
2249 | item.Description = asset.Description; | ||
2250 | item.Name = asset.Name; | ||
2251 | item.AssetType = asset.Type; | ||
2252 | item.InvType = (int)InventoryType.Object; | ||
2253 | |||
2254 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2255 | if (folder != null) | ||
2256 | item.Folder = folder.ID; | ||
2257 | else // oopsies | ||
2258 | item.Folder = UUID.Zero; | ||
2259 | |||
2260 | // Set up base perms properly | ||
2261 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2262 | permsBase &= grp.RootPart.BaseMask; | ||
2263 | permsBase |= (uint)PermissionMask.Move; | ||
2264 | |||
2265 | // Make sure we don't lock it | ||
2266 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2267 | |||
2268 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2269 | { | ||
2270 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2271 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2272 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2273 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2274 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2275 | } | ||
2276 | else | ||
2277 | { | ||
2278 | item.BasePermissions = permsBase; | ||
2279 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2280 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2281 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2282 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2283 | } | ||
2284 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2285 | |||
2286 | // sets itemID so client can show item as 'attached' in inventory | ||
2287 | grp.FromItemID = item.ID; | ||
2288 | |||
2289 | if (AddInventoryItem(item)) | ||
2290 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2291 | else | ||
2292 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2293 | |||
2294 | itemID = item.ID; | ||
2295 | return item.AssetID; | ||
2296 | } | ||
2297 | return UUID.Zero; | ||
2298 | } | ||
2299 | |||
2134 | /// <summary> | 2300 | /// <summary> |
2135 | /// Event Handler Rez an object into a scene | 2301 | /// Event Handler Rez an object into a scene |
2136 | /// Calls the non-void event handler | 2302 | /// Calls the non-void event handler |
@@ -2258,6 +2424,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2258 | 2424 | ||
2259 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2425 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2260 | { | 2426 | { |
2427 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2428 | return; | ||
2429 | |||
2261 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2430 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2262 | if (part == null) | 2431 | if (part == null) |
2263 | return; | 2432 | return; |
@@ -2314,7 +2483,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2314 | } | 2483 | } |
2315 | else | 2484 | else |
2316 | { | 2485 | { |
2317 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2486 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2487 | continue; | ||
2488 | |||
2489 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2318 | continue; | 2490 | continue; |
2319 | 2491 | ||
2320 | if (sog.GroupID != groupID) | 2492 | if (sog.GroupID != groupID) |
@@ -2426,6 +2598,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2426 | } | 2598 | } |
2427 | 2599 | ||
2428 | m_sceneGraph.LinkObjects(root, children); | 2600 | m_sceneGraph.LinkObjects(root, children); |
2601 | |||
2602 | ScenePresence sp; | ||
2603 | if (TryGetScenePresence(agentId, out sp)) | ||
2604 | { | ||
2605 | root.SendPropertiesToClient(sp.ControllingClient); | ||
2606 | } | ||
2429 | } | 2607 | } |
2430 | 2608 | ||
2431 | private string PermissionString(uint permissions) | 2609 | private string PermissionString(uint permissions) |