diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 320 |
1 files changed, 239 insertions, 81 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9ff8467..9776a82 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | return false; | 169 | return false; |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | if (InventoryService.AddItem(item)) | 173 | if (InventoryService.AddItem(item)) |
174 | { | 174 | { |
175 | int userlevel = 0; | 175 | int userlevel = 0; |
@@ -324,8 +324,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
324 | 324 | ||
325 | // Update item with new asset | 325 | // Update item with new asset |
326 | item.AssetID = asset.FullID; | 326 | item.AssetID = asset.FullID; |
327 | if (group.UpdateInventoryItem(item)) | 327 | group.UpdateInventoryItem(item); |
328 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
329 | 328 | ||
330 | part.SendPropertiesToClient(remoteClient); | 329 | part.SendPropertiesToClient(remoteClient); |
331 | 330 | ||
@@ -336,12 +335,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
336 | { | 335 | { |
337 | // Needs to determine which engine was running it and use that | 336 | // Needs to determine which engine was running it and use that |
338 | // | 337 | // |
339 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 338 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); |
340 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
345 | } | 339 | } |
346 | 340 | ||
347 | // Tell anyone managing scripts that a script has been reloaded/changed | 341 | // Tell anyone managing scripts that a script has been reloaded/changed |
@@ -409,6 +403,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | 403 | ||
410 | if (UUID.Zero == transactionID) | 404 | if (UUID.Zero == transactionID) |
411 | { | 405 | { |
406 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); | ||
412 | item.Name = itemUpd.Name; | 407 | item.Name = itemUpd.Name; |
413 | item.Description = itemUpd.Description; | 408 | item.Description = itemUpd.Description; |
414 | 409 | ||
@@ -795,6 +790,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
795 | return; | 790 | return; |
796 | } | 791 | } |
797 | 792 | ||
793 | if (newName == null) newName = item.Name; | ||
794 | |||
798 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 795 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
799 | 796 | ||
800 | if (asset != null) | 797 | if (asset != null) |
@@ -851,6 +848,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
851 | } | 848 | } |
852 | 849 | ||
853 | /// <summary> | 850 | /// <summary> |
851 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
852 | /// </summary> | ||
853 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
854 | { | ||
855 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
856 | foreach (InventoryItemBase b in items) | ||
857 | { | ||
858 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
859 | InventoryItemBase n = InventoryService.GetItem(b); | ||
860 | n.Folder = destfolder; | ||
861 | moveitems.Add(n); | ||
862 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
863 | } | ||
864 | |||
865 | MoveInventoryItem(remoteClient, moveitems); | ||
866 | } | ||
867 | |||
868 | /// <summary> | ||
854 | /// Move an item within the agent's inventory. | 869 | /// Move an item within the agent's inventory. |
855 | /// </summary> | 870 | /// </summary> |
856 | /// <param name="remoteClient"></param> | 871 | /// <param name="remoteClient"></param> |
@@ -1193,6 +1208,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1193 | { | 1208 | { |
1194 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1209 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1195 | 1210 | ||
1211 | // Can't move a null item | ||
1212 | if (itemId == UUID.Zero) | ||
1213 | return; | ||
1214 | |||
1196 | if (null == part) | 1215 | if (null == part) |
1197 | { | 1216 | { |
1198 | m_log.WarnFormat( | 1217 | m_log.WarnFormat( |
@@ -1297,21 +1316,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1297 | return; | 1316 | return; |
1298 | } | 1317 | } |
1299 | 1318 | ||
1300 | if (part.OwnerID != destPart.OwnerID) | 1319 | // Can't transfer this |
1320 | // | ||
1321 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1322 | return; | ||
1323 | |||
1324 | bool overrideNoMod = false; | ||
1325 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1326 | overrideNoMod = true; | ||
1327 | |||
1328 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1301 | { | 1329 | { |
1302 | // Source must have transfer permissions | 1330 | // object cannot copy items to an object owned by a different owner |
1303 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1331 | // unless llAllowInventoryDrop has been called |
1304 | return; | ||
1305 | 1332 | ||
1306 | // Object cannot copy items to an object owned by a different owner | 1333 | return; |
1307 | // unless llAllowInventoryDrop has been called on the destination | ||
1308 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1309 | return; | ||
1310 | } | 1334 | } |
1311 | 1335 | ||
1312 | // must have both move and modify permission to put an item in an object | 1336 | // must have both move and modify permission to put an item in an object |
1313 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1337 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1338 | { | ||
1314 | return; | 1339 | return; |
1340 | } | ||
1315 | 1341 | ||
1316 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1342 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1317 | 1343 | ||
@@ -1367,6 +1393,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1367 | 1393 | ||
1368 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1394 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1369 | { | 1395 | { |
1396 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1397 | if (destPart != null) // Move into a prim | ||
1398 | { | ||
1399 | foreach(UUID itemID in items) | ||
1400 | MoveTaskInventoryItem(destID, host, itemID); | ||
1401 | return destID; // Prim folder ID == prim ID | ||
1402 | } | ||
1403 | |||
1370 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1404 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1371 | 1405 | ||
1372 | UUID newFolderID = UUID.Random(); | 1406 | UUID newFolderID = UUID.Random(); |
@@ -1549,12 +1583,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1549 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1583 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1550 | remoteClient, part, transactionID, currentItem); | 1584 | remoteClient, part, transactionID, currentItem); |
1551 | 1585 | ||
1552 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1586 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1553 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1587 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1554 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1588 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1555 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1589 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1556 | else | 1590 | // else |
1557 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1591 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1558 | } | 1592 | } |
1559 | 1593 | ||
1560 | // Base ALWAYS has move | 1594 | // Base ALWAYS has move |
@@ -1737,7 +1771,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1737 | } | 1771 | } |
1738 | 1772 | ||
1739 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1773 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1740 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1774 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1741 | agentID); | 1775 | agentID); |
1742 | AssetService.Store(asset); | 1776 | AssetService.Store(asset); |
1743 | 1777 | ||
@@ -1893,23 +1927,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1893 | // build a list of eligible objects | 1927 | // build a list of eligible objects |
1894 | List<uint> deleteIDs = new List<uint>(); | 1928 | List<uint> deleteIDs = new List<uint>(); |
1895 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1929 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1896 | 1930 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1897 | // Start with true for both, then remove the flags if objects | ||
1898 | // that we can't derez are part of the selection | ||
1899 | bool permissionToTake = true; | ||
1900 | bool permissionToTakeCopy = true; | ||
1901 | bool permissionToDelete = true; | ||
1902 | 1931 | ||
1903 | foreach (uint localID in localIDs) | 1932 | foreach (uint localID in localIDs) |
1904 | { | 1933 | { |
1934 | // Start with true for both, then remove the flags if objects | ||
1935 | // that we can't derez are part of the selection | ||
1936 | bool permissionToTake = true; | ||
1937 | bool permissionToTakeCopy = true; | ||
1938 | bool permissionToDelete = true; | ||
1939 | |||
1905 | // Invalid id | 1940 | // Invalid id |
1906 | SceneObjectPart part = GetSceneObjectPart(localID); | 1941 | SceneObjectPart part = GetSceneObjectPart(localID); |
1907 | if (part == null) | 1942 | if (part == null) |
1943 | { | ||
1944 | //Client still thinks the object exists, kill it | ||
1945 | deleteIDs.Add(localID); | ||
1908 | continue; | 1946 | continue; |
1947 | } | ||
1909 | 1948 | ||
1910 | // Already deleted by someone else | 1949 | // Already deleted by someone else |
1911 | if (part.ParentGroup.IsDeleted) | 1950 | if (part.ParentGroup.IsDeleted) |
1951 | { | ||
1952 | //Client still thinks the object exists, kill it | ||
1953 | deleteIDs.Add(localID); | ||
1912 | continue; | 1954 | continue; |
1955 | } | ||
1913 | 1956 | ||
1914 | // Can't delete child prims | 1957 | // Can't delete child prims |
1915 | if (part != part.ParentGroup.RootPart) | 1958 | if (part != part.ParentGroup.RootPart) |
@@ -1917,9 +1960,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1917 | 1960 | ||
1918 | SceneObjectGroup grp = part.ParentGroup; | 1961 | SceneObjectGroup grp = part.ParentGroup; |
1919 | 1962 | ||
1920 | deleteIDs.Add(localID); | ||
1921 | deleteGroups.Add(grp); | ||
1922 | |||
1923 | if (remoteClient == null) | 1963 | if (remoteClient == null) |
1924 | { | 1964 | { |
1925 | // Autoreturn has a null client. Nothing else does. So | 1965 | // Autoreturn has a null client. Nothing else does. So |
@@ -1936,81 +1976,193 @@ namespace OpenSim.Region.Framework.Scenes | |||
1936 | } | 1976 | } |
1937 | else | 1977 | else |
1938 | { | 1978 | { |
1939 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1979 | if (action == DeRezAction.TakeCopy) |
1980 | { | ||
1981 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1982 | permissionToTakeCopy = false; | ||
1983 | } | ||
1984 | else | ||
1985 | { | ||
1940 | permissionToTakeCopy = false; | 1986 | permissionToTakeCopy = false; |
1941 | 1987 | } | |
1942 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1988 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1943 | permissionToTake = false; | 1989 | permissionToTake = false; |
1944 | 1990 | ||
1945 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1991 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1946 | permissionToDelete = false; | 1992 | permissionToDelete = false; |
1947 | } | 1993 | } |
1948 | } | ||
1949 | 1994 | ||
1950 | // Handle god perms | 1995 | // Handle god perms |
1951 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 1996 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1952 | { | 1997 | { |
1953 | permissionToTake = true; | 1998 | permissionToTake = true; |
1954 | permissionToTakeCopy = true; | 1999 | permissionToTakeCopy = true; |
1955 | permissionToDelete = true; | 2000 | permissionToDelete = true; |
1956 | } | 2001 | } |
1957 | 2002 | ||
1958 | // If we're re-saving, we don't even want to delete | 2003 | // If we're re-saving, we don't even want to delete |
1959 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 2004 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1960 | permissionToDelete = false; | 2005 | permissionToDelete = false; |
1961 | 2006 | ||
1962 | // if we want to take a copy, we also don't want to delete | 2007 | // if we want to take a copy, we also don't want to delete |
1963 | // Note: after this point, the permissionToTakeCopy flag | 2008 | // Note: after this point, the permissionToTakeCopy flag |
1964 | // becomes irrelevant. It already includes the permissionToTake | 2009 | // becomes irrelevant. It already includes the permissionToTake |
1965 | // permission and after excluding no copy items here, we can | 2010 | // permission and after excluding no copy items here, we can |
1966 | // just use that. | 2011 | // just use that. |
1967 | if (action == DeRezAction.TakeCopy) | 2012 | if (action == DeRezAction.TakeCopy) |
1968 | { | 2013 | { |
1969 | // If we don't have permission, stop right here | 2014 | // If we don't have permission, stop right here |
1970 | if (!permissionToTakeCopy) | 2015 | if (!permissionToTakeCopy) |
1971 | return; | 2016 | return; |
1972 | 2017 | ||
1973 | permissionToTake = true; | 2018 | permissionToTake = true; |
1974 | // Don't delete | 2019 | // Don't delete |
1975 | permissionToDelete = false; | 2020 | permissionToDelete = false; |
1976 | } | 2021 | } |
1977 | 2022 | ||
1978 | if (action == DeRezAction.Return) | 2023 | if (action == DeRezAction.Return) |
1979 | { | ||
1980 | if (remoteClient != null) | ||
1981 | { | 2024 | { |
1982 | if (Permissions.CanReturnObjects( | 2025 | if (remoteClient != null) |
1983 | null, | ||
1984 | remoteClient.AgentId, | ||
1985 | deleteGroups)) | ||
1986 | { | 2026 | { |
1987 | permissionToTake = true; | 2027 | if (Permissions.CanReturnObjects( |
1988 | permissionToDelete = true; | 2028 | null, |
1989 | 2029 | remoteClient.AgentId, | |
1990 | foreach (SceneObjectGroup g in deleteGroups) | 2030 | deleteGroups)) |
1991 | { | 2031 | { |
1992 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2032 | permissionToTake = true; |
2033 | permissionToDelete = true; | ||
2034 | |||
2035 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
1993 | } | 2036 | } |
1994 | } | 2037 | } |
2038 | else // Auto return passes through here with null agent | ||
2039 | { | ||
2040 | permissionToTake = true; | ||
2041 | permissionToDelete = true; | ||
2042 | } | ||
1995 | } | 2043 | } |
1996 | else // Auto return passes through here with null agent | 2044 | |
2045 | if (permissionToTake && (!permissionToDelete)) | ||
2046 | takeGroups.Add(grp); | ||
2047 | |||
2048 | if (permissionToDelete) | ||
1997 | { | 2049 | { |
1998 | permissionToTake = true; | 2050 | if (permissionToTake) |
1999 | permissionToDelete = true; | 2051 | deleteGroups.Add(grp); |
2052 | deleteIDs.Add(grp.LocalId); | ||
2000 | } | 2053 | } |
2001 | } | 2054 | } |
2002 | 2055 | ||
2003 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2056 | SendKillObject(deleteIDs); |
2057 | |||
2058 | if (deleteGroups.Count > 0) | ||
2004 | { | 2059 | { |
2060 | foreach (SceneObjectGroup g in deleteGroups) | ||
2061 | deleteIDs.Remove(g.LocalId); | ||
2062 | |||
2005 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2063 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2006 | action, destinationID, deleteGroups, remoteClient, | 2064 | action, destinationID, deleteGroups, remoteClient, |
2007 | permissionToDelete); | 2065 | true); |
2008 | } | 2066 | } |
2009 | else if (permissionToDelete) | 2067 | if (takeGroups.Count > 0) |
2068 | { | ||
2069 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2070 | action, destinationID, takeGroups, remoteClient, | ||
2071 | false); | ||
2072 | } | ||
2073 | if (deleteIDs.Count > 0) | ||
2010 | { | 2074 | { |
2011 | foreach (SceneObjectGroup g in deleteGroups) | 2075 | foreach (SceneObjectGroup g in deleteGroups) |
2012 | DeleteSceneObject(g, false); | 2076 | DeleteSceneObject(g, true); |
2077 | } | ||
2078 | } | ||
2079 | |||
2080 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2081 | { | ||
2082 | itemID = UUID.Zero; | ||
2083 | if (grp != null) | ||
2084 | { | ||
2085 | Vector3 inventoryStoredPosition = new Vector3 | ||
2086 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2087 | ? 250 | ||
2088 | : grp.AbsolutePosition.X) | ||
2089 | , | ||
2090 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2091 | ? 250 | ||
2092 | : grp.AbsolutePosition.X, | ||
2093 | grp.AbsolutePosition.Z); | ||
2094 | |||
2095 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2096 | |||
2097 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2098 | |||
2099 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2100 | |||
2101 | grp.AbsolutePosition = originalPosition; | ||
2102 | |||
2103 | AssetBase asset = CreateAsset( | ||
2104 | grp.GetPartName(grp.LocalId), | ||
2105 | grp.GetPartDescription(grp.LocalId), | ||
2106 | (sbyte)AssetType.Object, | ||
2107 | Utils.StringToBytes(sceneObjectXml), | ||
2108 | remoteClient.AgentId); | ||
2109 | AssetService.Store(asset); | ||
2110 | |||
2111 | InventoryItemBase item = new InventoryItemBase(); | ||
2112 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2113 | item.CreatorData = grp.RootPart.CreatorData; | ||
2114 | item.Owner = remoteClient.AgentId; | ||
2115 | item.ID = UUID.Random(); | ||
2116 | item.AssetID = asset.FullID; | ||
2117 | item.Description = asset.Description; | ||
2118 | item.Name = asset.Name; | ||
2119 | item.AssetType = asset.Type; | ||
2120 | item.InvType = (int)InventoryType.Object; | ||
2121 | |||
2122 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2123 | if (folder != null) | ||
2124 | item.Folder = folder.ID; | ||
2125 | else // oopsies | ||
2126 | item.Folder = UUID.Zero; | ||
2127 | |||
2128 | // Set up base perms properly | ||
2129 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2130 | permsBase &= grp.RootPart.BaseMask; | ||
2131 | permsBase |= (uint)PermissionMask.Move; | ||
2132 | |||
2133 | // Make sure we don't lock it | ||
2134 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2135 | |||
2136 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2137 | { | ||
2138 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2139 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2140 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2141 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2142 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2143 | } | ||
2144 | else | ||
2145 | { | ||
2146 | item.BasePermissions = permsBase; | ||
2147 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2148 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2149 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2150 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2151 | } | ||
2152 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2153 | |||
2154 | // sets itemID so client can show item as 'attached' in inventory | ||
2155 | grp.FromItemID = item.ID; | ||
2156 | |||
2157 | if (AddInventoryItem(item)) | ||
2158 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2159 | else | ||
2160 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2161 | |||
2162 | itemID = item.ID; | ||
2163 | return item.AssetID; | ||
2013 | } | 2164 | } |
2165 | return UUID.Zero; | ||
2014 | } | 2166 | } |
2015 | 2167 | ||
2016 | /// <summary> | 2168 | /// <summary> |
@@ -2139,6 +2291,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2139 | 2291 | ||
2140 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2292 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2141 | { | 2293 | { |
2294 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2295 | return; | ||
2296 | |||
2142 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2297 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2143 | if (part == null) | 2298 | if (part == null) |
2144 | return; | 2299 | return; |
@@ -2209,7 +2364,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2209 | } | 2364 | } |
2210 | else | 2365 | else |
2211 | { | 2366 | { |
2212 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2367 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2368 | continue; | ||
2369 | |||
2370 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2213 | continue; | 2371 | continue; |
2214 | 2372 | ||
2215 | if (sog.GroupID != groupID) | 2373 | if (sog.GroupID != groupID) |