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