From 8b3c2f7d0c655d72bbca9dcbd092d3ab275d47c5 Mon Sep 17 00:00:00 2001 From: Matt Lehmann Date: Wed, 30 Apr 2014 19:12:52 -0700 Subject: updated version of default user switch for load oar :q :q --- .../World/Archiver/ArchiveReadRequest.cs | 22 +++++++++++++----- .../CoreModules/World/Archiver/ArchiverModule.cs | 26 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index a1629fb..fe87350 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -160,10 +160,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver private IAssetService m_assetService = null; + private UUID m_defaultUser; + public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionaryoptions) { m_rootScene = scene; + if (options.ContainsKey("default-user")) + { + m_defaultUser = (UUID)options["default-user"]; + m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); + } + else + { + m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; + } + m_loadPath = loadPath; try { @@ -562,16 +574,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (string.IsNullOrEmpty(part.CreatorData)) { if (!ResolveUserUuid(scene, part.CreatorID)) - part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; + part.CreatorID = m_defaultUser; } if (UserManager != null) UserManager.AddUser(part.CreatorID, part.CreatorData); if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID))) - part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; + part.OwnerID = m_defaultUser; if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(part.LastOwnerID))) - part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner; + part.LastOwnerID = m_defaultUser; if (!ResolveGroupUuid(part.GroupID)) part.GroupID = UUID.Zero; @@ -590,13 +602,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver { if (!(ResolveUserUuid(scene, kvp.Value.OwnerID) || ResolveGroupUuid(kvp.Value.OwnerID))) { - kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; + kvp.Value.OwnerID = m_defaultUser; } if (string.IsNullOrEmpty(kvp.Value.CreatorData)) { if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) - kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; + kvp.Value.CreatorID = m_defaultUser; } if (UserManager != null) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2b2da6f..6a09caf 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -108,6 +108,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver bool forceParcels = false; bool noObjects = false; Vector3 displacement = new Vector3(0f, 0f, 0f); + String defaultUser = ""; float rotation = 0f; Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); @@ -119,6 +120,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); + options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); options.Add("displacement=", delegate (string v) { try { @@ -131,7 +133,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver return; } }); - options.Add("rotation=", delegate (string v) { + options.Add("rotation=", delegate(string v) + { try { rotation = v == null ? 0f : float.Parse(v); @@ -181,6 +184,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (forceTerrain) archiveOptions.Add("force-terrain", null); if (forceParcels) archiveOptions.Add("force-parcels", null); if (noObjects) archiveOptions.Add("no-objects", null); + if (defaultUser != "") + { + UUID defaultUserUUID = UUID.Zero; + try + { + defaultUserUUID = Scene.UserManagementModule.GetUserIdByName(defaultUser); + } + catch + { + m_log.ErrorFormat("[ARCHIVER MODULE] default user must be in format \"First Last\"", defaultUser); + } + if (defaultUserUUID == UUID.Zero) + { + m_log.ErrorFormat("[ARCHIVER MODULE] cannot find specified default user {0}", defaultUser); + return; + } + else + { + archiveOptions.Add("default-user", defaultUserUUID); + } + } archiveOptions.Add("displacement", displacement); archiveOptions.Add("rotation", rotation); archiveOptions.Add("rotation-center", rotationCenter); -- cgit v1.1