aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-01-28 03:22:36 +0100
committerMelanie2012-01-28 03:22:36 +0100
commit6db9109b3f6f4656debd93842d885cbfa312b26f (patch)
tree9f84aad064d0f3ab51432bd125e72f469b042c04 /OpenSim
parentFix build break (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-6db9109b3f6f4656debd93842d885cbfa312b26f.zip
opensim-SC-6db9109b3f6f4656debd93842d885cbfa312b26f.tar.gz
opensim-SC-6db9109b3f6f4656debd93842d885cbfa312b26f.tar.bz2
opensim-SC-6db9109b3f6f4656debd93842d885cbfa312b26f.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs8
-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
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs20
9 files changed, 128 insertions, 27 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index c4f7b91..7a40751 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -291,12 +291,16 @@ namespace OpenSim
291 291
292 m_console.Commands.AddCommand("region", false, "save oar", 292 m_console.Commands.AddCommand("region", false, "save oar",
293 //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]", 293 //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
294 "save oar [-h|--home=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]", 294 "save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]",
295 "Save a region's data to an OAR archive.", 295 "Save a region's data to an OAR archive.",
296// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine 296// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
297 "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine 297 "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
298 + "--noassets stops assets being saved to the OAR." + Environment.NewLine 298 + "--noassets stops assets being saved to the OAR." + Environment.NewLine
299 + "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine 299 + "--publish saves an OAR stripped of owner and last owner information." + Environment.NewLine
300 + " on reload, the estate owner will be the owner of all objects" + Environment.NewLine
301 + " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published" + Environment.NewLine
302 + " this option is EXPERIMENTAL" + Environment.NewLine
303 + "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
300 + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine 304 + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine
301 + "The OAR path must be a filesystem path." 305 + "The OAR path must be a filesystem path."
302 + " If this is not given then the oar is saved to region.oar in the current directory.", 306 + " If this is not given then the oar is saved to region.oar in the current directory.",
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index a22f619..38db239 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>
@@ -386,16 +392,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
386 if (!m_validUserUuids.ContainsKey(uuid)) 392 if (!m_validUserUuids.ContainsKey(uuid))
387 { 393 {
388 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); 394 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
389 if (account != null) 395 m_validUserUuids.Add(uuid, account != null);
390 m_validUserUuids.Add(uuid, true);
391 else
392 m_validUserUuids.Add(uuid, false);
393 } 396 }
394 397
395 if (m_validUserUuids[uuid]) 398 return m_validUserUuids[uuid];
396 return true;
397 else
398 return false;
399 } 399 }
400 400
401 /// <summary> 401 /// <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]
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 764bd2f..817736f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1491,14 +1491,12 @@ namespace OpenSim.Region.Framework.Scenes
1491// m_log.DebugFormat( 1491// m_log.DebugFormat(
1492// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", 1492// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
1493// currentItem.Name, part.Name); 1493// currentItem.Name, part.Name);
1494
1495 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); 1494 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
1496 if (agentTransactions != null) 1495 if (agentTransactions != null)
1497 { 1496 {
1498 agentTransactions.HandleTaskItemUpdateFromTransaction( 1497 agentTransactions.HandleTaskItemUpdateFromTransaction(
1499 remoteClient, part, transactionID, currentItem); 1498 remoteClient, part, transactionID, currentItem);
1500 } 1499 }
1501
1502 // Base ALWAYS has move 1500 // Base ALWAYS has move
1503 currentItem.BasePermissions |= (uint)PermissionMask.Move; 1501 currentItem.BasePermissions |= (uint)PermissionMask.Move;
1504 1502
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3b0d1cd..cf7bf16 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -538,6 +538,12 @@ namespace OpenSim.Region.Framework.Scenes
538 } 538 }
539 } 539 }
540 540
541 public UUID LastOwnerID
542 {
543 get { return m_rootPart.LastOwnerID; }
544 set { m_rootPart.LastOwnerID = value; }
545 }
546
541 public UUID OwnerID 547 public UUID OwnerID
542 { 548 {
543 get { return m_rootPart.OwnerID; } 549 get { return m_rootPart.OwnerID; }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b232855..5576ec9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4579,10 +4579,18 @@ namespace OpenSim.Region.Framework.Scenes
4579 /// <summary> 4579 /// <summary>
4580 /// Update the texture entry for this part. 4580 /// Update the texture entry for this part.
4581 /// </summary> 4581 /// </summary>
4582 /// <param name="textureEntry"></param> 4582 /// <param name="serializedTextureEntry"></param>
4583 public void UpdateTextureEntry(byte[] textureEntry) 4583 public void UpdateTextureEntry(byte[] serializedTextureEntry)
4584 {
4585 UpdateTextureEntry(new Primitive.TextureEntry(serializedTextureEntry, 0, serializedTextureEntry.Length));
4586 }
4587
4588 /// <summary>
4589 /// Update the texture entry for this part.
4590 /// </summary>
4591 /// <param name="newTex"></param>
4592 public void UpdateTextureEntry(Primitive.TextureEntry newTex)
4584 { 4593 {
4585 Primitive.TextureEntry newTex = new Primitive.TextureEntry(textureEntry, 0, textureEntry.Length);
4586 Primitive.TextureEntry oldTex = Shape.Textures; 4594 Primitive.TextureEntry oldTex = Shape.Textures;
4587 4595
4588 Changed changeFlags = 0; 4596 Changed changeFlags = 0;
@@ -4614,7 +4622,7 @@ namespace OpenSim.Region.Framework.Scenes
4614 break; 4622 break;
4615 } 4623 }
4616 4624
4617 m_shape.TextureEntry = textureEntry; 4625 m_shape.TextureEntry = newTex.GetBytes();
4618 if (changeFlags != 0) 4626 if (changeFlags != 0)
4619 TriggerScriptChangedEvent(changeFlags); 4627 TriggerScriptChangedEvent(changeFlags);
4620 UpdateFlag = UpdateRequired.FULL; 4628 UpdateFlag = UpdateRequired.FULL;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index c776fa5..2b0e115 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1205,8 +1205,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1205 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); 1205 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
1206 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); 1206 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
1207 WriteUUID(writer, "GroupID", sop.GroupID, options); 1207 WriteUUID(writer, "GroupID", sop.GroupID, options);
1208 WriteUUID(writer, "OwnerID", sop.OwnerID, options); 1208
1209 WriteUUID(writer, "LastOwnerID", sop.LastOwnerID, options); 1209 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
1210 WriteUUID(writer, "OwnerID", ownerID, options);
1211
1212 UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID;
1213 WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
1214
1210 writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); 1215 writer.WriteElementString("BaseMask", sop.BaseMask.ToString());
1211 writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); 1216 writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString());
1212 writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); 1217 writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
@@ -1293,7 +1298,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1293 writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); 1298 writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
1294 writer.WriteElementString("CreationDate", item.CreationDate.ToString()); 1299 writer.WriteElementString("CreationDate", item.CreationDate.ToString());
1295 1300
1296
1297 WriteUUID(writer, "CreatorID", item.CreatorID, options); 1301 WriteUUID(writer, "CreatorID", item.CreatorID, options);
1298 1302
1299 if (item.CreatorData != null && item.CreatorData != string.Empty) 1303 if (item.CreatorData != null && item.CreatorData != string.Empty)
@@ -1314,10 +1318,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1314 writer.WriteElementString("InvType", item.InvType.ToString()); 1318 writer.WriteElementString("InvType", item.InvType.ToString());
1315 WriteUUID(writer, "ItemID", item.ItemID, options); 1319 WriteUUID(writer, "ItemID", item.ItemID, options);
1316 WriteUUID(writer, "OldItemID", item.OldItemID, options); 1320 WriteUUID(writer, "OldItemID", item.OldItemID, options);
1317 WriteUUID(writer, "LastOwnerID", item.LastOwnerID, options); 1321
1322 UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID;
1323 WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
1324
1318 writer.WriteElementString("Name", item.Name); 1325 writer.WriteElementString("Name", item.Name);
1319 writer.WriteElementString("NextPermissions", item.NextPermissions.ToString()); 1326 writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());
1320 WriteUUID(writer, "OwnerID", item.OwnerID, options); 1327
1328 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID;
1329 WriteUUID(writer, "OwnerID", ownerID, options);
1330
1321 writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString()); 1331 writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
1322 WriteUUID(writer, "ParentID", item.ParentID, options); 1332 WriteUUID(writer, "ParentID", item.ParentID, options);
1323 WriteUUID(writer, "ParentPartID", item.ParentPartID, options); 1333 WriteUUID(writer, "ParentPartID", item.ParentPartID, options);