From f6bf4c39be634bb8d1a03de5fd048edc54b7df50 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Tue, 24 Jun 2008 23:55:33 +0000
Subject: Mantis#1587. Thank you kindly, Melanie for a patch that: Add
permissions magling to llGiveInventoryItem, correct some corner case
functionality
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 49 ++++++++++++++++------
1 file changed, 36 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 3580b99..517066d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -882,12 +882,6 @@ namespace OpenSim.Region.Environment.Scenes
return;
}
- // Only owner can copy
- if (remoteClient.AgentId != taskItem.OwnerID)
- {
- return;
- }
-
InventoryItemBase agentItem = new InventoryItemBase();
agentItem.ID = LLUUID.Random();
@@ -925,13 +919,13 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- /// MoveTaskInventoryItem
+ /// ClientMoveTaskInventoryItem
///
///
///
///
///
- public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
+ public void ClientMoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
{
SceneObjectPart part = GetSceneObjectPart(primLocalId);
@@ -944,6 +938,15 @@ namespace OpenSim.Region.Environment.Scenes
return;
}
+
+ TaskInventoryItem taskItem = part.GetInventoryItem(itemId);
+
+ // Only owner can copy
+ if (remoteClient.AgentId != taskItem.OwnerID)
+ {
+ return;
+ }
+
MoveTaskInventoryItem(remoteClient, folderId, part, itemId);
}
@@ -977,7 +980,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void CopyTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId)
+ public void MoveTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId)
{
TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId);
@@ -1003,23 +1006,43 @@ namespace OpenSim.Region.Environment.Scenes
destTaskItem.ItemID = LLUUID.Random();
destTaskItem.CreatorID = srcTaskItem.CreatorID;
destTaskItem.AssetID = srcTaskItem.AssetID;
- destTaskItem.GroupID = srcTaskItem.GroupID;
- destTaskItem.OwnerID = srcTaskItem.OwnerID;
- destTaskItem.ParentID = srcTaskItem.ParentID;
- destTaskItem.ParentPartID = srcTaskItem.ParentPartID;
+ destTaskItem.GroupID = destPart.GroupID;
+ destTaskItem.OwnerID = destPart.OwnerID;
+ destTaskItem.ParentID = destPart.UUID;
+ destTaskItem.ParentPartID = destPart.UUID;
destTaskItem.BaseMask = srcTaskItem.BaseMask;
destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask;
destTaskItem.GroupMask = srcTaskItem.GroupMask;
destTaskItem.OwnerMask = srcTaskItem.OwnerMask;
+ destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask;
destTaskItem.Flags = srcTaskItem.Flags;
+ if(destPart.OwnerID != part.OwnerID)
+ {
+ if (ExternalChecks.ExternalChecksPropagatePermissions())
+ {
+ destTaskItem.OwnerMask = srcTaskItem.OwnerMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.GroupMask = srcTaskItem.GroupMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.BaseMask = srcTaskItem.BaseMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.OwnerMask |= 8; // Slam!
+ }
+ }
+
destTaskItem.Description = srcTaskItem.Description;
destTaskItem.Name = srcTaskItem.Name;
destTaskItem.InvType = srcTaskItem.InvType;
destTaskItem.Type = srcTaskItem.Type;
destPart.AddInventoryItem(destTaskItem);
+
+ if((srcTaskItem.OwnerMask & (uint)PermissionMask.Copy) == 0)
+ part.RemoveInventoryItem(itemId);
}
--
cgit v1.1