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 6c79b13..70018c8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -102,12 +102,12 @@ namespace OpenSim.Region.Framework.Scenes
102 engine.StartProcessing(); 102 engine.StartProcessing();
103 } 103 }
104 104
105 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) 105 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint cost)
106 { 106 {
107 IMoneyModule money = RequestModuleInterface<IMoneyModule>(); 107 IMoneyModule money = RequestModuleInterface<IMoneyModule>();
108 if (money != null) 108 if (money != null)
109 { 109 {
110 money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); 110 money.ApplyUploadCharge(agentID, (int)cost, "Asset upload");
111 } 111 }
112 112
113 AddInventoryItem(item); 113 AddInventoryItem(item);
@@ -170,7 +170,7 @@ namespace OpenSim.Region.Framework.Scenes
170 return false; 170 return false;
171 } 171 }
172 } 172 }
173 173
174 if (InventoryService.AddItem(item)) 174 if (InventoryService.AddItem(item))
175 { 175 {
176 int userlevel = 0; 176 int userlevel = 0;
@@ -325,8 +325,7 @@ namespace OpenSim.Region.Framework.Scenes
325 325
326 // Update item with new asset 326 // Update item with new asset
327 item.AssetID = asset.FullID; 327 item.AssetID = asset.FullID;
328 if (group.UpdateInventoryItem(item)) 328 group.UpdateInventoryItem(item);
329 remoteClient.SendAgentAlertMessage("Script saved", false);
330 329
331 part.SendPropertiesToClient(remoteClient); 330 part.SendPropertiesToClient(remoteClient);
332 331
@@ -337,12 +336,7 @@ namespace OpenSim.Region.Framework.Scenes
337 { 336 {
338 // Needs to determine which engine was running it and use that 337 // Needs to determine which engine was running it and use that
339 // 338 //
340 part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); 339 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 1);
341 errors = part.Inventory.GetScriptErrors(item.ItemID);
342 }
343 else
344 {
345 remoteClient.SendAgentAlertMessage("Script saved", false);
346 } 340 }
347 341
348 // Tell anyone managing scripts that a script has been reloaded/changed 342 // Tell anyone managing scripts that a script has been reloaded/changed
@@ -408,6 +402,7 @@ namespace OpenSim.Region.Framework.Scenes
408 if (item.Owner != remoteClient.AgentId) 402 if (item.Owner != remoteClient.AgentId)
409 return; 403 return;
410 404
405 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255);
411 item.Name = itemUpd.Name; 406 item.Name = itemUpd.Name;
412 item.Description = itemUpd.Description; 407 item.Description = itemUpd.Description;
413 408
@@ -838,6 +833,8 @@ namespace OpenSim.Region.Framework.Scenes
838 return; 833 return;
839 } 834 }
840 835
836 if (newName == null) newName = item.Name;
837
841 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 838 AssetBase asset = AssetService.Get(item.AssetID.ToString());
842 839
843 if (asset != null) 840 if (asset != null)
@@ -898,6 +895,24 @@ namespace OpenSim.Region.Framework.Scenes
898 } 895 }
899 896
900 /// <summary> 897 /// <summary>
898 /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit)
899 /// </summary>
900 public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder)
901 {
902 List<InventoryItemBase> moveitems = new List<InventoryItemBase>();
903 foreach (InventoryItemBase b in items)
904 {
905 CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null);
906 InventoryItemBase n = InventoryService.GetItem(b);
907 n.Folder = destfolder;
908 moveitems.Add(n);
909 remoteClient.SendInventoryItemCreateUpdate(n, 0);
910 }
911
912 MoveInventoryItem(remoteClient, moveitems);
913 }
914
915 /// <summary>
901 /// Move an item within the agent's inventory. 916 /// Move an item within the agent's inventory.
902 /// </summary> 917 /// </summary>
903 /// <param name="remoteClient"></param> 918 /// <param name="remoteClient"></param>
@@ -932,11 +947,22 @@ namespace OpenSim.Region.Framework.Scenes
932 public void CreateNewInventoryItem( 947 public void CreateNewInventoryItem(
933 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 948 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
934 string name, string description, uint flags, uint callbackID, 949 string name, string description, uint flags, uint callbackID,
935 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) 950 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID)
936 { 951 {
937 CreateNewInventoryItem( 952 CreateNewInventoryItem(
938 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, 953 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
939 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); 954 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, transationID);
955 }
956
957
958 private void CreateNewInventoryItem(
959 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
960 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
961 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
962 {
963 CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID,
964 name, description, flags, callbackID, asset, invType,
965 baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero);
940 } 966 }
941 967
942 /// <summary> 968 /// <summary>
@@ -961,7 +987,7 @@ namespace OpenSim.Region.Framework.Scenes
961 private void CreateNewInventoryItem( 987 private void CreateNewInventoryItem(
962 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 988 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
963 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, 989 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
964 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) 990 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID)
965 { 991 {
966 InventoryItemBase item = new InventoryItemBase(); 992 InventoryItemBase item = new InventoryItemBase();
967 item.Owner = remoteClient.AgentId; 993 item.Owner = remoteClient.AgentId;
@@ -984,7 +1010,7 @@ namespace OpenSim.Region.Framework.Scenes
984 1010
985 if (AddInventoryItem(item)) 1011 if (AddInventoryItem(item))
986 { 1012 {
987 remoteClient.SendInventoryItemCreateUpdate(item, callbackID); 1013 remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID);
988 } 1014 }
989 else 1015 else
990 { 1016 {
@@ -1259,6 +1285,10 @@ namespace OpenSim.Region.Framework.Scenes
1259 { 1285 {
1260 SceneObjectPart part = GetSceneObjectPart(primLocalId); 1286 SceneObjectPart part = GetSceneObjectPart(primLocalId);
1261 1287
1288 // Can't move a null item
1289 if (itemId == UUID.Zero)
1290 return;
1291
1262 if (null == part) 1292 if (null == part)
1263 { 1293 {
1264 m_log.WarnFormat( 1294 m_log.WarnFormat(
@@ -1363,21 +1393,28 @@ namespace OpenSim.Region.Framework.Scenes
1363 return; 1393 return;
1364 } 1394 }
1365 1395
1366 if (part.OwnerID != destPart.OwnerID) 1396 // Can't transfer this
1397 //
1398 if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
1399 return;
1400
1401 bool overrideNoMod = false;
1402 if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
1403 overrideNoMod = true;
1404
1405 if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1367 { 1406 {
1368 // Source must have transfer permissions 1407 // object cannot copy items to an object owned by a different owner
1369 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) 1408 // unless llAllowInventoryDrop has been called
1370 return;
1371 1409
1372 // Object cannot copy items to an object owned by a different owner 1410 return;
1373 // unless llAllowInventoryDrop has been called on the destination
1374 if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1375 return;
1376 } 1411 }
1377 1412
1378 // must have both move and modify permission to put an item in an object 1413 // must have both move and modify permission to put an item in an object
1379 if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) 1414 if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod))
1415 {
1380 return; 1416 return;
1417 }
1381 1418
1382 TaskInventoryItem destTaskItem = new TaskInventoryItem(); 1419 TaskInventoryItem destTaskItem = new TaskInventoryItem();
1383 1420
@@ -1433,6 +1470,14 @@ namespace OpenSim.Region.Framework.Scenes
1433 1470
1434 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) 1471 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
1435 { 1472 {
1473 SceneObjectPart destPart = GetSceneObjectPart(destID);
1474 if (destPart != null) // Move into a prim
1475 {
1476 foreach(UUID itemID in items)
1477 MoveTaskInventoryItem(destID, host, itemID);
1478 return destID; // Prim folder ID == prim ID
1479 }
1480
1436 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); 1481 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
1437 1482
1438 UUID newFolderID = UUID.Random(); 1483 UUID newFolderID = UUID.Random();
@@ -1615,12 +1660,12 @@ namespace OpenSim.Region.Framework.Scenes
1615 AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( 1660 AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
1616 remoteClient, part, transactionID, currentItem); 1661 remoteClient, part, transactionID, currentItem);
1617 1662
1618 if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) 1663// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
1619 remoteClient.SendAgentAlertMessage("Notecard saved", false); 1664// remoteClient.SendAgentAlertMessage("Notecard saved", false);
1620 else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) 1665// else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
1621 remoteClient.SendAgentAlertMessage("Script saved", false); 1666// remoteClient.SendAgentAlertMessage("Script saved", false);
1622 else 1667// else
1623 remoteClient.SendAgentAlertMessage("Item saved", false); 1668// remoteClient.SendAgentAlertMessage("Item saved", false);
1624 } 1669 }
1625 1670
1626 // Base ALWAYS has move 1671 // Base ALWAYS has move
@@ -1990,23 +2035,32 @@ namespace OpenSim.Region.Framework.Scenes
1990 // build a list of eligible objects 2035 // build a list of eligible objects
1991 List<uint> deleteIDs = new List<uint>(); 2036 List<uint> deleteIDs = new List<uint>();
1992 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); 2037 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
1993 2038 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
1994 // Start with true for both, then remove the flags if objects
1995 // that we can't derez are part of the selection
1996 bool permissionToTake = true;
1997 bool permissionToTakeCopy = true;
1998 bool permissionToDelete = true;
1999 2039
2000 foreach (uint localID in localIDs) 2040 foreach (uint localID in localIDs)
2001 { 2041 {
2042 // Start with true for both, then remove the flags if objects
2043 // that we can't derez are part of the selection
2044 bool permissionToTake = true;
2045 bool permissionToTakeCopy = true;
2046 bool permissionToDelete = true;
2047
2002 // Invalid id 2048 // Invalid id
2003 SceneObjectPart part = GetSceneObjectPart(localID); 2049 SceneObjectPart part = GetSceneObjectPart(localID);
2004 if (part == null) 2050 if (part == null)
2051 {
2052 //Client still thinks the object exists, kill it
2053 deleteIDs.Add(localID);
2005 continue; 2054 continue;
2055 }
2006 2056
2007 // Already deleted by someone else 2057 // Already deleted by someone else
2008 if (part.ParentGroup.IsDeleted) 2058 if (part.ParentGroup.IsDeleted)
2059 {
2060 //Client still thinks the object exists, kill it
2061 deleteIDs.Add(localID);
2009 continue; 2062 continue;
2063 }
2010 2064
2011 // Can't delete child prims 2065 // Can't delete child prims
2012 if (part != part.ParentGroup.RootPart) 2066 if (part != part.ParentGroup.RootPart)
@@ -2014,8 +2068,8 @@ namespace OpenSim.Region.Framework.Scenes
2014 2068
2015 SceneObjectGroup grp = part.ParentGroup; 2069 SceneObjectGroup grp = part.ParentGroup;
2016 2070
2017 deleteIDs.Add(localID); 2071 // If child prims have invalid perms, fix them
2018 deleteGroups.Add(grp); 2072 grp.AdjustChildPrimPermissions();
2019 2073
2020 // If child prims have invalid perms, fix them 2074 // If child prims have invalid perms, fix them
2021 grp.AdjustChildPrimPermissions(); 2075 grp.AdjustChildPrimPermissions();
@@ -2036,81 +2090,193 @@ namespace OpenSim.Region.Framework.Scenes
2036 } 2090 }
2037 else 2091 else
2038 { 2092 {
2039 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) 2093 if (action == DeRezAction.TakeCopy)
2094 {
2095 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
2096 permissionToTakeCopy = false;
2097 }
2098 else
2099 {
2040 permissionToTakeCopy = false; 2100 permissionToTakeCopy = false;
2041 2101 }
2042 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) 2102 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
2043 permissionToTake = false; 2103 permissionToTake = false;
2044 2104
2045 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) 2105 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
2046 permissionToDelete = false; 2106 permissionToDelete = false;
2047 } 2107 }
2048 }
2049 2108
2050 // Handle god perms 2109 // Handle god perms
2051 if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) 2110 if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId))
2052 { 2111 {
2053 permissionToTake = true; 2112 permissionToTake = true;
2054 permissionToTakeCopy = true; 2113 permissionToTakeCopy = true;
2055 permissionToDelete = true; 2114 permissionToDelete = true;
2056 } 2115 }
2057 2116
2058 // If we're re-saving, we don't even want to delete 2117 // If we're re-saving, we don't even want to delete
2059 if (action == DeRezAction.SaveToExistingUserInventoryItem) 2118 if (action == DeRezAction.SaveToExistingUserInventoryItem)
2060 permissionToDelete = false; 2119 permissionToDelete = false;
2061 2120
2062 // if we want to take a copy, we also don't want to delete 2121 // if we want to take a copy, we also don't want to delete
2063 // Note: after this point, the permissionToTakeCopy flag 2122 // Note: after this point, the permissionToTakeCopy flag
2064 // becomes irrelevant. It already includes the permissionToTake 2123 // becomes irrelevant. It already includes the permissionToTake
2065 // permission and after excluding no copy items here, we can 2124 // permission and after excluding no copy items here, we can
2066 // just use that. 2125 // just use that.
2067 if (action == DeRezAction.TakeCopy) 2126 if (action == DeRezAction.TakeCopy)
2068 { 2127 {
2069 // If we don't have permission, stop right here 2128 // If we don't have permission, stop right here
2070 if (!permissionToTakeCopy) 2129 if (!permissionToTakeCopy)
2071 return; 2130 return;
2072 2131
2073 permissionToTake = true; 2132 permissionToTake = true;
2074 // Don't delete 2133 // Don't delete
2075 permissionToDelete = false; 2134 permissionToDelete = false;
2076 } 2135 }
2077 2136
2078 if (action == DeRezAction.Return) 2137 if (action == DeRezAction.Return)
2079 {
2080 if (remoteClient != null)
2081 { 2138 {
2082 if (Permissions.CanReturnObjects( 2139 if (remoteClient != null)
2083 null,
2084 remoteClient.AgentId,
2085 deleteGroups))
2086 { 2140 {
2087 permissionToTake = true; 2141 if (Permissions.CanReturnObjects(
2088 permissionToDelete = true; 2142 null,
2089 2143 remoteClient.AgentId,
2090 foreach (SceneObjectGroup g in deleteGroups) 2144 new List<SceneObjectGroup>() {grp}))
2091 { 2145 {
2092 AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); 2146 permissionToTake = true;
2147 permissionToDelete = true;
2148
2149 AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
2093 } 2150 }
2094 } 2151 }
2152 else // Auto return passes through here with null agent
2153 {
2154 permissionToTake = true;
2155 permissionToDelete = true;
2156 }
2095 } 2157 }
2096 else // Auto return passes through here with null agent 2158
2159 if (permissionToTake && (!permissionToDelete))
2160 takeGroups.Add(grp);
2161
2162 if (permissionToDelete)
2097 { 2163 {
2098 permissionToTake = true; 2164 if (permissionToTake)
2099 permissionToDelete = true; 2165 deleteGroups.Add(grp);
2166 deleteIDs.Add(grp.LocalId);
2100 } 2167 }
2101 } 2168 }
2102 2169
2103 if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) 2170 SendKillObject(deleteIDs);
2171
2172 if (deleteGroups.Count > 0)
2104 { 2173 {
2174 foreach (SceneObjectGroup g in deleteGroups)
2175 deleteIDs.Remove(g.LocalId);
2176
2105 m_asyncSceneObjectDeleter.DeleteToInventory( 2177 m_asyncSceneObjectDeleter.DeleteToInventory(
2106 action, destinationID, deleteGroups, remoteClient, 2178 action, destinationID, deleteGroups, remoteClient,
2107 permissionToDelete); 2179 true);
2180 }
2181 if (takeGroups.Count > 0)
2182 {
2183 m_asyncSceneObjectDeleter.DeleteToInventory(
2184 action, destinationID, takeGroups, remoteClient,
2185 false);
2108 } 2186 }
2109 else if (permissionToDelete) 2187 if (deleteIDs.Count > 0)
2110 { 2188 {
2111 foreach (SceneObjectGroup g in deleteGroups) 2189 foreach (SceneObjectGroup g in deleteGroups)
2112 DeleteSceneObject(g, false); 2190 DeleteSceneObject(g, true);
2191 }
2192 }
2193
2194 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
2195 {
2196 itemID = UUID.Zero;
2197 if (grp != null)
2198 {
2199 Vector3 inventoryStoredPosition = new Vector3
2200 (((grp.AbsolutePosition.X > (int)Constants.RegionSize)
2201 ? 250
2202 : grp.AbsolutePosition.X)
2203 ,
2204 (grp.AbsolutePosition.X > (int)Constants.RegionSize)
2205 ? 250
2206 : grp.AbsolutePosition.X,
2207 grp.AbsolutePosition.Z);
2208
2209 Vector3 originalPosition = grp.AbsolutePosition;
2210
2211 grp.AbsolutePosition = inventoryStoredPosition;
2212
2213 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
2214
2215 grp.AbsolutePosition = originalPosition;
2216
2217 AssetBase asset = CreateAsset(
2218 grp.GetPartName(grp.LocalId),
2219 grp.GetPartDescription(grp.LocalId),
2220 (sbyte)AssetType.Object,
2221 Utils.StringToBytes(sceneObjectXml),
2222 remoteClient.AgentId);
2223 AssetService.Store(asset);
2224
2225 InventoryItemBase item = new InventoryItemBase();
2226 item.CreatorId = grp.RootPart.CreatorID.ToString();
2227 item.CreatorData = grp.RootPart.CreatorData;
2228 item.Owner = remoteClient.AgentId;
2229 item.ID = UUID.Random();
2230 item.AssetID = asset.FullID;
2231 item.Description = asset.Description;
2232 item.Name = asset.Name;
2233 item.AssetType = asset.Type;
2234 item.InvType = (int)InventoryType.Object;
2235
2236 InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object);
2237 if (folder != null)
2238 item.Folder = folder.ID;
2239 else // oopsies
2240 item.Folder = UUID.Zero;
2241
2242 // Set up base perms properly
2243 uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify);
2244 permsBase &= grp.RootPart.BaseMask;
2245 permsBase |= (uint)PermissionMask.Move;
2246
2247 // Make sure we don't lock it
2248 grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move;
2249
2250 if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions())
2251 {
2252 item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask;
2253 item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask;
2254 item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask;
2255 item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
2256 item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
2257 }
2258 else
2259 {
2260 item.BasePermissions = permsBase;
2261 item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask;
2262 item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask;
2263 item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask;
2264 item.GroupPermissions = permsBase & grp.RootPart.GroupMask;
2265 }
2266 item.CreationDate = Util.UnixTimeSinceEpoch();
2267
2268 // sets itemID so client can show item as 'attached' in inventory
2269 grp.FromItemID = item.ID;
2270
2271 if (AddInventoryItem(item))
2272 remoteClient.SendInventoryItemCreateUpdate(item, 0);
2273 else
2274 m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
2275
2276 itemID = item.ID;
2277 return item.AssetID;
2113 } 2278 }
2279 return UUID.Zero;
2114 } 2280 }
2115 2281
2116 /// <summary> 2282 /// <summary>
@@ -2240,6 +2406,9 @@ namespace OpenSim.Region.Framework.Scenes
2240 2406
2241 public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) 2407 public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running)
2242 { 2408 {
2409 if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId))
2410 return;
2411
2243 SceneObjectPart part = GetSceneObjectPart(objectID); 2412 SceneObjectPart part = GetSceneObjectPart(objectID);
2244 if (part == null) 2413 if (part == null)
2245 return; 2414 return;
@@ -2296,7 +2465,10 @@ namespace OpenSim.Region.Framework.Scenes
2296 } 2465 }
2297 else 2466 else
2298 { 2467 {
2299 if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) 2468 if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId)
2469 continue;
2470
2471 if (!Permissions.CanTransferObject(sog.UUID, groupID))
2300 continue; 2472 continue;
2301 2473
2302 if (sog.GroupID != groupID) 2474 if (sog.GroupID != groupID)
@@ -2408,6 +2580,12 @@ namespace OpenSim.Region.Framework.Scenes
2408 } 2580 }
2409 2581
2410 m_sceneGraph.LinkObjects(root, children); 2582 m_sceneGraph.LinkObjects(root, children);
2583
2584 ScenePresence sp;
2585 if (TryGetScenePresence(agentId, out sp))
2586 {
2587 root.SendPropertiesToClient(sp.ControllingClient);
2588 }
2411 } 2589 }
2412 2590
2413 private string PermissionString(uint permissions) 2591 private string PermissionString(uint permissions)