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 5a5307c..fff39fb 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 | 333 | ||
@@ -732,6 +715,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
732 | return; | 715 | return; |
733 | } | 716 | } |
734 | 717 | ||
718 | if (newName == null) newName = item.Name; | ||
719 | |||
735 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 720 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
736 | 721 | ||
737 | if (asset != null) | 722 | if (asset != null) |
@@ -788,6 +773,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
788 | } | 773 | } |
789 | 774 | ||
790 | /// <summary> | 775 | /// <summary> |
776 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
777 | /// </summary> | ||
778 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
779 | { | ||
780 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
781 | foreach (InventoryItemBase b in items) | ||
782 | { | ||
783 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
784 | InventoryItemBase n = InventoryService.GetItem(b); | ||
785 | n.Folder = destfolder; | ||
786 | moveitems.Add(n); | ||
787 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
788 | } | ||
789 | |||
790 | MoveInventoryItem(remoteClient, moveitems); | ||
791 | } | ||
792 | |||
793 | /// <summary> | ||
791 | /// Move an item within the agent's inventory. | 794 | /// Move an item within the agent's inventory. |
792 | /// </summary> | 795 | /// </summary> |
793 | /// <param name="remoteClient"></param> | 796 | /// <param name="remoteClient"></param> |
@@ -1130,6 +1133,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1130 | { | 1133 | { |
1131 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1134 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1132 | 1135 | ||
1136 | // Can't move a null item | ||
1137 | if (itemId == UUID.Zero) | ||
1138 | return; | ||
1139 | |||
1133 | if (null == part) | 1140 | if (null == part) |
1134 | { | 1141 | { |
1135 | m_log.WarnFormat( | 1142 | m_log.WarnFormat( |
@@ -1240,6 +1247,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1240 | if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) | 1247 | if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) |
1241 | return; | 1248 | return; |
1242 | 1249 | ||
1250 | bool overrideNoMod = false; | ||
1251 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1252 | overrideNoMod = true; | ||
1253 | |||
1243 | if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | 1254 | if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) |
1244 | { | 1255 | { |
1245 | // object cannot copy items to an object owned by a different owner | 1256 | // object cannot copy items to an object owned by a different owner |
@@ -1249,7 +1260,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1249 | } | 1260 | } |
1250 | 1261 | ||
1251 | // must have both move and modify permission to put an item in an object | 1262 | // must have both move and modify permission to put an item in an object |
1252 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1263 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1253 | { | 1264 | { |
1254 | return; | 1265 | return; |
1255 | } | 1266 | } |
@@ -1308,6 +1319,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1308 | 1319 | ||
1309 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1320 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1310 | { | 1321 | { |
1322 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1323 | if (destPart != null) // Move into a prim | ||
1324 | { | ||
1325 | foreach(UUID itemID in items) | ||
1326 | MoveTaskInventoryItem(destID, host, itemID); | ||
1327 | return destID; // Prim folder ID == prim ID | ||
1328 | } | ||
1329 | |||
1311 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1330 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1312 | 1331 | ||
1313 | UUID newFolderID = UUID.Random(); | 1332 | UUID newFolderID = UUID.Random(); |
@@ -1493,12 +1512,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1493 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1512 | agentTransactions.HandleTaskItemUpdateFromTransaction( |
1494 | remoteClient, part, transactionID, currentItem); | 1513 | remoteClient, part, transactionID, currentItem); |
1495 | 1514 | ||
1496 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1515 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1497 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1516 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1498 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1517 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1499 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1518 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1500 | else | 1519 | // else |
1501 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1520 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1502 | } | 1521 | } |
1503 | } | 1522 | } |
1504 | 1523 | ||
@@ -1678,7 +1697,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1678 | } | 1697 | } |
1679 | 1698 | ||
1680 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1699 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1681 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1700 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1682 | agentID); | 1701 | agentID); |
1683 | AssetService.Store(asset); | 1702 | AssetService.Store(asset); |
1684 | 1703 | ||
@@ -1830,23 +1849,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1830 | // build a list of eligible objects | 1849 | // build a list of eligible objects |
1831 | List<uint> deleteIDs = new List<uint>(); | 1850 | List<uint> deleteIDs = new List<uint>(); |
1832 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1851 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1833 | 1852 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1834 | // Start with true for both, then remove the flags if objects | ||
1835 | // that we can't derez are part of the selection | ||
1836 | bool permissionToTake = true; | ||
1837 | bool permissionToTakeCopy = true; | ||
1838 | bool permissionToDelete = true; | ||
1839 | 1853 | ||
1840 | foreach (uint localID in localIDs) | 1854 | foreach (uint localID in localIDs) |
1841 | { | 1855 | { |
1856 | // Start with true for both, then remove the flags if objects | ||
1857 | // that we can't derez are part of the selection | ||
1858 | bool permissionToTake = true; | ||
1859 | bool permissionToTakeCopy = true; | ||
1860 | bool permissionToDelete = true; | ||
1861 | |||
1842 | // Invalid id | 1862 | // Invalid id |
1843 | SceneObjectPart part = GetSceneObjectPart(localID); | 1863 | SceneObjectPart part = GetSceneObjectPart(localID); |
1844 | if (part == null) | 1864 | if (part == null) |
1865 | { | ||
1866 | //Client still thinks the object exists, kill it | ||
1867 | deleteIDs.Add(localID); | ||
1845 | continue; | 1868 | continue; |
1869 | } | ||
1846 | 1870 | ||
1847 | // Already deleted by someone else | 1871 | // Already deleted by someone else |
1848 | if (part.ParentGroup.IsDeleted) | 1872 | if (part.ParentGroup.IsDeleted) |
1873 | { | ||
1874 | //Client still thinks the object exists, kill it | ||
1875 | deleteIDs.Add(localID); | ||
1849 | continue; | 1876 | continue; |
1877 | } | ||
1850 | 1878 | ||
1851 | // Can't delete child prims | 1879 | // Can't delete child prims |
1852 | if (part != part.ParentGroup.RootPart) | 1880 | if (part != part.ParentGroup.RootPart) |
@@ -1854,9 +1882,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1854 | 1882 | ||
1855 | SceneObjectGroup grp = part.ParentGroup; | 1883 | SceneObjectGroup grp = part.ParentGroup; |
1856 | 1884 | ||
1857 | deleteIDs.Add(localID); | ||
1858 | deleteGroups.Add(grp); | ||
1859 | |||
1860 | if (remoteClient == null) | 1885 | if (remoteClient == null) |
1861 | { | 1886 | { |
1862 | // Autoreturn has a null client. Nothing else does. So | 1887 | // Autoreturn has a null client. Nothing else does. So |
@@ -1873,83 +1898,195 @@ namespace OpenSim.Region.Framework.Scenes | |||
1873 | } | 1898 | } |
1874 | else | 1899 | else |
1875 | { | 1900 | { |
1876 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1901 | if (action == DeRezAction.TakeCopy) |
1902 | { | ||
1903 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1904 | permissionToTakeCopy = false; | ||
1905 | } | ||
1906 | else | ||
1907 | { | ||
1877 | permissionToTakeCopy = false; | 1908 | permissionToTakeCopy = false; |
1878 | 1909 | } | |
1879 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1910 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1880 | permissionToTake = false; | 1911 | permissionToTake = false; |
1881 | 1912 | ||
1882 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1913 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1883 | permissionToDelete = false; | 1914 | permissionToDelete = false; |
1884 | } | 1915 | } |
1885 | } | ||
1886 | 1916 | ||
1887 | // Handle god perms | 1917 | // Handle god perms |
1888 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 1918 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1889 | { | 1919 | { |
1890 | permissionToTake = true; | 1920 | permissionToTake = true; |
1891 | permissionToTakeCopy = true; | 1921 | permissionToTakeCopy = true; |
1892 | permissionToDelete = true; | 1922 | permissionToDelete = true; |
1893 | } | 1923 | } |
1894 | 1924 | ||
1895 | // If we're re-saving, we don't even want to delete | 1925 | // If we're re-saving, we don't even want to delete |
1896 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 1926 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1897 | permissionToDelete = false; | 1927 | permissionToDelete = false; |
1898 | 1928 | ||
1899 | // if we want to take a copy, we also don't want to delete | 1929 | // if we want to take a copy, we also don't want to delete |
1900 | // Note: after this point, the permissionToTakeCopy flag | 1930 | // Note: after this point, the permissionToTakeCopy flag |
1901 | // becomes irrelevant. It already includes the permissionToTake | 1931 | // becomes irrelevant. It already includes the permissionToTake |
1902 | // permission and after excluding no copy items here, we can | 1932 | // permission and after excluding no copy items here, we can |
1903 | // just use that. | 1933 | // just use that. |
1904 | if (action == DeRezAction.TakeCopy) | 1934 | if (action == DeRezAction.TakeCopy) |
1905 | { | 1935 | { |
1906 | // If we don't have permission, stop right here | 1936 | // If we don't have permission, stop right here |
1907 | if (!permissionToTakeCopy) | 1937 | if (!permissionToTakeCopy) |
1908 | return; | 1938 | return; |
1909 | 1939 | ||
1910 | permissionToTake = true; | 1940 | permissionToTake = true; |
1911 | // Don't delete | 1941 | // Don't delete |
1912 | permissionToDelete = false; | 1942 | permissionToDelete = false; |
1913 | } | 1943 | } |
1914 | 1944 | ||
1915 | if (action == DeRezAction.Return) | 1945 | if (action == DeRezAction.Return) |
1916 | { | ||
1917 | if (remoteClient != null) | ||
1918 | { | 1946 | { |
1919 | if (Permissions.CanReturnObjects( | 1947 | if (remoteClient != null) |
1920 | null, | ||
1921 | remoteClient.AgentId, | ||
1922 | deleteGroups)) | ||
1923 | { | 1948 | { |
1924 | permissionToTake = true; | 1949 | if (Permissions.CanReturnObjects( |
1925 | permissionToDelete = true; | 1950 | null, |
1926 | 1951 | remoteClient.AgentId, | |
1927 | foreach (SceneObjectGroup g in deleteGroups) | 1952 | deleteGroups)) |
1928 | { | 1953 | { |
1929 | AddReturn(g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 1954 | permissionToTake = true; |
1955 | permissionToDelete = true; | ||
1956 | |||
1957 | AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
1930 | } | 1958 | } |
1931 | } | 1959 | } |
1960 | else // Auto return passes through here with null agent | ||
1961 | { | ||
1962 | permissionToTake = true; | ||
1963 | permissionToDelete = true; | ||
1964 | } | ||
1932 | } | 1965 | } |
1933 | else // Auto return passes through here with null agent | 1966 | |
1967 | if (permissionToTake && (!permissionToDelete)) | ||
1968 | takeGroups.Add(grp); | ||
1969 | |||
1970 | if (permissionToDelete) | ||
1934 | { | 1971 | { |
1935 | permissionToTake = true; | 1972 | if (permissionToTake) |
1936 | permissionToDelete = true; | 1973 | deleteGroups.Add(grp); |
1974 | deleteIDs.Add(grp.LocalId); | ||
1937 | } | 1975 | } |
1938 | } | 1976 | } |
1939 | 1977 | ||
1940 | if (permissionToTake) | 1978 | SendKillObject(deleteIDs); |
1979 | |||
1980 | if (deleteGroups.Count > 0) | ||
1941 | { | 1981 | { |
1982 | foreach (SceneObjectGroup g in deleteGroups) | ||
1983 | deleteIDs.Remove(g.LocalId); | ||
1984 | |||
1942 | m_asyncSceneObjectDeleter.DeleteToInventory( | 1985 | m_asyncSceneObjectDeleter.DeleteToInventory( |
1943 | action, destinationID, deleteGroups, remoteClient, | 1986 | action, destinationID, deleteGroups, remoteClient, |
1944 | permissionToDelete); | 1987 | true); |
1988 | } | ||
1989 | if (takeGroups.Count > 0) | ||
1990 | { | ||
1991 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
1992 | action, destinationID, takeGroups, remoteClient, | ||
1993 | false); | ||
1945 | } | 1994 | } |
1946 | else if (permissionToDelete) | 1995 | if (deleteIDs.Count > 0) |
1947 | { | 1996 | { |
1948 | foreach (SceneObjectGroup g in deleteGroups) | 1997 | foreach (SceneObjectGroup g in deleteGroups) |
1949 | DeleteSceneObject(g, false); | 1998 | DeleteSceneObject(g, true); |
1950 | } | 1999 | } |
1951 | } | 2000 | } |
1952 | 2001 | ||
2002 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2003 | { | ||
2004 | itemID = UUID.Zero; | ||
2005 | if (grp != null) | ||
2006 | { | ||
2007 | Vector3 inventoryStoredPosition = new Vector3 | ||
2008 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2009 | ? 250 | ||
2010 | : grp.AbsolutePosition.X) | ||
2011 | , | ||
2012 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2013 | ? 250 | ||
2014 | : grp.AbsolutePosition.X, | ||
2015 | grp.AbsolutePosition.Z); | ||
2016 | |||
2017 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2018 | |||
2019 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2020 | |||
2021 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2022 | |||
2023 | grp.AbsolutePosition = originalPosition; | ||
2024 | |||
2025 | AssetBase asset = CreateAsset( | ||
2026 | grp.GetPartName(grp.LocalId), | ||
2027 | grp.GetPartDescription(grp.LocalId), | ||
2028 | (sbyte)AssetType.Object, | ||
2029 | Utils.StringToBytes(sceneObjectXml), | ||
2030 | remoteClient.AgentId); | ||
2031 | AssetService.Store(asset); | ||
2032 | |||
2033 | InventoryItemBase item = new InventoryItemBase(); | ||
2034 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2035 | item.CreatorData = grp.RootPart.CreatorData; | ||
2036 | item.Owner = remoteClient.AgentId; | ||
2037 | item.ID = UUID.Random(); | ||
2038 | item.AssetID = asset.FullID; | ||
2039 | item.Description = asset.Description; | ||
2040 | item.Name = asset.Name; | ||
2041 | item.AssetType = asset.Type; | ||
2042 | item.InvType = (int)InventoryType.Object; | ||
2043 | |||
2044 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2045 | if (folder != null) | ||
2046 | item.Folder = folder.ID; | ||
2047 | else // oopsies | ||
2048 | item.Folder = UUID.Zero; | ||
2049 | |||
2050 | // Set up base perms properly | ||
2051 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2052 | permsBase &= grp.RootPart.BaseMask; | ||
2053 | permsBase |= (uint)PermissionMask.Move; | ||
2054 | |||
2055 | // Make sure we don't lock it | ||
2056 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2057 | |||
2058 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2059 | { | ||
2060 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2061 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2062 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2063 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2064 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2065 | } | ||
2066 | else | ||
2067 | { | ||
2068 | item.BasePermissions = permsBase; | ||
2069 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2070 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2071 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2072 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2073 | } | ||
2074 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2075 | |||
2076 | // sets itemID so client can show item as 'attached' in inventory | ||
2077 | grp.SetFromItemID(item.ID); | ||
2078 | |||
2079 | if (AddInventoryItem(item)) | ||
2080 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2081 | else | ||
2082 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2083 | |||
2084 | itemID = item.ID; | ||
2085 | return item.AssetID; | ||
2086 | } | ||
2087 | return UUID.Zero; | ||
2088 | } | ||
2089 | |||
1953 | /// <summary> | 2090 | /// <summary> |
1954 | /// Event Handler Rez an object into a scene | 2091 | /// Event Handler Rez an object into a scene |
1955 | /// Calls the non-void event handler | 2092 | /// Calls the non-void event handler |
@@ -2076,6 +2213,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2076 | 2213 | ||
2077 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2214 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2078 | { | 2215 | { |
2216 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2217 | return; | ||
2218 | |||
2079 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2219 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2080 | if (part == null) | 2220 | if (part == null) |
2081 | return; | 2221 | return; |