aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-13 18:52:16 +0000
committerJustin Clarke Casey2008-11-13 18:52:16 +0000
commitef601d805ab948caf1ab4dcf4f5ee2ff640be1df (patch)
tree8c7c5390eac69b258c28ecab121a94ad566446e3 /OpenSim/Region/Environment/Scenes
parent* Attempt to make OpenSim.ini.example a bit more readable by (diff)
downloadopensim-SC-ef601d805ab948caf1ab4dcf4f5ee2ff640be1df.zip
opensim-SC-ef601d805ab948caf1ab4dcf4f5ee2ff640be1df.tar.gz
opensim-SC-ef601d805ab948caf1ab4dcf4f5ee2ff640be1df.tar.bz2
opensim-SC-ef601d805ab948caf1ab4dcf4f5ee2ff640be1df.tar.xz
* First part of a series of patches
* Intension is to provide a way to lock down script creation to administrators/gods only * Defaults will remain as they are at the moment
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs24
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs4
2 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index c6ad94c..0e28b0c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -799,11 +799,9 @@ namespace OpenSim.Region.Environment.Scenes
799 if (agentTransactions != null) 799 if (agentTransactions != null)
800 { 800 {
801 agentTransactions.HandleItemCreationFromTransaction( 801 agentTransactions.HandleItemCreationFromTransaction(
802 remoteClient, transactionID, folderID, callbackID, description, 802 remoteClient, transactionID, folderID, callbackID, description,
803 name, invType, assetType, wearableType, nextOwnerMask); 803 name, invType, assetType, wearableType, nextOwnerMask);
804 } 804 }
805
806
807 } 805 }
808 } 806 }
809 807
@@ -1002,7 +1000,6 @@ namespace OpenSim.Region.Environment.Scenes
1002 /// <param name="itemID"></param> 1000 /// <param name="itemID"></param>
1003 public void MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) 1001 public void MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId)
1004 { 1002 {
1005
1006 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); 1003 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId);
1007 1004
1008 if (agentItem == null) 1005 if (agentItem == null)
@@ -1316,17 +1313,17 @@ namespace OpenSim.Region.Environment.Scenes
1316 } 1313 }
1317 1314
1318 /// <summary> 1315 /// <summary>
1319 /// Rez a script into a prim's inventory 1316 /// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory
1320 /// </summary> 1317 /// </summary>
1321 /// <param name="remoteClient"></param> 1318 /// <param name="remoteClient"></param>
1322 /// <param name="itemID"> </param> 1319 /// <param name="itemID"> </param>
1323 /// <param name="localID"></param> 1320 /// <param name="localID"></param>
1324 public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID) 1321 public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID)
1325 { 1322 {
1326 UUID itemID=itemBase.ID; 1323 UUID itemID = itemBase.ID;
1327 UUID copyID = UUID.Random(); 1324 UUID copyID = UUID.Random();
1328 1325
1329 if (itemID != UUID.Zero) 1326 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's pinventory
1330 { 1327 {
1331 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 1328 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
1332 1329
@@ -1378,9 +1375,9 @@ namespace OpenSim.Region.Environment.Scenes
1378 } 1375 }
1379 } 1376 }
1380 } 1377 }
1381 else // If the itemID is zero then the script has been rezzed directly in an object's inventory 1378 else // script has been rezzed directly into a prim's inventory
1382 { 1379 {
1383 SceneObjectPart part=GetSceneObjectPart(itemBase.Folder); 1380 SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
1384 if (part == null) 1381 if (part == null)
1385 return; 1382 return;
1386 1383
@@ -1389,11 +1386,14 @@ namespace OpenSim.Region.Environment.Scenes
1389 1386
1390 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 1387 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
1391 return; 1388 return;
1389
1390 if (!ExternalChecks.ExternalChecksCanCreateInventory(itemBase.InvType, part.UUID, remoteClient.AgentId))
1391 return;
1392 1392
1393 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); 1393 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"));
1394 AssetCache.AddAsset(asset); 1394 AssetCache.AddAsset(asset);
1395 1395
1396 TaskInventoryItem taskItem=new TaskInventoryItem(); 1396 TaskInventoryItem taskItem = new TaskInventoryItem();
1397 1397
1398 taskItem.ResetIDs(itemBase.Folder); 1398 taskItem.ResetIDs(itemBase.Folder);
1399 taskItem.ParentID = itemBase.Folder; 1399 taskItem.ParentID = itemBase.Folder;
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index f8d041a..c5bbcdd 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -1070,7 +1070,7 @@ namespace OpenSim.Region.Environment.Scenes
1070 1070
1071 #endregion 1071 #endregion
1072 1072
1073 public delegate bool CanCreateInventory(uint invType, UUID objectID, UUID userID); 1073 public delegate bool CanCreateInventory(int invType, UUID objectID, UUID userID);
1074 private List<CanCreateInventory> CanCreateInventoryCheckFunctions = new List<CanCreateInventory>(); 1074 private List<CanCreateInventory> CanCreateInventoryCheckFunctions = new List<CanCreateInventory>();
1075 1075
1076 public void addCheckCanCreateInventory(CanCreateInventory delegateFunc) 1076 public void addCheckCanCreateInventory(CanCreateInventory delegateFunc)
@@ -1085,7 +1085,7 @@ namespace OpenSim.Region.Environment.Scenes
1085 CanCreateInventoryCheckFunctions.Remove(delegateFunc); 1085 CanCreateInventoryCheckFunctions.Remove(delegateFunc);
1086 } 1086 }
1087 1087
1088 public bool ExternalChecksCanCreateInventory(uint invType, UUID objectID, UUID userID) 1088 public bool ExternalChecksCanCreateInventory(int invType, UUID objectID, UUID userID)
1089 { 1089 {
1090 foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions) 1090 foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions)
1091 { 1091 {