make use of CanDoObjectInvToObjectInv

httptests
UbitUmarov 2017-01-25 16:57:46 +00:00
parent b45f6b933f
commit 74ac2034e0
3 changed files with 21 additions and 21 deletions

View File

@ -303,6 +303,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory; m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
m_scene.Permissions.OnDoObjectInvToObjectInv += CanDoObjectInvToObjectInv;
m_scene.Permissions.OnViewNotecard += CanViewNotecard; m_scene.Permissions.OnViewNotecard += CanViewNotecard;
m_scene.Permissions.OnViewScript += CanViewScript; m_scene.Permissions.OnViewScript += CanViewScript;

View File

@ -1461,29 +1461,9 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
// Can't transfer this if(!Permissions.CanDoObjectInvToObjectInv(srcTaskItem, part, destPart))
//
if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
return; return;
bool overrideNoMod = false;
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
overrideNoMod = true;
if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
{
// object cannot copy items to an object owned by a different owner
// unless llAllowInventoryDrop has been called
return;
}
// must have both move and modify permission to put an item in an object
if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod))
{
return;
}
TaskInventoryItem destTaskItem = new TaskInventoryItem(); TaskInventoryItem destTaskItem = new TaskInventoryItem();
destTaskItem.ItemID = UUID.Random(); destTaskItem.ItemID = UUID.Random();

View File

@ -86,6 +86,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool DelinkObjectHandler(UUID user, UUID objectID); public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart);
public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool CreateUserInventoryHandler(int invType, UUID userID); public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
@ -158,6 +159,7 @@ namespace OpenSim.Region.Framework.Scenes
public event DelinkObjectHandler OnDelinkObject; public event DelinkObjectHandler OnDelinkObject;
public event CreateObjectInventoryHandler OnCreateObjectInventory; public event CreateObjectInventoryHandler OnCreateObjectInventory;
public event CopyObjectInventoryHandler OnCopyObjectInventory; public event CopyObjectInventoryHandler OnCopyObjectInventory;
public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
public event DeleteObjectInventoryHandler OnDeleteObjectInventory; public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
public event TransferObjectInventoryHandler OnTransferObjectInventory; public event TransferObjectInventoryHandler OnTransferObjectInventory;
public event CreateUserInventoryHandler OnCreateUserInventory; public event CreateUserInventoryHandler OnCreateUserInventory;
@ -1090,6 +1092,23 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
{
DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv;
if (handler != null)
{
if (sourcePart == null || destPart == null || item == null)
return false;
Delegate[] list = handler.GetInvocationList();
foreach (DoObjectInvToObjectInv h in list)
{
if (h(item, sourcePart, destPart) == false)
return false;
}
}
return true;
}
public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
{ {
DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;