diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 315 |
1 files changed, 235 insertions, 80 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 10b25ed..0089c7d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | return false; | 156 | return false; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | if (InventoryService.AddItem(item)) | 160 | if (InventoryService.AddItem(item)) |
161 | { | 161 | { |
162 | int userlevel = 0; | 162 | int userlevel = 0; |
@@ -307,8 +307,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
307 | 307 | ||
308 | // Update item with new asset | 308 | // Update item with new asset |
309 | item.AssetID = asset.FullID; | 309 | item.AssetID = asset.FullID; |
310 | if (group.UpdateInventoryItem(item)) | 310 | group.UpdateInventoryItem(item); |
311 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
312 | 311 | ||
313 | part.SendPropertiesToClient(remoteClient); | 312 | part.SendPropertiesToClient(remoteClient); |
314 | 313 | ||
@@ -319,12 +318,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
319 | { | 318 | { |
320 | // Needs to determine which engine was running it and use that | 319 | // Needs to determine which engine was running it and use that |
321 | // | 320 | // |
322 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 321 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); |
323 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
328 | } | 322 | } |
329 | 323 | ||
330 | // Tell anyone managing scripts that a script has been reloaded/changed | 324 | // Tell anyone managing scripts that a script has been reloaded/changed |
@@ -392,6 +386,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
392 | 386 | ||
393 | if (UUID.Zero == transactionID) | 387 | if (UUID.Zero == transactionID) |
394 | { | 388 | { |
389 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); | ||
395 | item.Name = itemUpd.Name; | 390 | item.Name = itemUpd.Name; |
396 | item.Description = itemUpd.Description; | 391 | item.Description = itemUpd.Description; |
397 | 392 | ||
@@ -779,6 +774,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
779 | return; | 774 | return; |
780 | } | 775 | } |
781 | 776 | ||
777 | if (newName == null) newName = item.Name; | ||
778 | |||
782 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 779 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
783 | 780 | ||
784 | if (asset != null) | 781 | if (asset != null) |
@@ -835,6 +832,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
835 | } | 832 | } |
836 | 833 | ||
837 | /// <summary> | 834 | /// <summary> |
835 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
836 | /// </summary> | ||
837 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
838 | { | ||
839 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
840 | foreach (InventoryItemBase b in items) | ||
841 | { | ||
842 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
843 | InventoryItemBase n = InventoryService.GetItem(b); | ||
844 | n.Folder = destfolder; | ||
845 | moveitems.Add(n); | ||
846 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
847 | } | ||
848 | |||
849 | MoveInventoryItem(remoteClient, moveitems); | ||
850 | } | ||
851 | |||
852 | /// <summary> | ||
838 | /// Move an item within the agent's inventory. | 853 | /// Move an item within the agent's inventory. |
839 | /// </summary> | 854 | /// </summary> |
840 | /// <param name="remoteClient"></param> | 855 | /// <param name="remoteClient"></param> |
@@ -1177,6 +1192,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1177 | { | 1192 | { |
1178 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1193 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1179 | 1194 | ||
1195 | // Can't move a null item | ||
1196 | if (itemId == UUID.Zero) | ||
1197 | return; | ||
1198 | |||
1180 | if (null == part) | 1199 | if (null == part) |
1181 | { | 1200 | { |
1182 | m_log.WarnFormat( | 1201 | m_log.WarnFormat( |
@@ -1281,21 +1300,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | return; | 1300 | return; |
1282 | } | 1301 | } |
1283 | 1302 | ||
1284 | if (part.OwnerID != destPart.OwnerID) | 1303 | // Can't transfer this |
1304 | // | ||
1305 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1306 | return; | ||
1307 | |||
1308 | bool overrideNoMod = false; | ||
1309 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1310 | overrideNoMod = true; | ||
1311 | |||
1312 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1285 | { | 1313 | { |
1286 | // Source must have transfer permissions | 1314 | // object cannot copy items to an object owned by a different owner |
1287 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1315 | // unless llAllowInventoryDrop has been called |
1288 | return; | ||
1289 | 1316 | ||
1290 | // Object cannot copy items to an object owned by a different owner | 1317 | return; |
1291 | // unless llAllowInventoryDrop has been called on the destination | ||
1292 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1293 | return; | ||
1294 | } | 1318 | } |
1295 | 1319 | ||
1296 | // must have both move and modify permission to put an item in an object | 1320 | // must have both move and modify permission to put an item in an object |
1297 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1321 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1322 | { | ||
1298 | return; | 1323 | return; |
1324 | } | ||
1299 | 1325 | ||
1300 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1326 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1301 | 1327 | ||
@@ -1351,6 +1377,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1351 | 1377 | ||
1352 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1378 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1353 | { | 1379 | { |
1380 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1381 | if (destPart != null) // Move into a prim | ||
1382 | { | ||
1383 | foreach(UUID itemID in items) | ||
1384 | MoveTaskInventoryItem(destID, host, itemID); | ||
1385 | return destID; // Prim folder ID == prim ID | ||
1386 | } | ||
1387 | |||
1354 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1388 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1355 | 1389 | ||
1356 | UUID newFolderID = UUID.Random(); | 1390 | UUID newFolderID = UUID.Random(); |
@@ -1536,12 +1570,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1536 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1570 | agentTransactions.HandleTaskItemUpdateFromTransaction( |
1537 | remoteClient, part, transactionID, currentItem); | 1571 | remoteClient, part, transactionID, currentItem); |
1538 | 1572 | ||
1539 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1573 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1540 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1574 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1541 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1575 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1542 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1576 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1543 | else | 1577 | // else |
1544 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1578 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1545 | } | 1579 | } |
1546 | } | 1580 | } |
1547 | 1581 | ||
@@ -1725,7 +1759,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1725 | } | 1759 | } |
1726 | 1760 | ||
1727 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1761 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1728 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1762 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1729 | agentID); | 1763 | agentID); |
1730 | AssetService.Store(asset); | 1764 | AssetService.Store(asset); |
1731 | 1765 | ||
@@ -1881,23 +1915,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1881 | // build a list of eligible objects | 1915 | // build a list of eligible objects |
1882 | List<uint> deleteIDs = new List<uint>(); | 1916 | List<uint> deleteIDs = new List<uint>(); |
1883 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1917 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1884 | 1918 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1885 | // Start with true for both, then remove the flags if objects | ||
1886 | // that we can't derez are part of the selection | ||
1887 | bool permissionToTake = true; | ||
1888 | bool permissionToTakeCopy = true; | ||
1889 | bool permissionToDelete = true; | ||
1890 | 1919 | ||
1891 | foreach (uint localID in localIDs) | 1920 | foreach (uint localID in localIDs) |
1892 | { | 1921 | { |
1922 | // Start with true for both, then remove the flags if objects | ||
1923 | // that we can't derez are part of the selection | ||
1924 | bool permissionToTake = true; | ||
1925 | bool permissionToTakeCopy = true; | ||
1926 | bool permissionToDelete = true; | ||
1927 | |||
1893 | // Invalid id | 1928 | // Invalid id |
1894 | SceneObjectPart part = GetSceneObjectPart(localID); | 1929 | SceneObjectPart part = GetSceneObjectPart(localID); |
1895 | if (part == null) | 1930 | if (part == null) |
1931 | { | ||
1932 | //Client still thinks the object exists, kill it | ||
1933 | deleteIDs.Add(localID); | ||
1896 | continue; | 1934 | continue; |
1935 | } | ||
1897 | 1936 | ||
1898 | // Already deleted by someone else | 1937 | // Already deleted by someone else |
1899 | if (part.ParentGroup.IsDeleted) | 1938 | if (part.ParentGroup.IsDeleted) |
1939 | { | ||
1940 | //Client still thinks the object exists, kill it | ||
1941 | deleteIDs.Add(localID); | ||
1900 | continue; | 1942 | continue; |
1943 | } | ||
1901 | 1944 | ||
1902 | // Can't delete child prims | 1945 | // Can't delete child prims |
1903 | if (part != part.ParentGroup.RootPart) | 1946 | if (part != part.ParentGroup.RootPart) |
@@ -1905,9 +1948,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1905 | 1948 | ||
1906 | SceneObjectGroup grp = part.ParentGroup; | 1949 | SceneObjectGroup grp = part.ParentGroup; |
1907 | 1950 | ||
1908 | deleteIDs.Add(localID); | ||
1909 | deleteGroups.Add(grp); | ||
1910 | |||
1911 | if (remoteClient == null) | 1951 | if (remoteClient == null) |
1912 | { | 1952 | { |
1913 | // Autoreturn has a null client. Nothing else does. So | 1953 | // Autoreturn has a null client. Nothing else does. So |
@@ -1924,81 +1964,193 @@ namespace OpenSim.Region.Framework.Scenes | |||
1924 | } | 1964 | } |
1925 | else | 1965 | else |
1926 | { | 1966 | { |
1927 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1967 | if (action == DeRezAction.TakeCopy) |
1968 | { | ||
1969 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1970 | permissionToTakeCopy = false; | ||
1971 | } | ||
1972 | else | ||
1973 | { | ||
1928 | permissionToTakeCopy = false; | 1974 | permissionToTakeCopy = false; |
1929 | 1975 | } | |
1930 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1976 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1931 | permissionToTake = false; | 1977 | permissionToTake = false; |
1932 | 1978 | ||
1933 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1979 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1934 | permissionToDelete = false; | 1980 | permissionToDelete = false; |
1935 | } | 1981 | } |
1936 | } | ||
1937 | 1982 | ||
1938 | // Handle god perms | 1983 | // Handle god perms |
1939 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 1984 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1940 | { | 1985 | { |
1941 | permissionToTake = true; | 1986 | permissionToTake = true; |
1942 | permissionToTakeCopy = true; | 1987 | permissionToTakeCopy = true; |
1943 | permissionToDelete = true; | 1988 | permissionToDelete = true; |
1944 | } | 1989 | } |
1945 | 1990 | ||
1946 | // If we're re-saving, we don't even want to delete | 1991 | // If we're re-saving, we don't even want to delete |
1947 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 1992 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1948 | permissionToDelete = false; | 1993 | permissionToDelete = false; |
1949 | 1994 | ||
1950 | // if we want to take a copy, we also don't want to delete | 1995 | // if we want to take a copy, we also don't want to delete |
1951 | // Note: after this point, the permissionToTakeCopy flag | 1996 | // Note: after this point, the permissionToTakeCopy flag |
1952 | // becomes irrelevant. It already includes the permissionToTake | 1997 | // becomes irrelevant. It already includes the permissionToTake |
1953 | // permission and after excluding no copy items here, we can | 1998 | // permission and after excluding no copy items here, we can |
1954 | // just use that. | 1999 | // just use that. |
1955 | if (action == DeRezAction.TakeCopy) | 2000 | if (action == DeRezAction.TakeCopy) |
1956 | { | 2001 | { |
1957 | // If we don't have permission, stop right here | 2002 | // If we don't have permission, stop right here |
1958 | if (!permissionToTakeCopy) | 2003 | if (!permissionToTakeCopy) |
1959 | return; | 2004 | return; |
1960 | 2005 | ||
1961 | permissionToTake = true; | 2006 | permissionToTake = true; |
1962 | // Don't delete | 2007 | // Don't delete |
1963 | permissionToDelete = false; | 2008 | permissionToDelete = false; |
1964 | } | 2009 | } |
1965 | 2010 | ||
1966 | if (action == DeRezAction.Return) | 2011 | if (action == DeRezAction.Return) |
1967 | { | ||
1968 | if (remoteClient != null) | ||
1969 | { | 2012 | { |
1970 | if (Permissions.CanReturnObjects( | 2013 | if (remoteClient != null) |
1971 | null, | ||
1972 | remoteClient.AgentId, | ||
1973 | deleteGroups)) | ||
1974 | { | 2014 | { |
1975 | permissionToTake = true; | 2015 | if (Permissions.CanReturnObjects( |
1976 | permissionToDelete = true; | 2016 | null, |
1977 | 2017 | remoteClient.AgentId, | |
1978 | foreach (SceneObjectGroup g in deleteGroups) | 2018 | deleteGroups)) |
1979 | { | 2019 | { |
1980 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2020 | permissionToTake = true; |
2021 | permissionToDelete = true; | ||
2022 | |||
2023 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
1981 | } | 2024 | } |
1982 | } | 2025 | } |
2026 | else // Auto return passes through here with null agent | ||
2027 | { | ||
2028 | permissionToTake = true; | ||
2029 | permissionToDelete = true; | ||
2030 | } | ||
1983 | } | 2031 | } |
1984 | else // Auto return passes through here with null agent | 2032 | |
2033 | if (permissionToTake && (!permissionToDelete)) | ||
2034 | takeGroups.Add(grp); | ||
2035 | |||
2036 | if (permissionToDelete) | ||
1985 | { | 2037 | { |
1986 | permissionToTake = true; | 2038 | if (permissionToTake) |
1987 | permissionToDelete = true; | 2039 | deleteGroups.Add(grp); |
2040 | deleteIDs.Add(grp.LocalId); | ||
1988 | } | 2041 | } |
1989 | } | 2042 | } |
1990 | 2043 | ||
1991 | if (permissionToTake) | 2044 | SendKillObject(deleteIDs); |
2045 | |||
2046 | if (deleteGroups.Count > 0) | ||
1992 | { | 2047 | { |
2048 | foreach (SceneObjectGroup g in deleteGroups) | ||
2049 | deleteIDs.Remove(g.LocalId); | ||
2050 | |||
1993 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2051 | m_asyncSceneObjectDeleter.DeleteToInventory( |
1994 | action, destinationID, deleteGroups, remoteClient, | 2052 | action, destinationID, deleteGroups, remoteClient, |
1995 | permissionToDelete); | 2053 | true); |
2054 | } | ||
2055 | if (takeGroups.Count > 0) | ||
2056 | { | ||
2057 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2058 | action, destinationID, takeGroups, remoteClient, | ||
2059 | false); | ||
1996 | } | 2060 | } |
1997 | else if (permissionToDelete) | 2061 | if (deleteIDs.Count > 0) |
1998 | { | 2062 | { |
1999 | foreach (SceneObjectGroup g in deleteGroups) | 2063 | foreach (SceneObjectGroup g in deleteGroups) |
2000 | DeleteSceneObject(g, false); | 2064 | DeleteSceneObject(g, true); |
2065 | } | ||
2066 | } | ||
2067 | |||
2068 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2069 | { | ||
2070 | itemID = UUID.Zero; | ||
2071 | if (grp != null) | ||
2072 | { | ||
2073 | Vector3 inventoryStoredPosition = new Vector3 | ||
2074 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2075 | ? 250 | ||
2076 | : grp.AbsolutePosition.X) | ||
2077 | , | ||
2078 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2079 | ? 250 | ||
2080 | : grp.AbsolutePosition.X, | ||
2081 | grp.AbsolutePosition.Z); | ||
2082 | |||
2083 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2084 | |||
2085 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2086 | |||
2087 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2088 | |||
2089 | grp.AbsolutePosition = originalPosition; | ||
2090 | |||
2091 | AssetBase asset = CreateAsset( | ||
2092 | grp.GetPartName(grp.LocalId), | ||
2093 | grp.GetPartDescription(grp.LocalId), | ||
2094 | (sbyte)AssetType.Object, | ||
2095 | Utils.StringToBytes(sceneObjectXml), | ||
2096 | remoteClient.AgentId); | ||
2097 | AssetService.Store(asset); | ||
2098 | |||
2099 | InventoryItemBase item = new InventoryItemBase(); | ||
2100 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2101 | item.CreatorData = grp.RootPart.CreatorData; | ||
2102 | item.Owner = remoteClient.AgentId; | ||
2103 | item.ID = UUID.Random(); | ||
2104 | item.AssetID = asset.FullID; | ||
2105 | item.Description = asset.Description; | ||
2106 | item.Name = asset.Name; | ||
2107 | item.AssetType = asset.Type; | ||
2108 | item.InvType = (int)InventoryType.Object; | ||
2109 | |||
2110 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2111 | if (folder != null) | ||
2112 | item.Folder = folder.ID; | ||
2113 | else // oopsies | ||
2114 | item.Folder = UUID.Zero; | ||
2115 | |||
2116 | // Set up base perms properly | ||
2117 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2118 | permsBase &= grp.RootPart.BaseMask; | ||
2119 | permsBase |= (uint)PermissionMask.Move; | ||
2120 | |||
2121 | // Make sure we don't lock it | ||
2122 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2123 | |||
2124 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2125 | { | ||
2126 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2127 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2128 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2129 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2130 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2131 | } | ||
2132 | else | ||
2133 | { | ||
2134 | item.BasePermissions = permsBase; | ||
2135 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2136 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2137 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2138 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2139 | } | ||
2140 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2141 | |||
2142 | // sets itemID so client can show item as 'attached' in inventory | ||
2143 | grp.FromItemID = item.ID; | ||
2144 | |||
2145 | if (AddInventoryItem(item)) | ||
2146 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2147 | else | ||
2148 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2149 | |||
2150 | itemID = item.ID; | ||
2151 | return item.AssetID; | ||
2001 | } | 2152 | } |
2153 | return UUID.Zero; | ||
2002 | } | 2154 | } |
2003 | 2155 | ||
2004 | /// <summary> | 2156 | /// <summary> |
@@ -2127,6 +2279,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2127 | 2279 | ||
2128 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2280 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2129 | { | 2281 | { |
2282 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2283 | return; | ||
2284 | |||
2130 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2285 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2131 | if (part == null) | 2286 | if (part == null) |
2132 | return; | 2287 | return; |