diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 323 |
1 files changed, 228 insertions, 95 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2444367..e005698 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(); |
@@ -1478,13 +1497,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1478 | { | 1497 | { |
1479 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1498 | agentTransactions.HandleTaskItemUpdateFromTransaction( |
1480 | remoteClient, part, transactionID, currentItem); | 1499 | remoteClient, part, transactionID, currentItem); |
1481 | |||
1482 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | ||
1483 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
1484 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | ||
1485 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
1486 | else | ||
1487 | remoteClient.SendAgentAlertMessage("Item saved", false); | ||
1488 | } | 1500 | } |
1489 | 1501 | ||
1490 | // Base ALWAYS has move | 1502 | // Base ALWAYS has move |
@@ -1625,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1625 | return; | 1637 | return; |
1626 | 1638 | ||
1627 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1639 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1628 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1640 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1629 | remoteClient.AgentId); | 1641 | remoteClient.AgentId); |
1630 | AssetService.Store(asset); | 1642 | AssetService.Store(asset); |
1631 | 1643 | ||
@@ -1778,23 +1790,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1778 | // build a list of eligible objects | 1790 | // build a list of eligible objects |
1779 | List<uint> deleteIDs = new List<uint>(); | 1791 | List<uint> deleteIDs = new List<uint>(); |
1780 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1792 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1781 | 1793 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1782 | // Start with true for both, then remove the flags if objects | ||
1783 | // that we can't derez are part of the selection | ||
1784 | bool permissionToTake = true; | ||
1785 | bool permissionToTakeCopy = true; | ||
1786 | bool permissionToDelete = true; | ||
1787 | 1794 | ||
1788 | foreach (uint localID in localIDs) | 1795 | foreach (uint localID in localIDs) |
1789 | { | 1796 | { |
1797 | // Start with true for both, then remove the flags if objects | ||
1798 | // that we can't derez are part of the selection | ||
1799 | bool permissionToTake = true; | ||
1800 | bool permissionToTakeCopy = true; | ||
1801 | bool permissionToDelete = true; | ||
1802 | |||
1790 | // Invalid id | 1803 | // Invalid id |
1791 | SceneObjectPart part = GetSceneObjectPart(localID); | 1804 | SceneObjectPart part = GetSceneObjectPart(localID); |
1792 | if (part == null) | 1805 | if (part == null) |
1806 | { | ||
1807 | //Client still thinks the object exists, kill it | ||
1808 | deleteIDs.Add(localID); | ||
1793 | continue; | 1809 | continue; |
1810 | } | ||
1794 | 1811 | ||
1795 | // Already deleted by someone else | 1812 | // Already deleted by someone else |
1796 | if (part.ParentGroup.IsDeleted) | 1813 | if (part.ParentGroup.IsDeleted) |
1814 | { | ||
1815 | //Client still thinks the object exists, kill it | ||
1816 | deleteIDs.Add(localID); | ||
1797 | continue; | 1817 | continue; |
1818 | } | ||
1798 | 1819 | ||
1799 | // Can't delete child prims | 1820 | // Can't delete child prims |
1800 | if (part != part.ParentGroup.RootPart) | 1821 | if (part != part.ParentGroup.RootPart) |
@@ -1802,9 +1823,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1802 | 1823 | ||
1803 | SceneObjectGroup grp = part.ParentGroup; | 1824 | SceneObjectGroup grp = part.ParentGroup; |
1804 | 1825 | ||
1805 | deleteIDs.Add(localID); | ||
1806 | deleteGroups.Add(grp); | ||
1807 | |||
1808 | if (remoteClient == null) | 1826 | if (remoteClient == null) |
1809 | { | 1827 | { |
1810 | // Autoreturn has a null client. Nothing else does. So | 1828 | // Autoreturn has a null client. Nothing else does. So |
@@ -1821,83 +1839,195 @@ namespace OpenSim.Region.Framework.Scenes | |||
1821 | } | 1839 | } |
1822 | else | 1840 | else |
1823 | { | 1841 | { |
1824 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1842 | if (action == DeRezAction.TakeCopy) |
1843 | { | ||
1844 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1845 | permissionToTakeCopy = false; | ||
1846 | } | ||
1847 | else | ||
1848 | { | ||
1825 | permissionToTakeCopy = false; | 1849 | permissionToTakeCopy = false; |
1826 | 1850 | } | |
1827 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1851 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1828 | permissionToTake = false; | 1852 | permissionToTake = false; |
1829 | 1853 | ||
1830 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1854 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1831 | permissionToDelete = false; | 1855 | permissionToDelete = false; |
1832 | } | 1856 | } |
1833 | } | ||
1834 | 1857 | ||
1835 | // Handle god perms | 1858 | // Handle god perms |
1836 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 1859 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1837 | { | 1860 | { |
1838 | permissionToTake = true; | 1861 | permissionToTake = true; |
1839 | permissionToTakeCopy = true; | 1862 | permissionToTakeCopy = true; |
1840 | permissionToDelete = true; | 1863 | permissionToDelete = true; |
1841 | } | 1864 | } |
1842 | 1865 | ||
1843 | // If we're re-saving, we don't even want to delete | 1866 | // If we're re-saving, we don't even want to delete |
1844 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 1867 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1845 | permissionToDelete = false; | 1868 | permissionToDelete = false; |
1846 | 1869 | ||
1847 | // if we want to take a copy, we also don't want to delete | 1870 | // if we want to take a copy, we also don't want to delete |
1848 | // Note: after this point, the permissionToTakeCopy flag | 1871 | // Note: after this point, the permissionToTakeCopy flag |
1849 | // becomes irrelevant. It already includes the permissionToTake | 1872 | // becomes irrelevant. It already includes the permissionToTake |
1850 | // permission and after excluding no copy items here, we can | 1873 | // permission and after excluding no copy items here, we can |
1851 | // just use that. | 1874 | // just use that. |
1852 | if (action == DeRezAction.TakeCopy) | 1875 | if (action == DeRezAction.TakeCopy) |
1853 | { | 1876 | { |
1854 | // If we don't have permission, stop right here | 1877 | // If we don't have permission, stop right here |
1855 | if (!permissionToTakeCopy) | 1878 | if (!permissionToTakeCopy) |
1856 | return; | 1879 | return; |
1857 | 1880 | ||
1858 | permissionToTake = true; | 1881 | permissionToTake = true; |
1859 | // Don't delete | 1882 | // Don't delete |
1860 | permissionToDelete = false; | 1883 | permissionToDelete = false; |
1861 | } | 1884 | } |
1862 | 1885 | ||
1863 | if (action == DeRezAction.Return) | 1886 | if (action == DeRezAction.Return) |
1864 | { | ||
1865 | if (remoteClient != null) | ||
1866 | { | 1887 | { |
1867 | if (Permissions.CanReturnObjects( | 1888 | if (remoteClient != null) |
1868 | null, | ||
1869 | remoteClient.AgentId, | ||
1870 | deleteGroups)) | ||
1871 | { | 1889 | { |
1872 | permissionToTake = true; | 1890 | if (Permissions.CanReturnObjects( |
1873 | permissionToDelete = true; | 1891 | null, |
1874 | 1892 | remoteClient.AgentId, | |
1875 | foreach (SceneObjectGroup g in deleteGroups) | 1893 | deleteGroups)) |
1876 | { | 1894 | { |
1877 | AddReturn(g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 1895 | permissionToTake = true; |
1896 | permissionToDelete = true; | ||
1897 | |||
1898 | AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
1878 | } | 1899 | } |
1879 | } | 1900 | } |
1901 | else // Auto return passes through here with null agent | ||
1902 | { | ||
1903 | permissionToTake = true; | ||
1904 | permissionToDelete = true; | ||
1905 | } | ||
1880 | } | 1906 | } |
1881 | else // Auto return passes through here with null agent | 1907 | |
1908 | if (permissionToTake && (!permissionToDelete)) | ||
1909 | takeGroups.Add(grp); | ||
1910 | |||
1911 | if (permissionToDelete) | ||
1882 | { | 1912 | { |
1883 | permissionToTake = true; | 1913 | if (permissionToTake) |
1884 | permissionToDelete = true; | 1914 | deleteGroups.Add(grp); |
1915 | deleteIDs.Add(grp.LocalId); | ||
1885 | } | 1916 | } |
1886 | } | 1917 | } |
1887 | 1918 | ||
1888 | if (permissionToTake) | 1919 | SendKillObject(deleteIDs); |
1920 | |||
1921 | if (deleteGroups.Count > 0) | ||
1889 | { | 1922 | { |
1923 | foreach (SceneObjectGroup g in deleteGroups) | ||
1924 | deleteIDs.Remove(g.LocalId); | ||
1925 | |||
1890 | m_asyncSceneObjectDeleter.DeleteToInventory( | 1926 | m_asyncSceneObjectDeleter.DeleteToInventory( |
1891 | action, destinationID, deleteGroups, remoteClient, | 1927 | action, destinationID, deleteGroups, remoteClient, |
1892 | permissionToDelete); | 1928 | true); |
1893 | } | 1929 | } |
1894 | else if (permissionToDelete) | 1930 | if (takeGroups.Count > 0) |
1931 | { | ||
1932 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
1933 | action, destinationID, takeGroups, remoteClient, | ||
1934 | false); | ||
1935 | } | ||
1936 | if (deleteIDs.Count > 0) | ||
1895 | { | 1937 | { |
1896 | foreach (SceneObjectGroup g in deleteGroups) | 1938 | foreach (SceneObjectGroup g in deleteGroups) |
1897 | DeleteSceneObject(g, false); | 1939 | DeleteSceneObject(g, true); |
1898 | } | 1940 | } |
1899 | } | 1941 | } |
1900 | 1942 | ||
1943 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
1944 | { | ||
1945 | itemID = UUID.Zero; | ||
1946 | if (grp != null) | ||
1947 | { | ||
1948 | Vector3 inventoryStoredPosition = new Vector3 | ||
1949 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1950 | ? 250 | ||
1951 | : grp.AbsolutePosition.X) | ||
1952 | , | ||
1953 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1954 | ? 250 | ||
1955 | : grp.AbsolutePosition.X, | ||
1956 | grp.AbsolutePosition.Z); | ||
1957 | |||
1958 | Vector3 originalPosition = grp.AbsolutePosition; | ||
1959 | |||
1960 | grp.AbsolutePosition = inventoryStoredPosition; | ||
1961 | |||
1962 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
1963 | |||
1964 | grp.AbsolutePosition = originalPosition; | ||
1965 | |||
1966 | AssetBase asset = CreateAsset( | ||
1967 | grp.GetPartName(grp.LocalId), | ||
1968 | grp.GetPartDescription(grp.LocalId), | ||
1969 | (sbyte)AssetType.Object, | ||
1970 | Utils.StringToBytes(sceneObjectXml), | ||
1971 | remoteClient.AgentId); | ||
1972 | AssetService.Store(asset); | ||
1973 | |||
1974 | InventoryItemBase item = new InventoryItemBase(); | ||
1975 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
1976 | item.CreatorData = grp.RootPart.CreatorData; | ||
1977 | item.Owner = remoteClient.AgentId; | ||
1978 | item.ID = UUID.Random(); | ||
1979 | item.AssetID = asset.FullID; | ||
1980 | item.Description = asset.Description; | ||
1981 | item.Name = asset.Name; | ||
1982 | item.AssetType = asset.Type; | ||
1983 | item.InvType = (int)InventoryType.Object; | ||
1984 | |||
1985 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
1986 | if (folder != null) | ||
1987 | item.Folder = folder.ID; | ||
1988 | else // oopsies | ||
1989 | item.Folder = UUID.Zero; | ||
1990 | |||
1991 | // Set up base perms properly | ||
1992 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
1993 | permsBase &= grp.RootPart.BaseMask; | ||
1994 | permsBase |= (uint)PermissionMask.Move; | ||
1995 | |||
1996 | // Make sure we don't lock it | ||
1997 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
1998 | |||
1999 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2000 | { | ||
2001 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2002 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2003 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2004 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2005 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2006 | } | ||
2007 | else | ||
2008 | { | ||
2009 | item.BasePermissions = permsBase; | ||
2010 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2011 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2012 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2013 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2014 | } | ||
2015 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2016 | |||
2017 | // sets itemID so client can show item as 'attached' in inventory | ||
2018 | grp.SetFromItemID(item.ID); | ||
2019 | |||
2020 | if (AddInventoryItem(item)) | ||
2021 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2022 | else | ||
2023 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2024 | |||
2025 | itemID = item.ID; | ||
2026 | return item.AssetID; | ||
2027 | } | ||
2028 | return UUID.Zero; | ||
2029 | } | ||
2030 | |||
1901 | /// <summary> | 2031 | /// <summary> |
1902 | /// Event Handler Rez an object into a scene | 2032 | /// Event Handler Rez an object into a scene |
1903 | /// Calls the non-void event handler | 2033 | /// Calls the non-void event handler |
@@ -2024,6 +2154,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2024 | 2154 | ||
2025 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2155 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2026 | { | 2156 | { |
2157 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2158 | return; | ||
2159 | |||
2027 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2160 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2028 | if (part == null) | 2161 | if (part == null) |
2029 | return; | 2162 | return; |