mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 18:55:39 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10ed3a5520 | ||
|
|
ddda314f14 | ||
|
|
8fb0dccffa | ||
|
|
4a90dd3556 |
@@ -29,7 +29,7 @@ namespace OpenSim
|
||||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.8.0.1";
|
||||
private const string VERSION_NUMBER = "0.8.0.2";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Release;
|
||||
|
||||
public enum Flavour
|
||||
|
||||
@@ -1226,16 +1226,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
if (taskItem.InvType == (int)InventoryType.Object)
|
||||
{
|
||||
uint perms = taskItem.CurrentPermissions;
|
||||
// Bake the new base permissions from folded permissions
|
||||
// The folded perms are in the lowest 3 bits of the current perms
|
||||
// We use base permissions here to avoid baking the "Locked" status
|
||||
// into the item as it is passed.
|
||||
uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
|
||||
PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
|
||||
// Avoid the "lock trap" - move must always be enabled but the above may remove it
|
||||
// Add it back here.
|
||||
agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||
}
|
||||
else
|
||||
{
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
||||
// Newly given items cannot be "locked" on rez. Make sure by
|
||||
// setting current equal to base.
|
||||
}
|
||||
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||
|
||||
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
agentItem.NextPermissions = taskItem.NextPermissions;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
|
||||
@@ -45,6 +45,7 @@ using OpenSim.Region.ScriptEngine.Shared.Instance;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
@@ -167,5 +168,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test giving inventory from an object to an avatar that is not the object's owner.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLlGiveInventoryO2DifferentAvatar()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
string inventoryItemName = "item1";
|
||||
|
||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
||||
m_scene.AddSceneObject(so1);
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(m_engine, so1.RootPart, null, null);
|
||||
|
||||
// Create an object embedded inside the first
|
||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
|
||||
|
||||
api.llGiveInventory(user2Id.ToString(), inventoryItemName);
|
||||
|
||||
InventoryItemBase receivedItem
|
||||
= UserInventoryHelpers.GetInventoryItem(
|
||||
m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
|
||||
|
||||
Assert.IsNotNull(receivedItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test giving inventory from an object to an avatar that is not the object's owner and where the next
|
||||
/// permissions do not include mod.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLlGiveInventoryO2DifferentAvatarNoMod()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
string inventoryItemName = "item1";
|
||||
|
||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
||||
m_scene.AddSceneObject(so1);
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(m_engine, so1.RootPart, null, null);
|
||||
|
||||
// Create an object embedded inside the first
|
||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||
TaskInventoryItem tii
|
||||
= TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
|
||||
tii.NextPermissions &= ~((uint)PermissionMask.Modify);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
|
||||
|
||||
api.llGiveInventory(user2Id.ToString(), inventoryItemName);
|
||||
|
||||
InventoryItemBase receivedItem
|
||||
= UserInventoryHelpers.GetInventoryItem(
|
||||
m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
|
||||
|
||||
Assert.IsNotNull(receivedItem);
|
||||
Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user