aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs347
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs23
7 files changed, 389 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index f958510..a77bc63 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -614,6 +614,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
614 protected InventoryItemBase CreateItemForObject( 614 protected InventoryItemBase CreateItemForObject(
615 DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) 615 DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID)
616 { 616 {
617// m_log.DebugFormat(
618// "[BASIC INVENTORY ACCESS MODULE]: Creating item for object {0} {1} for folder {2}, action {3}",
619// so.Name, so.UUID, folderID, action);
620//
617 // Get the user info of the item destination 621 // Get the user info of the item destination
618 // 622 //
619 UUID userID = UUID.Zero; 623 UUID userID = UUID.Zero;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index d8f9f8c..780ec69 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -801,8 +801,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
801 801
802 // Friends with benefits should be able to edit the objects too 802 // Friends with benefits should be able to edit the objects too
803 if (IsFriendWithPerms(currentUser, objectOwner)) 803 if (IsFriendWithPerms(currentUser, objectOwner))
804 {
804 // Return immediately, so that the administrator can share objects with friends 805 // Return immediately, so that the administrator can share objects with friends
805 return true; 806 return true;
807 }
806 808
807 // Users should be able to edit what is over their land. 809 // Users should be able to edit what is over their land.
808 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); 810 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
@@ -1522,6 +1524,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1522 if (m_bypassPermissions) return m_bypassPermissionsValue; 1524 if (m_bypassPermissions) return m_bypassPermissionsValue;
1523 1525
1524 bool permission = GenericObjectPermission(userID, objectID, false); 1526 bool permission = GenericObjectPermission(userID, objectID, false);
1527
1528 SceneObjectGroup so = (SceneObjectGroup)m_scene.Entities[objectID];
1529
1525 if (!permission) 1530 if (!permission)
1526 { 1531 {
1527 if (!m_scene.Entities.ContainsKey(objectID)) 1532 if (!m_scene.Entities.ContainsKey(objectID))
@@ -1535,31 +1540,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1535 return false; 1540 return false;
1536 } 1541 }
1537 1542
1538 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
1539 // UUID taskOwner = null; 1543 // UUID taskOwner = null;
1540 // Added this because at this point in time it wouldn't be wise for 1544 // Added this because at this point in time it wouldn't be wise for
1541 // the administrator object permissions to take effect. 1545 // the administrator object permissions to take effect.
1542 // UUID objectOwner = task.OwnerID; 1546 // UUID objectOwner = task.OwnerID;
1543 1547
1544 if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) 1548 if ((so.RootPart.EveryoneMask & PERM_COPY) != 0)
1545 permission = true; 1549 permission = true;
1550 }
1546 1551
1547 if (task.OwnerID != userID) 1552 if (so.OwnerID != userID)
1548 { 1553 {
1549 if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS)) 1554 if ((so.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
1550 permission = false; 1555 permission = false;
1551 }
1552 else
1553 {
1554 if ((task.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
1555 permission = false;
1556 }
1557 } 1556 }
1558 else 1557 else
1559 { 1558 {
1560 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID]; 1559 if ((so.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
1561
1562 if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
1563 permission = false; 1560 permission = false;
1564 } 1561 }
1565 1562
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 527ca35..81cef5b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -265,6 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
265 for (int i = 0; i < parts.Length; i++) 265 for (int i = 0; i < parts.Length; i++)
266 { 266 {
267 SceneObjectPart part = parts[i]; 267 SceneObjectPart part = parts[i];
268// m_log.DebugFormat("[SCENE OBJECT GROUP INVENTORY]: Effective perms of {0} are {1}", part.Name, (OpenMetaverse.PermissionMask)part.OwnerMask);
268 ownerMask &= part.OwnerMask; 269 ownerMask &= part.OwnerMask;
269 perms &= part.Inventory.MaskEffectivePermissions(); 270 perms &= part.Inventory.MaskEffectivePermissions();
270 } 271 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 19e557f..20fe3ce 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2943,6 +2943,11 @@ namespace OpenSim.Region.Framework.Scenes
2943 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); 2943 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
2944 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); 2944 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
2945 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); 2945 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
2946
2947// m_log.DebugFormat(
2948// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
2949// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
2950
2946 RootPart.ScheduleFullUpdate(); 2951 RootPart.ScheduleFullUpdate();
2947 } 2952 }
2948 2953
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
new file mode 100644
index 0000000..1d41d33
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
@@ -0,0 +1,347 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
37using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
39using OpenSim.Region.CoreModules.World.Permissions;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
42using OpenSim.Tests.Common;
43
44namespace OpenSim.Region.Framework.Scenes.Tests
45{
46 /// <summary>
47 /// Test copying of scene objects.
48 /// </summary>
49 /// <remarks>
50 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
51 /// </remarks>
52 [TestFixture]
53 public class SceneObjectCopyTests : OpenSimTestCase
54 {
55 [TestFixtureSetUp]
56 public void FixtureInit()
57 {
58 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
59 // This facility was added after the original async delete tests were written, so it may be possible now
60 // to not bother explicitly disabling their async (since everything will be running sync).
61 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
62 }
63
64 [TestFixtureTearDown]
65 public void TearDown()
66 {
67 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
68 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
69 // tests really shouldn't).
70 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
71 }
72
73 [Test]
74 public void TestTakeCopyWhenCopierIsOwnerWithPerms()
75 {
76 TestHelpers.InMethod();
77// TestHelpers.EnableLogging();
78
79 IConfigSource config = new IniConfigSource();
80 config.AddConfig("Modules");
81 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
82
83 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
84 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
85 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
86 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
87
88 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
89 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
90 sogd.Enabled = false;
91
92 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
93 uint soLocalId = so.LocalId;
94// so.UpdatePermissions(
95// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Copy, 1);
96// so.UpdatePermissions(
97// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
98// so.UpdatePermissions(
99// ua.PrincipalID, (byte)PermissionWho.Base, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
100// scene.HandleObjectPermissionsUpdate(client, client.AgentId, client.SessionId, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
101
102 // Ideally we might change these via client-focussed method calls as commented out above. However, this
103 // becomes very convoluted so we will set only the copy perm directly.
104 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
105// so.RootPart.OwnerMask = (uint)OpenMetaverse.PermissionMask.Copy;
106
107 List<uint> localIds = new List<uint>();
108 localIds.Add(so.LocalId);
109
110 // Specifying a UUID.Zero in this case will currently plop it in Lost and Found
111 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
112
113 // Check that object isn't copied until we crank the sogd handle.
114 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
115 Assert.That(retrievedPart, Is.Not.Null);
116 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
117
118 sogd.InventoryDeQueueAndDelete();
119
120 // Check that object is still there.
121 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
122 Assert.That(retrievedPart2, Is.Not.Null);
123 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
124
125 // Check that we have a copy in inventory
126 InventoryItemBase item
127 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
128 Assert.That(item, Is.Not.Null);
129 }
130
131 [Test]
132 public void TestTakeCopyWhenCopierIsOwnerWithoutPerms()
133 {
134 TestHelpers.InMethod();
135// TestHelpers.EnableLogging();
136
137 IConfigSource config = new IniConfigSource();
138 config.AddConfig("Modules");
139 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
140
141 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
142 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
143 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
144 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
145
146 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
147 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
148 sogd.Enabled = false;
149
150 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
151 uint soLocalId = so.LocalId;
152
153 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
154 //so.RootPart.OwnerMask = (uint)(OpenMetaverse.PermissionMask.Copy & ~OpenMetaverse.PermissionMask.Copy);
155
156 List<uint> localIds = new List<uint>();
157 localIds.Add(so.LocalId);
158
159 // Specifying a UUID.Zero in this case will currently plop it in Lost and Found
160 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
161
162 // Check that object isn't copied until we crank the sogd handle.
163 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
164 Assert.That(retrievedPart, Is.Not.Null);
165 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
166
167 sogd.InventoryDeQueueAndDelete();
168
169 // Check that object is still there.
170 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
171 Assert.That(retrievedPart2, Is.Not.Null);
172 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
173
174 // Check that we do not have a copy in inventory
175 InventoryItemBase item
176 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
177 Assert.That(item, Is.Null);
178 }
179
180 [Test]
181 public void TestTakeCopyWhenCopierIsNotOwnerWithPerms()
182 {
183 TestHelpers.InMethod();
184// TestHelpers.EnableLogging();
185
186 IConfigSource config = new IniConfigSource();
187 config.AddConfig("Modules");
188 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
189
190 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
191 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
192 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
193 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
194
195 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
196 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
197 sogd.Enabled = false;
198
199 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
200 uint soLocalId = so.LocalId;
201
202 // Base must allow transfer and copy
203 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
204 // Must be set so anyone can copy
205 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
206
207 List<uint> localIds = new List<uint>();
208 localIds.Add(so.LocalId);
209
210 // Specifying a UUID.Zero in this case will plop it in the Objects folder
211 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
212
213 // Check that object isn't copied until we crank the sogd handle.
214 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
215 Assert.That(retrievedPart, Is.Not.Null);
216 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
217
218 sogd.InventoryDeQueueAndDelete();
219
220 // Check that object is still there.
221 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
222 Assert.That(retrievedPart2, Is.Not.Null);
223 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
224
225 // Check that we have a copy in inventory
226 InventoryItemBase item
227 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
228 Assert.That(item, Is.Not.Null);
229 }
230
231 [Test]
232 public void TestTakeCopyWhenCopierIsNotOwnerWithoutPerms()
233 {
234 TestHelpers.InMethod();
235// TestHelpers.EnableLogging();
236
237 IConfigSource config = new IniConfigSource();
238 config.AddConfig("Modules");
239 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
240
241 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
242 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
243 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
244 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
245
246 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
247 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
248 sogd.Enabled = false;
249
250 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
251 uint soLocalId = so.LocalId;
252
253 {
254 // Check that object is not copied if copy base perms is missing.
255 // Should not allow copy if base does not have this.
256 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Transfer;
257 // Must be set so anyone can copy
258 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
259
260 // Check that object is not copied
261 List<uint> localIds = new List<uint>();
262 localIds.Add(so.LocalId);
263
264 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
265 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
266
267 // Check that object isn't copied until we crank the sogd handle.
268 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
269 Assert.That(retrievedPart, Is.Not.Null);
270 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
271
272 sogd.InventoryDeQueueAndDelete();
273 // Check that object is still there.
274 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
275 Assert.That(retrievedPart2, Is.Not.Null);
276 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
277
278 // Check that we have a copy in inventory
279 InventoryItemBase item
280 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
281 Assert.That(item, Is.Null);
282 }
283
284 {
285 // Check that object is not copied if copy trans perms is missing.
286 // Should not allow copy if base does not have this.
287 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
288 // Must be set so anyone can copy
289 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
290
291 // Check that object is not copied
292 List<uint> localIds = new List<uint>();
293 localIds.Add(so.LocalId);
294
295 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
296 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
297
298 // Check that object isn't copied until we crank the sogd handle.
299 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
300 Assert.That(retrievedPart, Is.Not.Null);
301 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
302
303 sogd.InventoryDeQueueAndDelete();
304 // Check that object is still there.
305 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
306 Assert.That(retrievedPart2, Is.Not.Null);
307 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
308
309 // Check that we have a copy in inventory
310 InventoryItemBase item
311 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
312 Assert.That(item, Is.Null);
313 }
314
315 {
316 // Check that object is not copied if everyone copy perms is missing.
317 // Should not allow copy if base does not have this.
318 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
319 // Make sure everyone perm does not allow copy
320 so.RootPart.EveryoneMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
321
322 // Check that object is not copied
323 List<uint> localIds = new List<uint>();
324 localIds.Add(so.LocalId);
325
326 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
327 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
328
329 // Check that object isn't copied until we crank the sogd handle.
330 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
331 Assert.That(retrievedPart, Is.Not.Null);
332 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
333
334 sogd.InventoryDeQueueAndDelete();
335 // Check that object is still there.
336 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
337 Assert.That(retrievedPart2, Is.Not.Null);
338 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
339
340 // Check that we have a copy in inventory
341 InventoryItemBase item
342 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
343 Assert.That(item, Is.Null);
344 }
345 }
346 }
347} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index a8883b8..c97a765 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Tests.Common
185 185
186 public void addInventoryItem(InventoryItemBase item) 186 public void addInventoryItem(InventoryItemBase item)
187 { 187 {
188// InventoryFolderBase folder = m_folders[item.Folder]; 188 InventoryFolderBase folder = m_folders[item.Folder];
189 189
190// m_log.DebugFormat( 190// m_log.DebugFormat(
191// "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID); 191// "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID);
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
index be3a0cb..2b272e6 100644
--- a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
@@ -46,20 +46,33 @@ namespace OpenSim.Tests.Common
46 46
47 public XInventoryItem[] GetItems(string[] fields, string[] vals) 47 public XInventoryItem[] GetItems(string[] fields, string[] vals)
48 { 48 {
49// Console.WriteLine(
50// "Requesting items, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
51
49 List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList()); 52 List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList());
50 53
51 return origItems.Select(i => i.Clone()).ToArray(); 54 XInventoryItem[] items = origItems.Select(i => i.Clone()).ToArray();
55
56// Console.WriteLine("Found {0} items", items.Length);
57// Array.ForEach(items, i => Console.WriteLine("Found item {0} {1}", i.inventoryName, i.inventoryID));
58
59 return items;
52 } 60 }
53 61
54 public XInventoryFolder[] GetFolders(string[] fields, string[] vals) 62 public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
55 { 63 {
56// Console.WriteLine( 64// Console.WriteLine(
57// "Requesting folders, fields {0}, vals {1}", string.Join(",", fields), string.Join(",", vals)); 65// "Requesting folders, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
58 66
59 List<XInventoryFolder> origFolders 67 List<XInventoryFolder> origFolders
60 = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList()); 68 = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList());
61 69
62 return origFolders.Select(f => f.Clone()).ToArray(); 70 XInventoryFolder[] folders = origFolders.Select(f => f.Clone()).ToArray();
71
72// Console.WriteLine("Found {0} folders", folders.Length);
73// Array.ForEach(folders, f => Console.WriteLine("Found folder {0} {1}", f.folderName, f.folderID));
74
75 return folders;
63 } 76 }
64 77
65 public bool StoreFolder(XInventoryFolder folder) 78 public bool StoreFolder(XInventoryFolder folder)
@@ -75,7 +88,9 @@ namespace OpenSim.Tests.Common
75 { 88 {
76 m_allItems[item.inventoryID] = item.Clone(); 89 m_allItems[item.inventoryID] = item.Clone();
77 90
78// Console.WriteLine("Added item {0} {1}, creator {2}, owner {3}", item.inventoryName, item.inventoryID, item.creatorID, item.avatarID); 91// Console.WriteLine(
92// "Added item {0} {1}, folder {2}, creator {3}, owner {4}",
93// item.inventoryName, item.inventoryID, item.parentFolderID, item.creatorID, item.avatarID);
79 94
80 return true; 95 return true;
81 } 96 }