updated version of default user switch for load oar :q :q

0.8.0.3
Matt Lehmann 2014-04-30 19:12:52 -07:00 committed by Justin Clark-Casey (justincc)
parent cecb446e0e
commit 8b3c2f7d0c
3 changed files with 43 additions and 6 deletions

View File

@ -272,6 +272,7 @@ namespace OpenSim
+ " [--no-objects]" + " [--no-objects]"
+ " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]"
+ " [--displacement \"<x,y,z>\"]" + " [--displacement \"<x,y,z>\"]"
+ " [--default-user \"User Name\"]"
+ " [<OAR path>]", + " [<OAR path>]",
"Load a region's data from an OAR archive.", "Load a region's data from an OAR archive.",
"--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine

View File

@ -160,10 +160,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private IAssetService m_assetService = null; private IAssetService m_assetService = null;
private UUID m_defaultUser;
public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options) public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options)
{ {
m_rootScene = scene; 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; m_loadPath = loadPath;
try try
{ {
@ -562,16 +574,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (string.IsNullOrEmpty(part.CreatorData)) if (string.IsNullOrEmpty(part.CreatorData))
{ {
if (!ResolveUserUuid(scene, part.CreatorID)) if (!ResolveUserUuid(scene, part.CreatorID))
part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; part.CreatorID = m_defaultUser;
} }
if (UserManager != null) if (UserManager != null)
UserManager.AddUser(part.CreatorID, part.CreatorData); UserManager.AddUser(part.CreatorID, part.CreatorData);
if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID))) 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))) if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(part.LastOwnerID)))
part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner; part.LastOwnerID = m_defaultUser;
if (!ResolveGroupUuid(part.GroupID)) if (!ResolveGroupUuid(part.GroupID))
part.GroupID = UUID.Zero; part.GroupID = UUID.Zero;
@ -590,13 +602,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
if (!(ResolveUserUuid(scene, kvp.Value.OwnerID) || ResolveGroupUuid(kvp.Value.OwnerID))) 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 (string.IsNullOrEmpty(kvp.Value.CreatorData))
{ {
if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) if (!ResolveUserUuid(scene, kvp.Value.CreatorID))
kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; kvp.Value.CreatorID = m_defaultUser;
} }
if (UserManager != null) if (UserManager != null)

View File

@ -108,6 +108,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
bool forceParcels = false; bool forceParcels = false;
bool noObjects = false; bool noObjects = false;
Vector3 displacement = new Vector3(0f, 0f, 0f); Vector3 displacement = new Vector3(0f, 0f, 0f);
String defaultUser = "";
float rotation = 0f; float rotation = 0f;
Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); 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("force-parcels", delegate (string v) { forceParcels = (v != null); });
options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility
options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); 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) { options.Add("displacement=", delegate (string v) {
try try
{ {
@ -131,7 +133,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
return; return;
} }
}); });
options.Add("rotation=", delegate (string v) { options.Add("rotation=", delegate(string v)
{
try try
{ {
rotation = v == null ? 0f : float.Parse(v); 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 (forceTerrain) archiveOptions.Add("force-terrain", null);
if (forceParcels) archiveOptions.Add("force-parcels", null); if (forceParcels) archiveOptions.Add("force-parcels", null);
if (noObjects) archiveOptions.Add("no-objects", 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("displacement", displacement);
archiveOptions.Add("rotation", rotation); archiveOptions.Add("rotation", rotation);
archiveOptions.Add("rotation-center", rotationCenter); archiveOptions.Add("rotation-center", rotationCenter);