From ef601d805ab948caf1ab4dcf4f5ee2ff640be1df Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 13 Nov 2008 18:52:16 +0000
Subject: * 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
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 24 +++++++++++-----------
.../Environment/Scenes/SceneExternalChecks.cs | 4 ++--
2 files changed, 14 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
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
if (agentTransactions != null)
{
agentTransactions.HandleItemCreationFromTransaction(
- remoteClient, transactionID, folderID, callbackID, description,
- name, invType, assetType, wearableType, nextOwnerMask);
+ remoteClient, transactionID, folderID, callbackID, description,
+ name, invType, assetType, wearableType, nextOwnerMask);
}
-
-
}
}
@@ -1002,7 +1000,6 @@ namespace OpenSim.Region.Environment.Scenes
///
public void MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId)
{
-
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId);
if (agentItem == null)
@@ -1316,17 +1313,17 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- /// Rez a script into a prim's inventory
+ /// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory
///
///
///
///
public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID)
{
- UUID itemID=itemBase.ID;
+ UUID itemID = itemBase.ID;
UUID copyID = UUID.Random();
- if (itemID != UUID.Zero)
+ if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's pinventory
{
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
@@ -1378,9 +1375,9 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
- else // If the itemID is zero then the script has been rezzed directly in an object's inventory
- {
- SceneObjectPart part=GetSceneObjectPart(itemBase.Folder);
+ else // script has been rezzed directly into a prim's inventory
+ {
+ SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
if (part == null)
return;
@@ -1389,11 +1386,14 @@ namespace OpenSim.Region.Environment.Scenes
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
+
+ if (!ExternalChecks.ExternalChecksCanCreateInventory(itemBase.InvType, part.UUID, remoteClient.AgentId))
+ return;
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}"));
AssetCache.AddAsset(asset);
- TaskInventoryItem taskItem=new TaskInventoryItem();
+ TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ResetIDs(itemBase.Folder);
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
#endregion
- public delegate bool CanCreateInventory(uint invType, UUID objectID, UUID userID);
+ public delegate bool CanCreateInventory(int invType, UUID objectID, UUID userID);
private List CanCreateInventoryCheckFunctions = new List();
public void addCheckCanCreateInventory(CanCreateInventory delegateFunc)
@@ -1085,7 +1085,7 @@ namespace OpenSim.Region.Environment.Scenes
CanCreateInventoryCheckFunctions.Remove(delegateFunc);
}
- public bool ExternalChecksCanCreateInventory(uint invType, UUID objectID, UUID userID)
+ public bool ExternalChecksCanCreateInventory(int invType, UUID objectID, UUID userID)
{
foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions)
{
--
cgit v1.1