CHANGED ALLOWED_DROP should only trigger if user has no MOD rights

httptests
UbitUmarov 2017-01-25 20:26:09 +00:00
parent 02fbe5a740
commit dd190f1a1f
2 changed files with 63 additions and 59 deletions

View File

@ -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);

View File

@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="item">The user inventory item being added.</param>
/// <param name="copyItemID">The item UUID that should be used by the new item.</param>
/// <returns></returns>
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,8 +120,15 @@ namespace OpenSim.Region.Framework.Scenes
UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
SceneObjectPart part = GetPart(localID);
if (part != null)
if (part == null)
{
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;
@ -147,6 +154,7 @@ namespace OpenSim.Region.Framework.Scenes
// We're adding this to a prim we don't own. Force
// owner change
taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
}
else
{
@ -168,21 +176,16 @@ namespace OpenSim.Region.Framework.Scenes
// taskItem.SaleType = item.SaleType;
taskItem.CreationDate = (uint)item.CreationDate;
bool addFromAllowedDrop = agentID != part.OwnerID;
bool addFromAllowedDrop;
if(withModRights)
addFromAllowedDrop = false;
else
addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0;
part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
part.ParentGroup.AggregatePerms();
return true;
}
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);
}
return false;
}
/// <summary>