From dd190f1a1f4639b580cab1cd0695e4ee9534e8ed Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 25 Jan 2017 20:26:09 +0000
Subject: CHANGED ALLOWED_DROP should only trigger if user has no MOD rights
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 +-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 109 +++++++++++----------
2 files changed, 59 insertions(+), 55 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 7377e6d..dbc7def 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1648,7 +1648,7 @@ namespace OpenSim.Region.Framework.Scenes
if (itemID == UUID.Zero)
{
m_log.ErrorFormat(
- "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero to update for {1}!",
+ "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero on update for {1}!",
remoteClient.Name);
return;
}
@@ -1686,7 +1686,8 @@ namespace OpenSim.Region.Framework.Scenes
return;
UUID copyID = UUID.Random();
- part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
+ bool modrights = Permissions.CanEditObject(part.ParentGroup, remoteClient);
+ part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID, modrights);
m_log.InfoFormat(
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
item.Name, primLocalID, remoteClient.Name);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index ddb03c3..12e53a8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
/// The user inventory item being added.
/// The item UUID that should be used by the new item.
///
- public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID)
+ public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID, bool withModRights = true)
{
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
@@ -120,69 +120,72 @@ namespace OpenSim.Region.Framework.Scenes
UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
SceneObjectPart part = GetPart(localID);
- if (part != null)
+ if (part == null)
{
- TaskInventoryItem taskItem = new TaskInventoryItem();
-
- taskItem.ItemID = newItemId;
- taskItem.AssetID = item.AssetID;
- taskItem.Name = item.Name;
- taskItem.Description = item.Description;
- taskItem.OwnerID = part.OwnerID; // Transfer ownership
- taskItem.CreatorID = item.CreatorIdAsUuid;
- taskItem.Type = item.AssetType;
- taskItem.InvType = item.InvType;
-
- if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
- {
- taskItem.BasePermissions = item.BasePermissions &
- item.NextPermissions;
- taskItem.CurrentPermissions = item.CurrentPermissions &
- item.NextPermissions;
- taskItem.EveryonePermissions = item.EveryOnePermissions &
- item.NextPermissions;
- taskItem.GroupPermissions = item.GroupPermissions &
- item.NextPermissions;
- taskItem.NextPermissions = item.NextPermissions;
- // We're adding this to a prim we don't own. Force
- // owner change
- taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
- }
- else
- {
- taskItem.BasePermissions = item.BasePermissions;
- taskItem.CurrentPermissions = item.CurrentPermissions;
- taskItem.EveryonePermissions = item.EveryOnePermissions;
- taskItem.GroupPermissions = item.GroupPermissions;
- taskItem.NextPermissions = item.NextPermissions;
- }
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
+ localID, Name, UUID, newItemId);
+ return false;
+ }
+
+ TaskInventoryItem taskItem = new TaskInventoryItem();
+
+ taskItem.ItemID = newItemId;
+ taskItem.AssetID = item.AssetID;
+ taskItem.Name = item.Name;
+ taskItem.Description = item.Description;
+ taskItem.OwnerID = part.OwnerID; // Transfer ownership
+ taskItem.CreatorID = item.CreatorIdAsUuid;
+ taskItem.Type = item.AssetType;
+ taskItem.InvType = item.InvType;
+
+ if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
+ {
+ taskItem.BasePermissions = item.BasePermissions &
+ item.NextPermissions;
+ taskItem.CurrentPermissions = item.CurrentPermissions &
+ item.NextPermissions;
+ taskItem.EveryonePermissions = item.EveryOnePermissions &
+ item.NextPermissions;
+ taskItem.GroupPermissions = item.GroupPermissions &
+ item.NextPermissions;
+ taskItem.NextPermissions = item.NextPermissions;
+ // We're adding this to a prim we don't own. Force
+ // owner change
+ taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
+
+ }
+ else
+ {
+ taskItem.BasePermissions = item.BasePermissions;
+ taskItem.CurrentPermissions = item.CurrentPermissions;
+ taskItem.EveryonePermissions = item.EveryOnePermissions;
+ taskItem.GroupPermissions = item.GroupPermissions;
+ taskItem.NextPermissions = item.NextPermissions;
+ }
- taskItem.Flags = item.Flags;
+ taskItem.Flags = item.Flags;
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}",
// taskItem.Flags, taskItem.Name, localID, remoteClient.Name);
- // TODO: These are pending addition of those fields to TaskInventoryItem
+ // TODO: These are pending addition of those fields to TaskInventoryItem
// taskItem.SalePrice = item.SalePrice;
// taskItem.SaleType = item.SaleType;
- taskItem.CreationDate = (uint)item.CreationDate;
-
- bool addFromAllowedDrop = agentID != part.OwnerID;
-
- part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
- part.ParentGroup.AggregatePerms();
- return true;
- }
+ taskItem.CreationDate = (uint)item.CreationDate;
+
+ bool addFromAllowedDrop;
+ if(withModRights)
+ addFromAllowedDrop = false;
else
- {
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: " +
- "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
- localID, Name, UUID, newItemId);
- }
+ addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0;
+
+ part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
+ part.ParentGroup.AggregatePerms();
+ return true;
- return false;
}
///
--
cgit v1.1