aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs83
4 files changed, 89 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index edc5ba4..a6dbaba 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -116,6 +116,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
116 m_merge = merge; 116 m_merge = merge;
117 m_skipAssets = skipAssets; 117 m_skipAssets = skipAssets;
118 m_requestId = requestId; 118 m_requestId = requestId;
119
120 // Zero can never be a valid user id
121 m_validUserUuids[UUID.Zero] = false;
119 } 122 }
120 123
121 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId) 124 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
@@ -125,6 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
125 m_merge = merge; 128 m_merge = merge;
126 m_skipAssets = skipAssets; 129 m_skipAssets = skipAssets;
127 m_requestId = requestId; 130 m_requestId = requestId;
131
132 // Zero can never be a valid user id
133 m_validUserUuids[UUID.Zero] = false;
128 } 134 }
129 135
130 /// <summary> 136 /// <summary>
@@ -368,16 +374,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
368 if (!m_validUserUuids.ContainsKey(uuid)) 374 if (!m_validUserUuids.ContainsKey(uuid))
369 { 375 {
370 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); 376 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
371 if (account != null) 377 m_validUserUuids.Add(uuid, account != null);
372 m_validUserUuids.Add(uuid, true);
373 else
374 m_validUserUuids.Add(uuid, false);
375 } 378 }
376 379
377 if (m_validUserUuids[uuid]) 380 return m_validUserUuids[uuid];
378 return true;
379 else
380 return false;
381 } 381 }
382 382
383 /// <summary> 383 /// <summary>
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index b895afe..ffcf063 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -282,10 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
282 // always (incorrectly) includes the Copy bit set in this case. But that's a mistake: the viewer 282 // always (incorrectly) includes the Copy bit set in this case. But that's a mistake: the viewer
283 // does NOT show that the object has Everyone-Copy permissions, and doesn't allow it to be copied. 283 // does NOT show that the object has Everyone-Copy permissions, and doesn't allow it to be copied.
284 if (permissionClass != PermissionClass.Owner) 284 if (permissionClass != PermissionClass.Owner)
285 {
286 canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0; 285 canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0;
287 }
288
289 286
290 bool partPermitted = true; 287 bool partPermitted = true;
291 if (checkPermissions.Contains("C") && !canCopy) 288 if (checkPermissions.Contains("C") && !canCopy)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 0b22598..f5a5a8d 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -142,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
142 ops.Add("h|home=", delegate(string v) { options["home"] = v; }); 142 ops.Add("h|home=", delegate(string v) { options["home"] = v; });
143 143
144 ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); 144 ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
145 ops.Add("publish", v => options["wipe-owners"] = v != null);
145 ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; }); 146 ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
146 147
147 List<string> mainParams = ops.Parse(cmdparams); 148 List<string> mainParams = ops.Parse(cmdparams);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index eec3c1b..63f1363 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -248,9 +248,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
248 Dictionary<string, Object> options = new Dictionary<string, Object>(); 248 Dictionary<string, Object> options = new Dictionary<string, Object>();
249 options.Add("noassets", true); 249 options.Add("noassets", true);
250 m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options); 250 m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options);
251 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
252 //while (assetServer.HasWaitingRequests())
253 // assetServer.ProcessNextRequest();
254 251
255 // Don't wait for completion - with --noassets save oar happens synchronously 252 // Don't wait for completion - with --noassets save oar happens synchronously
256// Monitor.Wait(this, 60000); 253// Monitor.Wait(this, 60000);
@@ -410,6 +407,86 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
410 } 407 }
411 408
412 /// <summary> 409 /// <summary>
410 /// Test loading an OpenSim Region Archive saved with the --publish option.
411 /// </summary>
412 [Test]
413 public void TestLoadPublishedOar()
414 {
415 TestHelpers.InMethod();
416// log4net.Config.XmlConfigurator.Configure();
417
418 SceneObjectPart part1 = CreateSceneObjectPart1();
419 SceneObjectGroup sog1 = new SceneObjectGroup(part1);
420 m_scene.AddNewSceneObject(sog1, false);
421
422 SceneObjectPart part2 = CreateSceneObjectPart2();
423
424 AssetNotecard nc = new AssetNotecard();
425 nc.BodyText = "Hello World!";
426 nc.Encode();
427 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
428 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
429 AssetBase ncAsset
430 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
431 m_scene.AssetService.Store(ncAsset);
432 SceneObjectGroup sog2 = new SceneObjectGroup(part2);
433 TaskInventoryItem ncItem
434 = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
435 part2.Inventory.AddInventoryItem(ncItem, true);
436
437 m_scene.AddNewSceneObject(sog2, false);
438
439 MemoryStream archiveWriteStream = new MemoryStream();
440 m_scene.EventManager.OnOarFileSaved += SaveCompleted;
441
442 Guid requestId = new Guid("00000000-0000-0000-0000-808080808080");
443
444 lock (this)
445 {
446 m_archiverModule.ArchiveRegion(
447 archiveWriteStream, requestId, new Dictionary<string, Object>() { { "wipe-owners", Boolean.TrueString } });
448
449 Monitor.Wait(this, 60000);
450 }
451
452 Assert.That(m_lastRequestId, Is.EqualTo(requestId));
453
454 byte[] archive = archiveWriteStream.ToArray();
455 MemoryStream archiveReadStream = new MemoryStream(archive);
456
457 {
458 UUID estateOwner = TestHelpers.ParseTail(0x4747);
459 UUID objectOwner = TestHelpers.ParseTail(0x15);
460
461 // Reload to new scene
462 ArchiverModule archiverModule = new ArchiverModule();
463 SerialiserModule serialiserModule = new SerialiserModule();
464 TerrainModule terrainModule = new TerrainModule();
465
466 TestScene scene2 = SceneHelpers.SetupScene();
467 SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule);
468
469 // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is
470 // behaving correctly
471 UserAccountHelpers.CreateUserWithInventory(scene2, objectOwner);
472
473 scene2.RegionInfo.EstateSettings.EstateOwner = estateOwner;
474
475 lock (this)
476 {
477 scene2.EventManager.OnOarFileLoaded += LoadCompleted;
478 archiverModule.DearchiveRegion(archiveReadStream);
479 }
480
481 Assert.That(m_lastErrorMessage, Is.Null);
482
483 SceneObjectGroup loadedSog = scene2.GetSceneObjectGroup(part1.Name);
484 Assert.That(loadedSog.OwnerID, Is.EqualTo(estateOwner));
485 Assert.That(loadedSog.LastOwnerID, Is.EqualTo(estateOwner));
486 }
487 }
488
489 /// <summary>
413 /// Test loading the region settings of an OpenSim Region Archive. 490 /// Test loading the region settings of an OpenSim Region Archive.
414 /// </summary> 491 /// </summary>
415 [Test] 492 [Test]