diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 394690c06f..8ecea9eca3 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -186,7 +186,10 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //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.addCheckCanCreateAvatarInventory(CanCreateAvatarInventory); //NOT YET IMPLEMENTED
+ m_scene.ExternalChecks.addCheckCanCopyAvatarInventory(CanCopyAvatarInventory); //NOT YET IMPLEMENTED
+ m_scene.ExternalChecks.addCheckCanEditAvatarInventory(CanEditAvatarInventory); //NOT YET IMPLEMENTED
+ m_scene.ExternalChecks.addCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED
//Register Debug Commands
@@ -1219,8 +1222,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
///
/// 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.
+ /// inventory (e.g. the New Script button in the 1.21 Linden Lab client).
///
///
///
@@ -1228,13 +1230,71 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
///
public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
{
- m_log.Debug("[PERMISSIONS]: CanCreateInventory called");
+ //m_log.Debug("[PERMISSIONS]: CanCreateObjectInventory called");
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return true;
}
+
+ ///
+ /// Check whether the specified user is allowed to create the given inventory type in their inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool CanCreateAvatarInventory(int invType, UUID userID)
+ {
+ //m_log.Debug("[PERMISSIONS]: CanCreateAvatarInventory called");
+
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ return true;
+ }
+
+ ///
+ /// Check whether the specified user is allowed to copy the given inventory type in their inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool CanCopyAvatarInventory(UUID itemID, UUID userID)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ return true;
+ }
+
+ ///
+ /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool CanEditAvatarInventory(UUID itemID, UUID userID)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ return true;
+ }
+
+ ///
+ /// Check whether the specified user is allowed to delete the given inventory item from their own inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool CanDeleteAvatarInventory(UUID itemID, UUID userID)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ return true;
+ }
public bool CanTeleport(UUID userID)
{
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index d47e0681ea..e548f36419 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -759,8 +759,11 @@ namespace OpenSim.Region.Environment.Scenes
sbyte assetType,
byte wearableType, uint nextOwnerMask, int creationDate)
{
-// m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID);
+ m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID);
+ if (!ExternalChecks.ExternalChecksCanCreateAvatarInventory(invType, remoteClient.AgentId))
+ return;
+
if (transactionID == UUID.Zero)
{
CachedUserInfo userInfo
@@ -771,14 +774,16 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence presence;
TryGetAvatar(remoteClient.AgentId, out presence);
byte[] data = null;
+
if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum
{
- Vector3 pos=presence.AbsolutePosition;
- string strdata=String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
+ Vector3 pos = presence.AbsolutePosition;
+ string strdata = String.Format(
+ "Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
presence.Scene.RegionInfo.RegionID,
pos.X, pos.Y, pos.Z,
presence.RegionHandle);
- data=Encoding.ASCII.GetBytes(strdata);
+ data = Encoding.ASCII.GetBytes(strdata);
}
AssetBase asset = CreateAsset(name, description, assetType, data);
@@ -1245,9 +1250,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null)
{
if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
- {
return;
- }
TaskInventoryItem currentItem = part.GetInventoryItem(itemID);
@@ -1344,9 +1347,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null)
{
if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
- {
return;
- }
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
// TODO: switch to posting on_rez here when scripts
@@ -1573,7 +1574,6 @@ namespace OpenSim.Region.Environment.Scenes
//If they can take, they can delete!
permissionToDelete = permissionToTake;
}
-
else if (destination == 6) //Delete
{
permissionToTake =
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index 0e018e8c4a..cc627b0c40 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -1089,8 +1089,7 @@ namespace OpenSim.Region.Environment.Scenes
///
/// 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.
+ /// inventory (e.g. the New Script button in the 1.21 Linden Lab client).
///
///
///
@@ -1164,7 +1163,147 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
+
+ public delegate bool CanCreateAvatarInventory(int invType, UUID userID);
+ private List CanCreateAvatarInventoryCheckFunctions
+ = new List();
+
+ public void addCheckCanCreateAvatarInventory(CanCreateAvatarInventory delegateFunc)
+ {
+ if (!CanCreateAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanCreateAvatarInventoryCheckFunctions.Add(delegateFunc);
+ }
+ public void removeCheckCanCreateAvatarInventory(CanCreateAvatarInventory delegateFunc)
+ {
+ if (CanCreateAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanCreateAvatarInventoryCheckFunctions.Remove(delegateFunc);
+ }
+
+ ///
+ /// Check whether the specified user is allowed to create the given inventory type in their inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool ExternalChecksCanCreateAvatarInventory(int invType, UUID userID)
+ {
+ foreach (CanCreateAvatarInventory check in CanCreateAvatarInventoryCheckFunctions)
+ {
+ if (check(invType, userID) == false)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public delegate bool CanEditAvatarInventory(UUID itemID, UUID userID);
+ private List CanEditAvatarInventoryCheckFunctions
+ = new List();
+
+ public void addCheckCanEditAvatarInventory(CanEditAvatarInventory delegateFunc)
+ {
+ if (!CanEditAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanEditAvatarInventoryCheckFunctions.Add(delegateFunc);
+ }
+
+ public void removeCheckCanEditAvatarInventory(CanEditAvatarInventory delegateFunc)
+ {
+ if (CanEditAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanEditAvatarInventoryCheckFunctions.Remove(delegateFunc);
+ }
+
+ ///
+ /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool ExternalChecksCanEditAvatarInventory(UUID itemID, UUID userID)
+ {
+ foreach (CanEditAvatarInventory check in CanEditAvatarInventoryCheckFunctions)
+ {
+ if (check(itemID, userID) == false)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public delegate bool CanCopyAvatarInventory(UUID itemID, UUID userID);
+ private List CanCopyAvatarInventoryCheckFunctions
+ = new List();
+
+ public void addCheckCanCopyAvatarInventory(CanCopyAvatarInventory delegateFunc)
+ {
+ if (!CanCopyAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanCopyAvatarInventoryCheckFunctions.Add(delegateFunc);
+ }
+
+ public void removeCheckCanCopyAvatarInventory(CanCopyAvatarInventory delegateFunc)
+ {
+ if (CanCopyAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanCopyAvatarInventoryCheckFunctions.Remove(delegateFunc);
+ }
+
+ ///
+ /// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool ExternalChecksCanCopyAvatarInventory(UUID itemID, UUID userID)
+ {
+ foreach (CanCopyAvatarInventory check in CanCopyAvatarInventoryCheckFunctions)
+ {
+ if (check(itemID, userID) == false)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public delegate bool CanDeleteAvatarInventory(UUID itemID, UUID userID);
+ private List CanDeleteAvatarInventoryCheckFunctions
+ = new List();
+
+ public void addCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory delegateFunc)
+ {
+ if (!CanDeleteAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanDeleteAvatarInventoryCheckFunctions.Add(delegateFunc);
+ }
+
+ public void removeCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory delegateFunc)
+ {
+ if (CanDeleteAvatarInventoryCheckFunctions.Contains(delegateFunc))
+ CanDeleteAvatarInventoryCheckFunctions.Remove(delegateFunc);
+ }
+
+ ///
+ /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
+ ///
+ ///
+ ///
+ ///
+ public bool ExternalChecksCanDeleteAvatarInventory(UUID itemID, UUID userID)
+ {
+ foreach (CanDeleteAvatarInventory check in CanDeleteAvatarInventoryCheckFunctions)
+ {
+ if (check(itemID, userID) == false)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
public delegate bool CanTeleport(UUID userID);
private List CanTeleportCheckFunctions = new List();