From bf68255b86093afe68392973054af7c3e2f2121b Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 13 Nov 2008 19:16:15 +0000
Subject: * refactor: rename object inventory permission checks to distinguish
between task inventory and agent inventory
---
.../Modules/World/Permissions/PermissionsModule.cs | 13 ++--
.../Region/Environment/Scenes/Scene.Inventory.cs | 3 +-
.../Environment/Scenes/SceneExternalChecks.cs | 76 +++++++++++++---------
3 files changed, 53 insertions(+), 39 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index b6b7d4a..394690c 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -184,12 +184,11 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
m_scene.ExternalChecks.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED
- m_scene.ExternalChecks.addCheckCanCopyInventory(CanCopyInventory); //NOT YET IMPLEMENTED
- m_scene.ExternalChecks.addCheckCanDeleteInventory(CanDeleteInventory); //NOT YET IMPLEMENTED
- m_scene.ExternalChecks.addCheckCanCreateInventory(CanCreateInventory); //NOT YET IMPLEMENTED
+ m_scene.ExternalChecks.addCheckCanCopyObjectInventory(CanCopyObjectInventory); //NOT YET IMPLEMENTED
+ m_scene.ExternalChecks.addCheckCanDeleteObjectInventory(CanDeleteObjectInventory); //NOT YET IMPLEMENTED
+ m_scene.ExternalChecks.addCheckCanCreateObjectInventory(CanCreateObjectInventory); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED
-
//Register Debug Commands
Command bypassCommand = new Command("bypass", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBypassPermissions, "Force the permissions a specific way to test permissions");
bypassCommand.AddArgument("enable_bypass_perms", "true to enable bypassing all perms", "Boolean");
@@ -1202,7 +1201,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
return true;
}
- public bool CanCopyInventory(UUID itemID, UUID objectID, UUID userID)
+ public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1210,7 +1209,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
return true;
}
- public bool CanDeleteInventory(UUID itemID, UUID objectID, UUID userID)
+ public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1227,7 +1226,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
///
///
///
- public bool CanCreateInventory(int invType, UUID objectID, UUID userID)
+ public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
{
m_log.Debug("[PERMISSIONS]: CanCreateInventory called");
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 19c9d08..d47e068 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1387,7 +1387,8 @@ namespace OpenSim.Region.Environment.Scenes
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
- if (!ExternalChecks.ExternalChecksCanCreateInventory(itemBase.InvType, part.UUID, remoteClient.AgentId))
+ if (!ExternalChecks.ExternalChecksCanCreateObjectInventory(
+ 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}"));
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index c5bbcdd..0e018e8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -1070,51 +1070,63 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
- public delegate bool CanCreateInventory(int invType, UUID objectID, UUID userID);
- private List CanCreateInventoryCheckFunctions = new List();
+ public delegate bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID);
+ private List CanCreateObjectInventoryCheckFunctions
+ = new List();
- public void addCheckCanCreateInventory(CanCreateInventory delegateFunc)
+
+ public void addCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc)
{
- if (!CanCreateInventoryCheckFunctions.Contains(delegateFunc))
- CanCreateInventoryCheckFunctions.Add(delegateFunc);
+ if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
+ CanCreateObjectInventoryCheckFunctions.Add(delegateFunc);
}
- public void removeCheckCanCreateInventory(CanCreateInventory delegateFunc)
+ public void removeCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc)
{
- if (CanCreateInventoryCheckFunctions.Contains(delegateFunc))
- CanCreateInventoryCheckFunctions.Remove(delegateFunc);
+ if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
+ CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc);
}
- public bool ExternalChecksCanCreateInventory(int invType, UUID objectID, UUID userID)
+ ///
+ /// Check whether the specified user is allowed to directly create the given inventory type in a prim's
+ /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). This permission check does not
+ /// apply to existing items that are being dragged in to that prim's inventory.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool ExternalChecksCanCreateObjectInventory(int invType, UUID objectID, UUID userID)
{
- foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions)
+ foreach (CanCreateObjectInventory check in CanCreateObjectInventoryCheckFunctions)
{
if (check(invType, objectID, userID) == false)
{
return false;
}
}
+
return true;
}
- public delegate bool CanCopyInventory(UUID itemID, UUID objectID, UUID userID);
- private List CanCopyInventoryCheckFunctions = new List();
+ public delegate bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID);
+ private List CanCopyObjectInventoryCheckFunctions = new List();
- public void addCheckCanCopyInventory(CanCopyInventory delegateFunc)
+ public void addCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc)
{
- if (!CanCopyInventoryCheckFunctions.Contains(delegateFunc))
- CanCopyInventoryCheckFunctions.Add(delegateFunc);
+ if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
+ CanCopyObjectInventoryCheckFunctions.Add(delegateFunc);
}
- public void removeCheckCanCopyInventory(CanCopyInventory delegateFunc)
+ public void removeCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc)
{
- if (CanCopyInventoryCheckFunctions.Contains(delegateFunc))
- CanCopyInventoryCheckFunctions.Remove(delegateFunc);
+ if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
+ CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc);
}
-
- public bool ExternalChecksCanCopyInventory(UUID itemID, UUID objectID, UUID userID)
+
+ public bool ExternalChecksCanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
- foreach (CanCopyInventory check in CanCopyInventoryCheckFunctions)
+ foreach (CanCopyObjectInventory check in CanCopyObjectInventoryCheckFunctions)
{
if (check(itemID, objectID, userID) == false)
{
@@ -1124,30 +1136,32 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
- public delegate bool CanDeleteInventory(UUID itemID, UUID objectID, UUID userID);
- private List CanDeleteInventoryCheckFunctions = new List();
+ public delegate bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID);
+ private List CanDeleteObjectInventoryCheckFunctions
+ = new List();
- public void addCheckCanDeleteInventory(CanDeleteInventory delegateFunc)
+ public void addCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc)
{
- if (!CanDeleteInventoryCheckFunctions.Contains(delegateFunc))
- CanDeleteInventoryCheckFunctions.Add(delegateFunc);
+ if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
+ CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc);
}
- public void removeCheckCanDeleteInventory(CanDeleteInventory delegateFunc)
+ public void removeCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc)
{
- if (CanDeleteInventoryCheckFunctions.Contains(delegateFunc))
- CanDeleteInventoryCheckFunctions.Remove(delegateFunc);
+ if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
+ CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc);
}
- public bool ExternalChecksCanDeleteInventory(UUID itemID, UUID objectID, UUID userID)
+ public bool ExternalChecksCanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
- foreach (CanDeleteInventory check in CanDeleteInventoryCheckFunctions)
+ foreach (CanDeleteObjectInventory check in CanDeleteObjectInventoryCheckFunctions)
{
if (check(itemID, objectID, userID) == false)
{
return false;
}
}
+
return true;
}
--
cgit v1.1