aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs348
1 files changed, 263 insertions, 85 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 6808017..a9e1fc2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -101,12 +101,12 @@ namespace OpenSim.Region.Framework.Scenes
101 engine.StartProcessing(); 101 engine.StartProcessing();
102 } 102 }
103 103
104 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) 104 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint cost)
105 { 105 {
106 IMoneyModule money = RequestModuleInterface<IMoneyModule>(); 106 IMoneyModule money = RequestModuleInterface<IMoneyModule>();
107 if (money != null) 107 if (money != null)
108 { 108 {
109 money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); 109 money.ApplyUploadCharge(agentID, (int)cost, "Asset upload");
110 } 110 }
111 111
112 AddInventoryItem(item); 112 AddInventoryItem(item);
@@ -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, 1);
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
@@ -407,6 +401,7 @@ namespace OpenSim.Region.Framework.Scenes
407 if (item.Owner != remoteClient.AgentId) 401 if (item.Owner != remoteClient.AgentId)
408 return; 402 return;
409 403
404 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255);
410 item.Name = itemUpd.Name; 405 item.Name = itemUpd.Name;
411 item.Description = itemUpd.Description; 406 item.Description = itemUpd.Description;
412 407
@@ -794,6 +789,8 @@ namespace OpenSim.Region.Framework.Scenes
794 return; 789 return;
795 } 790 }
796 791
792 if (newName == null) newName = item.Name;
793
797 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 794 AssetBase asset = AssetService.Get(item.AssetID.ToString());
798 795
799 if (asset != null) 796 if (asset != null)
@@ -854,6 +851,24 @@ namespace OpenSim.Region.Framework.Scenes
854 } 851 }
855 852
856 /// <summary> 853 /// <summary>
854 /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit)
855 /// </summary>
856 public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder)
857 {
858 List<InventoryItemBase> moveitems = new List<InventoryItemBase>();
859 foreach (InventoryItemBase b in items)
860 {
861 CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null);
862 InventoryItemBase n = InventoryService.GetItem(b);
863 n.Folder = destfolder;
864 moveitems.Add(n);
865 remoteClient.SendInventoryItemCreateUpdate(n, 0);
866 }
867
868 MoveInventoryItem(remoteClient, moveitems);
869 }
870
871 /// <summary>
857 /// Move an item within the agent's inventory. 872 /// Move an item within the agent's inventory.
858 /// </summary> 873 /// </summary>
859 /// <param name="remoteClient"></param> 874 /// <param name="remoteClient"></param>
@@ -888,11 +903,22 @@ namespace OpenSim.Region.Framework.Scenes
888 public void CreateNewInventoryItem( 903 public void CreateNewInventoryItem(
889 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 904 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
890 string name, string description, uint flags, uint callbackID, 905 string name, string description, uint flags, uint callbackID,
891 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) 906 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID)
892 { 907 {
893 CreateNewInventoryItem( 908 CreateNewInventoryItem(
894 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, 909 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
895 (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); 910 (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate, transationID);
911 }
912
913
914 private void CreateNewInventoryItem(
915 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
916 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
917 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
918 {
919 CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID,
920 name, description, flags, callbackID, asset, invType,
921 baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero);
896 } 922 }
897 923
898 /// <summary> 924 /// <summary>
@@ -917,7 +943,7 @@ namespace OpenSim.Region.Framework.Scenes
917 private void CreateNewInventoryItem( 943 private void CreateNewInventoryItem(
918 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 944 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
919 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, 945 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
920 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) 946 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID)
921 { 947 {
922 InventoryItemBase item = new InventoryItemBase(); 948 InventoryItemBase item = new InventoryItemBase();
923 item.Owner = remoteClient.AgentId; 949 item.Owner = remoteClient.AgentId;
@@ -940,7 +966,7 @@ namespace OpenSim.Region.Framework.Scenes
940 966
941 if (AddInventoryItem(item)) 967 if (AddInventoryItem(item))
942 { 968 {
943 remoteClient.SendInventoryItemCreateUpdate(item, callbackID); 969 remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID);
944 } 970 }
945 else 971 else
946 { 972 {
@@ -1215,6 +1241,10 @@ namespace OpenSim.Region.Framework.Scenes
1215 { 1241 {
1216 SceneObjectPart part = GetSceneObjectPart(primLocalId); 1242 SceneObjectPart part = GetSceneObjectPart(primLocalId);
1217 1243
1244 // Can't move a null item
1245 if (itemId == UUID.Zero)
1246 return;
1247
1218 if (null == part) 1248 if (null == part)
1219 { 1249 {
1220 m_log.WarnFormat( 1250 m_log.WarnFormat(
@@ -1319,21 +1349,28 @@ namespace OpenSim.Region.Framework.Scenes
1319 return; 1349 return;
1320 } 1350 }
1321 1351
1322 if (part.OwnerID != destPart.OwnerID) 1352 // Can't transfer this
1353 //
1354 if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
1355 return;
1356
1357 bool overrideNoMod = false;
1358 if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
1359 overrideNoMod = true;
1360
1361 if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1323 { 1362 {
1324 // Source must have transfer permissions 1363 // object cannot copy items to an object owned by a different owner
1325 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) 1364 // unless llAllowInventoryDrop has been called
1326 return;
1327 1365
1328 // Object cannot copy items to an object owned by a different owner 1366 return;
1329 // unless llAllowInventoryDrop has been called on the destination
1330 if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1331 return;
1332 } 1367 }
1333 1368
1334 // must have both move and modify permission to put an item in an object 1369 // must have both move and modify permission to put an item in an object
1335 if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) 1370 if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod))
1371 {
1336 return; 1372 return;
1373 }
1337 1374
1338 TaskInventoryItem destTaskItem = new TaskInventoryItem(); 1375 TaskInventoryItem destTaskItem = new TaskInventoryItem();
1339 1376
@@ -1389,6 +1426,14 @@ namespace OpenSim.Region.Framework.Scenes
1389 1426
1390 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) 1427 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
1391 { 1428 {
1429 SceneObjectPart destPart = GetSceneObjectPart(destID);
1430 if (destPart != null) // Move into a prim
1431 {
1432 foreach(UUID itemID in items)
1433 MoveTaskInventoryItem(destID, host, itemID);
1434 return destID; // Prim folder ID == prim ID
1435 }
1436
1392 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); 1437 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
1393 1438
1394 UUID newFolderID = UUID.Random(); 1439 UUID newFolderID = UUID.Random();
@@ -1571,12 +1616,12 @@ namespace OpenSim.Region.Framework.Scenes
1571 AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( 1616 AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
1572 remoteClient, part, transactionID, currentItem); 1617 remoteClient, part, transactionID, currentItem);
1573 1618
1574 if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) 1619// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
1575 remoteClient.SendAgentAlertMessage("Notecard saved", false); 1620// remoteClient.SendAgentAlertMessage("Notecard saved", false);
1576 else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) 1621// else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
1577 remoteClient.SendAgentAlertMessage("Script saved", false); 1622// remoteClient.SendAgentAlertMessage("Script saved", false);
1578 else 1623// else
1579 remoteClient.SendAgentAlertMessage("Item saved", false); 1624// remoteClient.SendAgentAlertMessage("Item saved", false);
1580 } 1625 }
1581 1626
1582 // Base ALWAYS has move 1627 // Base ALWAYS has move
@@ -1946,23 +1991,32 @@ namespace OpenSim.Region.Framework.Scenes
1946 // build a list of eligible objects 1991 // build a list of eligible objects
1947 List<uint> deleteIDs = new List<uint>(); 1992 List<uint> deleteIDs = new List<uint>();
1948 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); 1993 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
1949 1994 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
1950 // Start with true for both, then remove the flags if objects
1951 // that we can't derez are part of the selection
1952 bool permissionToTake = true;
1953 bool permissionToTakeCopy = true;
1954 bool permissionToDelete = true;
1955 1995
1956 foreach (uint localID in localIDs) 1996 foreach (uint localID in localIDs)
1957 { 1997 {
1998 // Start with true for both, then remove the flags if objects
1999 // that we can't derez are part of the selection
2000 bool permissionToTake = true;
2001 bool permissionToTakeCopy = true;
2002 bool permissionToDelete = true;
2003
1958 // Invalid id 2004 // Invalid id
1959 SceneObjectPart part = GetSceneObjectPart(localID); 2005 SceneObjectPart part = GetSceneObjectPart(localID);
1960 if (part == null) 2006 if (part == null)
2007 {
2008 //Client still thinks the object exists, kill it
2009 deleteIDs.Add(localID);
1961 continue; 2010 continue;
2011 }
1962 2012
1963 // Already deleted by someone else 2013 // Already deleted by someone else
1964 if (part.ParentGroup.IsDeleted) 2014 if (part.ParentGroup.IsDeleted)
2015 {
2016 //Client still thinks the object exists, kill it
2017 deleteIDs.Add(localID);
1965 continue; 2018 continue;
2019 }
1966 2020
1967 // Can't delete child prims 2021 // Can't delete child prims
1968 if (part != part.ParentGroup.RootPart) 2022 if (part != part.ParentGroup.RootPart)
@@ -1970,8 +2024,8 @@ namespace OpenSim.Region.Framework.Scenes
1970 2024
1971 SceneObjectGroup grp = part.ParentGroup; 2025 SceneObjectGroup grp = part.ParentGroup;
1972 2026
1973 deleteIDs.Add(localID); 2027 // If child prims have invalid perms, fix them
1974 deleteGroups.Add(grp); 2028 grp.AdjustChildPrimPermissions();
1975 2029
1976 // If child prims have invalid perms, fix them 2030 // If child prims have invalid perms, fix them
1977 grp.AdjustChildPrimPermissions(); 2031 grp.AdjustChildPrimPermissions();
@@ -1992,81 +2046,193 @@ namespace OpenSim.Region.Framework.Scenes
1992 } 2046 }
1993 else 2047 else
1994 { 2048 {
1995 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) 2049 if (action == DeRezAction.TakeCopy)
2050 {
2051 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
2052 permissionToTakeCopy = false;
2053 }
2054 else
2055 {
1996 permissionToTakeCopy = false; 2056 permissionToTakeCopy = false;
1997 2057 }
1998 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) 2058 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
1999 permissionToTake = false; 2059 permissionToTake = false;
2000 2060
2001 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) 2061 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
2002 permissionToDelete = false; 2062 permissionToDelete = false;
2003 } 2063 }
2004 }
2005 2064
2006 // Handle god perms 2065 // Handle god perms
2007 if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) 2066 if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId))
2008 { 2067 {
2009 permissionToTake = true; 2068 permissionToTake = true;
2010 permissionToTakeCopy = true; 2069 permissionToTakeCopy = true;
2011 permissionToDelete = true; 2070 permissionToDelete = true;
2012 } 2071 }
2013 2072
2014 // If we're re-saving, we don't even want to delete 2073 // If we're re-saving, we don't even want to delete
2015 if (action == DeRezAction.SaveToExistingUserInventoryItem) 2074 if (action == DeRezAction.SaveToExistingUserInventoryItem)
2016 permissionToDelete = false; 2075 permissionToDelete = false;
2017 2076
2018 // if we want to take a copy, we also don't want to delete 2077 // if we want to take a copy, we also don't want to delete
2019 // Note: after this point, the permissionToTakeCopy flag 2078 // Note: after this point, the permissionToTakeCopy flag
2020 // becomes irrelevant. It already includes the permissionToTake 2079 // becomes irrelevant. It already includes the permissionToTake
2021 // permission and after excluding no copy items here, we can 2080 // permission and after excluding no copy items here, we can
2022 // just use that. 2081 // just use that.
2023 if (action == DeRezAction.TakeCopy) 2082 if (action == DeRezAction.TakeCopy)
2024 { 2083 {
2025 // If we don't have permission, stop right here 2084 // If we don't have permission, stop right here
2026 if (!permissionToTakeCopy) 2085 if (!permissionToTakeCopy)
2027 return; 2086 return;
2028 2087
2029 permissionToTake = true; 2088 permissionToTake = true;
2030 // Don't delete 2089 // Don't delete
2031 permissionToDelete = false; 2090 permissionToDelete = false;
2032 } 2091 }
2033 2092
2034 if (action == DeRezAction.Return) 2093 if (action == DeRezAction.Return)
2035 {
2036 if (remoteClient != null)
2037 { 2094 {
2038 if (Permissions.CanReturnObjects( 2095 if (remoteClient != null)
2039 null,
2040 remoteClient.AgentId,
2041 deleteGroups))
2042 { 2096 {
2043 permissionToTake = true; 2097 if (Permissions.CanReturnObjects(
2044 permissionToDelete = true; 2098 null,
2045 2099 remoteClient.AgentId,
2046 foreach (SceneObjectGroup g in deleteGroups) 2100 new List<SceneObjectGroup>() {grp}))
2047 { 2101 {
2048 AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); 2102 permissionToTake = true;
2103 permissionToDelete = true;
2104
2105 AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
2049 } 2106 }
2050 } 2107 }
2108 else // Auto return passes through here with null agent
2109 {
2110 permissionToTake = true;
2111 permissionToDelete = true;
2112 }
2051 } 2113 }
2052 else // Auto return passes through here with null agent 2114
2115 if (permissionToTake && (!permissionToDelete))
2116 takeGroups.Add(grp);
2117
2118 if (permissionToDelete)
2053 { 2119 {
2054 permissionToTake = true; 2120 if (permissionToTake)
2055 permissionToDelete = true; 2121 deleteGroups.Add(grp);
2122 deleteIDs.Add(grp.LocalId);
2056 } 2123 }
2057 } 2124 }
2058 2125
2059 if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) 2126 SendKillObject(deleteIDs);
2127
2128 if (deleteGroups.Count > 0)
2060 { 2129 {
2130 foreach (SceneObjectGroup g in deleteGroups)
2131 deleteIDs.Remove(g.LocalId);
2132
2061 m_asyncSceneObjectDeleter.DeleteToInventory( 2133 m_asyncSceneObjectDeleter.DeleteToInventory(
2062 action, destinationID, deleteGroups, remoteClient, 2134 action, destinationID, deleteGroups, remoteClient,
2063 permissionToDelete); 2135 true);
2136 }
2137 if (takeGroups.Count > 0)
2138 {
2139 m_asyncSceneObjectDeleter.DeleteToInventory(
2140 action, destinationID, takeGroups, remoteClient,
2141 false);
2064 } 2142 }
2065 else if (permissionToDelete) 2143 if (deleteIDs.Count > 0)
2066 { 2144 {
2067 foreach (SceneObjectGroup g in deleteGroups) 2145 foreach (SceneObjectGroup g in deleteGroups)
2068 DeleteSceneObject(g, false); 2146 DeleteSceneObject(g, true);
2147 }
2148 }
2149
2150 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
2151 {
2152 itemID = UUID.Zero;
2153 if (grp != null)
2154 {
2155 Vector3 inventoryStoredPosition = new Vector3
2156 (((grp.AbsolutePosition.X > (int)Constants.RegionSize)
2157 ? 250
2158 : grp.AbsolutePosition.X)
2159 ,
2160 (grp.AbsolutePosition.X > (int)Constants.RegionSize)
2161 ? 250
2162 : grp.AbsolutePosition.X,
2163 grp.AbsolutePosition.Z);
2164
2165 Vector3 originalPosition = grp.AbsolutePosition;
2166
2167 grp.AbsolutePosition = inventoryStoredPosition;
2168
2169 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
2170
2171 grp.AbsolutePosition = originalPosition;
2172
2173 AssetBase asset = CreateAsset(
2174 grp.GetPartName(grp.LocalId),
2175 grp.GetPartDescription(grp.LocalId),
2176 (sbyte)AssetType.Object,
2177 Utils.StringToBytes(sceneObjectXml),
2178 remoteClient.AgentId);
2179 AssetService.Store(asset);
2180
2181 InventoryItemBase item = new InventoryItemBase();
2182 item.CreatorId = grp.RootPart.CreatorID.ToString();
2183 item.CreatorData = grp.RootPart.CreatorData;
2184 item.Owner = remoteClient.AgentId;
2185 item.ID = UUID.Random();
2186 item.AssetID = asset.FullID;
2187 item.Description = asset.Description;
2188 item.Name = asset.Name;
2189 item.AssetType = asset.Type;
2190 item.InvType = (int)InventoryType.Object;
2191
2192 InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object);
2193 if (folder != null)
2194 item.Folder = folder.ID;
2195 else // oopsies
2196 item.Folder = UUID.Zero;
2197
2198 // Set up base perms properly
2199 uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify);
2200 permsBase &= grp.RootPart.BaseMask;
2201 permsBase |= (uint)PermissionMask.Move;
2202
2203 // Make sure we don't lock it
2204 grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move;
2205
2206 if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions())
2207 {
2208 item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask;
2209 item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask;
2210 item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask;
2211 item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
2212 item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
2213 }
2214 else
2215 {
2216 item.BasePermissions = permsBase;
2217 item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask;
2218 item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask;
2219 item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask;
2220 item.GroupPermissions = permsBase & grp.RootPart.GroupMask;
2221 }
2222 item.CreationDate = Util.UnixTimeSinceEpoch();
2223
2224 // sets itemID so client can show item as 'attached' in inventory
2225 grp.FromItemID = item.ID;
2226
2227 if (AddInventoryItem(item))
2228 remoteClient.SendInventoryItemCreateUpdate(item, 0);
2229 else
2230 m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
2231
2232 itemID = item.ID;
2233 return item.AssetID;
2069 } 2234 }
2235 return UUID.Zero;
2070 } 2236 }
2071 2237
2072 /// <summary> 2238 /// <summary>
@@ -2196,6 +2362,9 @@ namespace OpenSim.Region.Framework.Scenes
2196 2362
2197 public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) 2363 public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running)
2198 { 2364 {
2365 if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId))
2366 return;
2367
2199 SceneObjectPart part = GetSceneObjectPart(objectID); 2368 SceneObjectPart part = GetSceneObjectPart(objectID);
2200 if (part == null) 2369 if (part == null)
2201 return; 2370 return;
@@ -2252,7 +2421,10 @@ namespace OpenSim.Region.Framework.Scenes
2252 } 2421 }
2253 else 2422 else
2254 { 2423 {
2255 if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) 2424 if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId)
2425 continue;
2426
2427 if (!Permissions.CanTransferObject(sog.UUID, groupID))
2256 continue; 2428 continue;
2257 2429
2258 if (sog.GroupID != groupID) 2430 if (sog.GroupID != groupID)
@@ -2364,6 +2536,12 @@ namespace OpenSim.Region.Framework.Scenes
2364 } 2536 }
2365 2537
2366 m_sceneGraph.LinkObjects(root, children); 2538 m_sceneGraph.LinkObjects(root, children);
2539
2540 ScenePresence sp;
2541 if (TryGetScenePresence(agentId, out sp))
2542 {
2543 root.SendPropertiesToClient(sp.ControllingClient);
2544 }
2367 } 2545 }
2368 2546
2369 private string PermissionString(uint permissions) 2547 private string PermissionString(uint permissions)