updated version of default user switch for load oar :q :q
parent
cecb446e0e
commit
8b3c2f7d0c
|
@ -272,6 +272,7 @@ namespace OpenSim
|
|||
+ " [--no-objects]"
|
||||
+ " [--rotation degrees] [--rotation-center \"<x,y,z>\"]"
|
||||
+ " [--displacement \"<x,y,z>\"]"
|
||||
+ " [--default-user \"User Name\"]"
|
||||
+ " [<OAR path>]",
|
||||
"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
|
||||
|
|
|
@ -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, Dictionary<string,object>options)
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue