diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 328 |
1 files changed, 234 insertions, 94 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6d7559e..58de44e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -117,34 +117,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
117 | /// <param name="item"></param> | 117 | /// <param name="item"></param> |
118 | public bool AddInventoryItem(InventoryItemBase item) | 118 | public bool AddInventoryItem(InventoryItemBase item) |
119 | { | 119 | { |
120 | if (UUID.Zero == item.Folder) | 120 | InventoryFolderBase folder; |
121 | |||
122 | if (item.Folder == UUID.Zero) | ||
121 | { | 123 | { |
122 | InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); | 124 | folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); |
123 | if (f != null) | 125 | if (folder == null) |
124 | { | 126 | { |
125 | // m_log.DebugFormat( | 127 | folder = InventoryService.GetRootFolder(item.Owner); |
126 | // "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", | 128 | |
127 | // f.Name, (AssetType)f.Type, item.Name); | 129 | if (folder == null) |
128 | |||
129 | item.Folder = f.ID; | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | f = InventoryService.GetRootFolder(item.Owner); | ||
134 | if (f != null) | ||
135 | { | ||
136 | item.Folder = f.ID; | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | m_log.WarnFormat( | ||
141 | "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", | ||
142 | item.Owner, item.Name); | ||
143 | return false; | 130 | return false; |
144 | } | ||
145 | } | 131 | } |
132 | |||
133 | item.Folder = folder.ID; | ||
146 | } | 134 | } |
147 | 135 | ||
148 | if (InventoryService.AddItem(item)) | 136 | if (InventoryService.AddItem(item)) |
149 | { | 137 | { |
150 | int userlevel = 0; | 138 | int userlevel = 0; |
@@ -264,8 +252,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | 252 | ||
265 | // Update item with new asset | 253 | // Update item with new asset |
266 | item.AssetID = asset.FullID; | 254 | item.AssetID = asset.FullID; |
267 | if (group.UpdateInventoryItem(item)) | 255 | group.UpdateInventoryItem(item); |
268 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
269 | 256 | ||
270 | part.SendPropertiesToClient(remoteClient); | 257 | part.SendPropertiesToClient(remoteClient); |
271 | 258 | ||
@@ -276,12 +263,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
276 | { | 263 | { |
277 | // Needs to determine which engine was running it and use that | 264 | // Needs to determine which engine was running it and use that |
278 | // | 265 | // |
279 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 266 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); |
280 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
285 | } | 267 | } |
286 | part.ParentGroup.ResumeScripts(); | 268 | part.ParentGroup.ResumeScripts(); |
287 | return errors; | 269 | return errors; |
@@ -345,6 +327,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | 327 | ||
346 | if (UUID.Zero == transactionID) | 328 | if (UUID.Zero == transactionID) |
347 | { | 329 | { |
330 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); | ||
348 | item.Name = itemUpd.Name; | 331 | item.Name = itemUpd.Name; |
349 | item.Description = itemUpd.Description; | 332 | item.Description = itemUpd.Description; |
350 | if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) | 333 | if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) |
@@ -723,6 +706,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
723 | return; | 706 | return; |
724 | } | 707 | } |
725 | 708 | ||
709 | if (newName == null) newName = item.Name; | ||
710 | |||
726 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 711 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
727 | 712 | ||
728 | if (asset != null) | 713 | if (asset != null) |
@@ -779,6 +764,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
779 | } | 764 | } |
780 | 765 | ||
781 | /// <summary> | 766 | /// <summary> |
767 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
768 | /// </summary> | ||
769 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
770 | { | ||
771 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
772 | foreach (InventoryItemBase b in items) | ||
773 | { | ||
774 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
775 | InventoryItemBase n = InventoryService.GetItem(b); | ||
776 | n.Folder = destfolder; | ||
777 | moveitems.Add(n); | ||
778 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
779 | } | ||
780 | |||
781 | MoveInventoryItem(remoteClient, moveitems); | ||
782 | } | ||
783 | |||
784 | /// <summary> | ||
782 | /// Move an item within the agent's inventory. | 785 | /// Move an item within the agent's inventory. |
783 | /// </summary> | 786 | /// </summary> |
784 | /// <param name="remoteClient"></param> | 787 | /// <param name="remoteClient"></param> |
@@ -1121,6 +1124,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1121 | { | 1124 | { |
1122 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1125 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1123 | 1126 | ||
1127 | // Can't move a null item | ||
1128 | if (itemId == UUID.Zero) | ||
1129 | return; | ||
1130 | |||
1124 | if (null == part) | 1131 | if (null == part) |
1125 | { | 1132 | { |
1126 | m_log.WarnFormat( | 1133 | m_log.WarnFormat( |
@@ -1231,6 +1238,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1231 | if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) | 1238 | if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) |
1232 | return; | 1239 | return; |
1233 | 1240 | ||
1241 | bool overrideNoMod = false; | ||
1242 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1243 | overrideNoMod = true; | ||
1244 | |||
1234 | if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | 1245 | if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) |
1235 | { | 1246 | { |
1236 | // object cannot copy items to an object owned by a different owner | 1247 | // object cannot copy items to an object owned by a different owner |
@@ -1240,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1240 | } | 1251 | } |
1241 | 1252 | ||
1242 | // must have both move and modify permission to put an item in an object | 1253 | // must have both move and modify permission to put an item in an object |
1243 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1254 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1244 | { | 1255 | { |
1245 | return; | 1256 | return; |
1246 | } | 1257 | } |
@@ -1299,6 +1310,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1299 | 1310 | ||
1300 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1311 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1301 | { | 1312 | { |
1313 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1314 | if (destPart != null) // Move into a prim | ||
1315 | { | ||
1316 | foreach(UUID itemID in items) | ||
1317 | MoveTaskInventoryItem(destID, host, itemID); | ||
1318 | return destID; // Prim folder ID == prim ID | ||
1319 | } | ||
1320 | |||
1302 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1321 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1303 | 1322 | ||
1304 | UUID newFolderID = UUID.Random(); | 1323 | UUID newFolderID = UUID.Random(); |
@@ -1484,12 +1503,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1484 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1503 | agentTransactions.HandleTaskItemUpdateFromTransaction( |
1485 | remoteClient, part, transactionID, currentItem); | 1504 | remoteClient, part, transactionID, currentItem); |
1486 | 1505 | ||
1487 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1506 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1488 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1507 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1489 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1508 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1490 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1509 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1491 | else | 1510 | // else |
1492 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1511 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1493 | } | 1512 | } |
1494 | } | 1513 | } |
1495 | 1514 | ||
@@ -1669,7 +1688,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1669 | } | 1688 | } |
1670 | 1689 | ||
1671 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1690 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1672 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1691 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1673 | agentID); | 1692 | agentID); |
1674 | AssetService.Store(asset); | 1693 | AssetService.Store(asset); |
1675 | 1694 | ||
@@ -1821,23 +1840,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1821 | // build a list of eligible objects | 1840 | // build a list of eligible objects |
1822 | List<uint> deleteIDs = new List<uint>(); | 1841 | List<uint> deleteIDs = new List<uint>(); |
1823 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1842 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1824 | 1843 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1825 | // Start with true for both, then remove the flags if objects | ||
1826 | // that we can't derez are part of the selection | ||
1827 | bool permissionToTake = true; | ||
1828 | bool permissionToTakeCopy = true; | ||
1829 | bool permissionToDelete = true; | ||
1830 | 1844 | ||
1831 | foreach (uint localID in localIDs) | 1845 | foreach (uint localID in localIDs) |
1832 | { | 1846 | { |
1847 | // Start with true for both, then remove the flags if objects | ||
1848 | // that we can't derez are part of the selection | ||
1849 | bool permissionToTake = true; | ||
1850 | bool permissionToTakeCopy = true; | ||
1851 | bool permissionToDelete = true; | ||
1852 | |||
1833 | // Invalid id | 1853 | // Invalid id |
1834 | SceneObjectPart part = GetSceneObjectPart(localID); | 1854 | SceneObjectPart part = GetSceneObjectPart(localID); |
1835 | if (part == null) | 1855 | if (part == null) |
1856 | { | ||
1857 | //Client still thinks the object exists, kill it | ||
1858 | deleteIDs.Add(localID); | ||
1836 | continue; | 1859 | continue; |
1860 | } | ||
1837 | 1861 | ||
1838 | // Already deleted by someone else | 1862 | // Already deleted by someone else |
1839 | if (part.ParentGroup.IsDeleted) | 1863 | if (part.ParentGroup.IsDeleted) |
1864 | { | ||
1865 | //Client still thinks the object exists, kill it | ||
1866 | deleteIDs.Add(localID); | ||
1840 | continue; | 1867 | continue; |
1868 | } | ||
1841 | 1869 | ||
1842 | // Can't delete child prims | 1870 | // Can't delete child prims |
1843 | if (part != part.ParentGroup.RootPart) | 1871 | if (part != part.ParentGroup.RootPart) |
@@ -1845,9 +1873,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1845 | 1873 | ||
1846 | SceneObjectGroup grp = part.ParentGroup; | 1874 | SceneObjectGroup grp = part.ParentGroup; |
1847 | 1875 | ||
1848 | deleteIDs.Add(localID); | ||
1849 | deleteGroups.Add(grp); | ||
1850 | |||
1851 | if (remoteClient == null) | 1876 | if (remoteClient == null) |
1852 | { | 1877 | { |
1853 | // Autoreturn has a null client. Nothing else does. So | 1878 | // Autoreturn has a null client. Nothing else does. So |
@@ -1864,83 +1889,195 @@ namespace OpenSim.Region.Framework.Scenes | |||
1864 | } | 1889 | } |
1865 | else | 1890 | else |
1866 | { | 1891 | { |
1867 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1892 | if (action == DeRezAction.TakeCopy) |
1893 | { | ||
1894 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1895 | permissionToTakeCopy = false; | ||
1896 | } | ||
1897 | else | ||
1898 | { | ||
1868 | permissionToTakeCopy = false; | 1899 | permissionToTakeCopy = false; |
1869 | 1900 | } | |
1870 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1901 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1871 | permissionToTake = false; | 1902 | permissionToTake = false; |
1872 | 1903 | ||
1873 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1904 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1874 | permissionToDelete = false; | 1905 | permissionToDelete = false; |
1875 | } | 1906 | } |
1876 | } | ||
1877 | 1907 | ||
1878 | // Handle god perms | 1908 | // Handle god perms |
1879 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 1909 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1880 | { | 1910 | { |
1881 | permissionToTake = true; | 1911 | permissionToTake = true; |
1882 | permissionToTakeCopy = true; | 1912 | permissionToTakeCopy = true; |
1883 | permissionToDelete = true; | 1913 | permissionToDelete = true; |
1884 | } | 1914 | } |
1885 | 1915 | ||
1886 | // If we're re-saving, we don't even want to delete | 1916 | // If we're re-saving, we don't even want to delete |
1887 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 1917 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1888 | permissionToDelete = false; | 1918 | permissionToDelete = false; |
1889 | 1919 | ||
1890 | // if we want to take a copy, we also don't want to delete | 1920 | // if we want to take a copy, we also don't want to delete |
1891 | // Note: after this point, the permissionToTakeCopy flag | 1921 | // Note: after this point, the permissionToTakeCopy flag |
1892 | // becomes irrelevant. It already includes the permissionToTake | 1922 | // becomes irrelevant. It already includes the permissionToTake |
1893 | // permission and after excluding no copy items here, we can | 1923 | // permission and after excluding no copy items here, we can |
1894 | // just use that. | 1924 | // just use that. |
1895 | if (action == DeRezAction.TakeCopy) | 1925 | if (action == DeRezAction.TakeCopy) |
1896 | { | 1926 | { |
1897 | // If we don't have permission, stop right here | 1927 | // If we don't have permission, stop right here |
1898 | if (!permissionToTakeCopy) | 1928 | if (!permissionToTakeCopy) |
1899 | return; | 1929 | return; |
1900 | 1930 | ||
1901 | permissionToTake = true; | 1931 | permissionToTake = true; |
1902 | // Don't delete | 1932 | // Don't delete |
1903 | permissionToDelete = false; | 1933 | permissionToDelete = false; |
1904 | } | 1934 | } |
1905 | 1935 | ||
1906 | if (action == DeRezAction.Return) | 1936 | if (action == DeRezAction.Return) |
1907 | { | ||
1908 | if (remoteClient != null) | ||
1909 | { | 1937 | { |
1910 | if (Permissions.CanReturnObjects( | 1938 | if (remoteClient != null) |
1911 | null, | ||
1912 | remoteClient.AgentId, | ||
1913 | deleteGroups)) | ||
1914 | { | 1939 | { |
1915 | permissionToTake = true; | 1940 | if (Permissions.CanReturnObjects( |
1916 | permissionToDelete = true; | 1941 | null, |
1917 | 1942 | remoteClient.AgentId, | |
1918 | foreach (SceneObjectGroup g in deleteGroups) | 1943 | deleteGroups)) |
1919 | { | 1944 | { |
1920 | AddReturn(g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 1945 | permissionToTake = true; |
1946 | permissionToDelete = true; | ||
1947 | |||
1948 | AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
1921 | } | 1949 | } |
1922 | } | 1950 | } |
1951 | else // Auto return passes through here with null agent | ||
1952 | { | ||
1953 | permissionToTake = true; | ||
1954 | permissionToDelete = true; | ||
1955 | } | ||
1923 | } | 1956 | } |
1924 | else // Auto return passes through here with null agent | 1957 | |
1958 | if (permissionToTake && (!permissionToDelete)) | ||
1959 | takeGroups.Add(grp); | ||
1960 | |||
1961 | if (permissionToDelete) | ||
1925 | { | 1962 | { |
1926 | permissionToTake = true; | 1963 | if (permissionToTake) |
1927 | permissionToDelete = true; | 1964 | deleteGroups.Add(grp); |
1965 | deleteIDs.Add(grp.LocalId); | ||
1928 | } | 1966 | } |
1929 | } | 1967 | } |
1930 | 1968 | ||
1931 | if (permissionToTake) | 1969 | SendKillObject(deleteIDs); |
1970 | |||
1971 | if (deleteGroups.Count > 0) | ||
1932 | { | 1972 | { |
1973 | foreach (SceneObjectGroup g in deleteGroups) | ||
1974 | deleteIDs.Remove(g.LocalId); | ||
1975 | |||
1933 | m_asyncSceneObjectDeleter.DeleteToInventory( | 1976 | m_asyncSceneObjectDeleter.DeleteToInventory( |
1934 | action, destinationID, deleteGroups, remoteClient, | 1977 | action, destinationID, deleteGroups, remoteClient, |
1935 | permissionToDelete); | 1978 | true); |
1979 | } | ||
1980 | if (takeGroups.Count > 0) | ||
1981 | { | ||
1982 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
1983 | action, destinationID, takeGroups, remoteClient, | ||
1984 | false); | ||
1936 | } | 1985 | } |
1937 | else if (permissionToDelete) | 1986 | if (deleteIDs.Count > 0) |
1938 | { | 1987 | { |
1939 | foreach (SceneObjectGroup g in deleteGroups) | 1988 | foreach (SceneObjectGroup g in deleteGroups) |
1940 | DeleteSceneObject(g, false); | 1989 | DeleteSceneObject(g, true); |
1941 | } | 1990 | } |
1942 | } | 1991 | } |
1943 | 1992 | ||
1993 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
1994 | { | ||
1995 | itemID = UUID.Zero; | ||
1996 | if (grp != null) | ||
1997 | { | ||
1998 | Vector3 inventoryStoredPosition = new Vector3 | ||
1999 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2000 | ? 250 | ||
2001 | : grp.AbsolutePosition.X) | ||
2002 | , | ||
2003 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2004 | ? 250 | ||
2005 | : grp.AbsolutePosition.X, | ||
2006 | grp.AbsolutePosition.Z); | ||
2007 | |||
2008 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2009 | |||
2010 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2011 | |||
2012 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2013 | |||
2014 | grp.AbsolutePosition = originalPosition; | ||
2015 | |||
2016 | AssetBase asset = CreateAsset( | ||
2017 | grp.GetPartName(grp.LocalId), | ||
2018 | grp.GetPartDescription(grp.LocalId), | ||
2019 | (sbyte)AssetType.Object, | ||
2020 | Utils.StringToBytes(sceneObjectXml), | ||
2021 | remoteClient.AgentId); | ||
2022 | AssetService.Store(asset); | ||
2023 | |||
2024 | InventoryItemBase item = new InventoryItemBase(); | ||
2025 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2026 | item.CreatorData = grp.RootPart.CreatorData; | ||
2027 | item.Owner = remoteClient.AgentId; | ||
2028 | item.ID = UUID.Random(); | ||
2029 | item.AssetID = asset.FullID; | ||
2030 | item.Description = asset.Description; | ||
2031 | item.Name = asset.Name; | ||
2032 | item.AssetType = asset.Type; | ||
2033 | item.InvType = (int)InventoryType.Object; | ||
2034 | |||
2035 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2036 | if (folder != null) | ||
2037 | item.Folder = folder.ID; | ||
2038 | else // oopsies | ||
2039 | item.Folder = UUID.Zero; | ||
2040 | |||
2041 | // Set up base perms properly | ||
2042 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2043 | permsBase &= grp.RootPart.BaseMask; | ||
2044 | permsBase |= (uint)PermissionMask.Move; | ||
2045 | |||
2046 | // Make sure we don't lock it | ||
2047 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2048 | |||
2049 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2050 | { | ||
2051 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2052 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2053 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2054 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2055 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2056 | } | ||
2057 | else | ||
2058 | { | ||
2059 | item.BasePermissions = permsBase; | ||
2060 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2061 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2062 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2063 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2064 | } | ||
2065 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2066 | |||
2067 | // sets itemID so client can show item as 'attached' in inventory | ||
2068 | grp.SetFromItemID(item.ID); | ||
2069 | |||
2070 | if (AddInventoryItem(item)) | ||
2071 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2072 | else | ||
2073 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2074 | |||
2075 | itemID = item.ID; | ||
2076 | return item.AssetID; | ||
2077 | } | ||
2078 | return UUID.Zero; | ||
2079 | } | ||
2080 | |||
1944 | /// <summary> | 2081 | /// <summary> |
1945 | /// Event Handler Rez an object into a scene | 2082 | /// Event Handler Rez an object into a scene |
1946 | /// Calls the non-void event handler | 2083 | /// Calls the non-void event handler |
@@ -2067,6 +2204,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2067 | 2204 | ||
2068 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2205 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2069 | { | 2206 | { |
2207 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2208 | return; | ||
2209 | |||
2070 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2210 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2071 | if (part == null) | 2211 | if (part == null) |
2072 | return; | 2212 | return; |