Add experimental --publish option to "save oar" so that OARs reloaded to the same grid don't have the publisher as owner.
parent
088f1213b4
commit
154ba0124a
|
@ -291,12 +291,16 @@ namespace OpenSim
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "save oar",
|
m_console.Commands.AddCommand("region", false, "save oar",
|
||||||
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
||||||
"save oar [-h|--home=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]",
|
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]",
|
||||||
"Save a region's data to an OAR archive.",
|
"Save a region's data to an OAR archive.",
|
||||||
// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
||||||
"-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
|
"-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
|
||||||
+ "--noassets stops assets being saved to the OAR." + Environment.NewLine
|
+ "--noassets stops assets being saved to the OAR." + Environment.NewLine
|
||||||
+ "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
|
+ "--publish saves an OAR stripped of owner and last owner information." + Environment.NewLine
|
||||||
|
+ " on reload, the estate owner will be the owner of all objects" + Environment.NewLine
|
||||||
|
+ " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published" + Environment.NewLine
|
||||||
|
+ " this option is EXPERIMENTAL" + Environment.NewLine
|
||||||
|
+ "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
|
||||||
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine
|
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine
|
||||||
+ "The OAR path must be a filesystem path."
|
+ "The OAR path must be a filesystem path."
|
||||||
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||||
|
|
|
@ -116,6 +116,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
m_merge = merge;
|
m_merge = merge;
|
||||||
m_skipAssets = skipAssets;
|
m_skipAssets = skipAssets;
|
||||||
m_requestId = requestId;
|
m_requestId = requestId;
|
||||||
|
|
||||||
|
// Zero can never be a valid user id
|
||||||
|
m_validUserUuids[UUID.Zero] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
|
public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
|
||||||
|
@ -125,6 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
m_merge = merge;
|
m_merge = merge;
|
||||||
m_skipAssets = skipAssets;
|
m_skipAssets = skipAssets;
|
||||||
m_requestId = requestId;
|
m_requestId = requestId;
|
||||||
|
|
||||||
|
// Zero can never be a valid user id
|
||||||
|
m_validUserUuids[UUID.Zero] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -368,16 +374,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
if (!m_validUserUuids.ContainsKey(uuid))
|
if (!m_validUserUuids.ContainsKey(uuid))
|
||||||
{
|
{
|
||||||
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
||||||
if (account != null)
|
m_validUserUuids.Add(uuid, account != null);
|
||||||
m_validUserUuids.Add(uuid, true);
|
|
||||||
else
|
|
||||||
m_validUserUuids.Add(uuid, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_validUserUuids[uuid])
|
return m_validUserUuids[uuid];
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -282,10 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// always (incorrectly) includes the Copy bit set in this case. But that's a mistake: the viewer
|
// always (incorrectly) includes the Copy bit set in this case. But that's a mistake: the viewer
|
||||||
// does NOT show that the object has Everyone-Copy permissions, and doesn't allow it to be copied.
|
// does NOT show that the object has Everyone-Copy permissions, and doesn't allow it to be copied.
|
||||||
if (permissionClass != PermissionClass.Owner)
|
if (permissionClass != PermissionClass.Owner)
|
||||||
{
|
|
||||||
canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0;
|
canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool partPermitted = true;
|
bool partPermitted = true;
|
||||||
if (checkPermissions.Contains("C") && !canCopy)
|
if (checkPermissions.Contains("C") && !canCopy)
|
||||||
|
|
|
@ -142,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
ops.Add("h|home=", delegate(string v) { options["home"] = v; });
|
ops.Add("h|home=", delegate(string v) { options["home"] = v; });
|
||||||
|
|
||||||
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
|
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
|
||||||
|
ops.Add("publish", v => options["wipe-owners"] = v != null);
|
||||||
ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
|
ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
|
||||||
|
|
||||||
List<string> mainParams = ops.Parse(cmdparams);
|
List<string> mainParams = ops.Parse(cmdparams);
|
||||||
|
|
|
@ -248,9 +248,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
Dictionary<string, Object> options = new Dictionary<string, Object>();
|
Dictionary<string, Object> options = new Dictionary<string, Object>();
|
||||||
options.Add("noassets", true);
|
options.Add("noassets", true);
|
||||||
m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options);
|
m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options);
|
||||||
//AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
|
|
||||||
//while (assetServer.HasWaitingRequests())
|
|
||||||
// assetServer.ProcessNextRequest();
|
|
||||||
|
|
||||||
// Don't wait for completion - with --noassets save oar happens synchronously
|
// Don't wait for completion - with --noassets save oar happens synchronously
|
||||||
// Monitor.Wait(this, 60000);
|
// Monitor.Wait(this, 60000);
|
||||||
|
@ -409,6 +406,86 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
|
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test loading an OpenSim Region Archive saved with the --publish option.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestLoadPublishedOar()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||||
|
SceneObjectGroup sog1 = new SceneObjectGroup(part1);
|
||||||
|
m_scene.AddNewSceneObject(sog1, false);
|
||||||
|
|
||||||
|
SceneObjectPart part2 = CreateSceneObjectPart2();
|
||||||
|
|
||||||
|
AssetNotecard nc = new AssetNotecard();
|
||||||
|
nc.BodyText = "Hello World!";
|
||||||
|
nc.Encode();
|
||||||
|
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
|
||||||
|
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
|
||||||
|
AssetBase ncAsset
|
||||||
|
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
|
||||||
|
m_scene.AssetService.Store(ncAsset);
|
||||||
|
SceneObjectGroup sog2 = new SceneObjectGroup(part2);
|
||||||
|
TaskInventoryItem ncItem
|
||||||
|
= new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
|
||||||
|
part2.Inventory.AddInventoryItem(ncItem, true);
|
||||||
|
|
||||||
|
m_scene.AddNewSceneObject(sog2, false);
|
||||||
|
|
||||||
|
MemoryStream archiveWriteStream = new MemoryStream();
|
||||||
|
m_scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||||
|
|
||||||
|
Guid requestId = new Guid("00000000-0000-0000-0000-808080808080");
|
||||||
|
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
m_archiverModule.ArchiveRegion(
|
||||||
|
archiveWriteStream, requestId, new Dictionary<string, Object>() { { "wipe-owners", Boolean.TrueString } });
|
||||||
|
|
||||||
|
Monitor.Wait(this, 60000);
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.That(m_lastRequestId, Is.EqualTo(requestId));
|
||||||
|
|
||||||
|
byte[] archive = archiveWriteStream.ToArray();
|
||||||
|
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||||
|
|
||||||
|
{
|
||||||
|
UUID estateOwner = TestHelpers.ParseTail(0x4747);
|
||||||
|
UUID objectOwner = TestHelpers.ParseTail(0x15);
|
||||||
|
|
||||||
|
// Reload to new scene
|
||||||
|
ArchiverModule archiverModule = new ArchiverModule();
|
||||||
|
SerialiserModule serialiserModule = new SerialiserModule();
|
||||||
|
TerrainModule terrainModule = new TerrainModule();
|
||||||
|
|
||||||
|
TestScene scene2 = SceneHelpers.SetupScene();
|
||||||
|
SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule);
|
||||||
|
|
||||||
|
// Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is
|
||||||
|
// behaving correctly
|
||||||
|
UserAccountHelpers.CreateUserWithInventory(scene2, objectOwner);
|
||||||
|
|
||||||
|
scene2.RegionInfo.EstateSettings.EstateOwner = estateOwner;
|
||||||
|
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
scene2.EventManager.OnOarFileLoaded += LoadCompleted;
|
||||||
|
archiverModule.DearchiveRegion(archiveReadStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.That(m_lastErrorMessage, Is.Null);
|
||||||
|
|
||||||
|
SceneObjectGroup loadedSog = scene2.GetSceneObjectGroup(part1.Name);
|
||||||
|
Assert.That(loadedSog.OwnerID, Is.EqualTo(estateOwner));
|
||||||
|
Assert.That(loadedSog.LastOwnerID, Is.EqualTo(estateOwner));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test loading the region settings of an OpenSim Region Archive.
|
/// Test loading the region settings of an OpenSim Region Archive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -441,6 +441,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID LastOwnerID
|
||||||
|
{
|
||||||
|
get { return m_rootPart.LastOwnerID; }
|
||||||
|
set { m_rootPart.LastOwnerID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public UUID OwnerID
|
public UUID OwnerID
|
||||||
{
|
{
|
||||||
get { return m_rootPart.OwnerID; }
|
get { return m_rootPart.OwnerID; }
|
||||||
|
|
|
@ -1192,8 +1192,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
|
writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
|
||||||
writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
|
writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
|
||||||
WriteUUID(writer, "GroupID", sop.GroupID, options);
|
WriteUUID(writer, "GroupID", sop.GroupID, options);
|
||||||
WriteUUID(writer, "OwnerID", sop.OwnerID, options);
|
|
||||||
WriteUUID(writer, "LastOwnerID", sop.LastOwnerID, options);
|
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
|
||||||
|
WriteUUID(writer, "OwnerID", ownerID, options);
|
||||||
|
|
||||||
|
UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID;
|
||||||
|
WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
|
||||||
|
|
||||||
writer.WriteElementString("BaseMask", sop.BaseMask.ToString());
|
writer.WriteElementString("BaseMask", sop.BaseMask.ToString());
|
||||||
writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString());
|
writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString());
|
||||||
writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
|
writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
|
||||||
|
@ -1277,7 +1282,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
|
writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
|
||||||
writer.WriteElementString("CreationDate", item.CreationDate.ToString());
|
writer.WriteElementString("CreationDate", item.CreationDate.ToString());
|
||||||
|
|
||||||
|
|
||||||
WriteUUID(writer, "CreatorID", item.CreatorID, options);
|
WriteUUID(writer, "CreatorID", item.CreatorID, options);
|
||||||
|
|
||||||
if (item.CreatorData != null && item.CreatorData != string.Empty)
|
if (item.CreatorData != null && item.CreatorData != string.Empty)
|
||||||
|
@ -1298,10 +1302,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
writer.WriteElementString("InvType", item.InvType.ToString());
|
writer.WriteElementString("InvType", item.InvType.ToString());
|
||||||
WriteUUID(writer, "ItemID", item.ItemID, options);
|
WriteUUID(writer, "ItemID", item.ItemID, options);
|
||||||
WriteUUID(writer, "OldItemID", item.OldItemID, options);
|
WriteUUID(writer, "OldItemID", item.OldItemID, options);
|
||||||
WriteUUID(writer, "LastOwnerID", item.LastOwnerID, options);
|
|
||||||
|
UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID;
|
||||||
|
WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
|
||||||
|
|
||||||
writer.WriteElementString("Name", item.Name);
|
writer.WriteElementString("Name", item.Name);
|
||||||
writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());
|
writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());
|
||||||
WriteUUID(writer, "OwnerID", item.OwnerID, options);
|
|
||||||
|
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID;
|
||||||
|
WriteUUID(writer, "OwnerID", ownerID, options);
|
||||||
|
|
||||||
writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
|
writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
|
||||||
WriteUUID(writer, "ParentID", item.ParentID, options);
|
WriteUUID(writer, "ParentID", item.ParentID, options);
|
||||||
WriteUUID(writer, "ParentPartID", item.ParentPartID, options);
|
WriteUUID(writer, "ParentPartID", item.ParentPartID, options);
|
||||||
|
|
Loading…
Reference in New Issue