/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs |
@@ -114,12 +114,13 @@ |
|
scene.AddCommand( |
"Archiving", this, "load iar", |
"load iar [-m|--merge] <first> <last> <inventory path> [<IAR path>]", |
"load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", |
"Load user inventory archive (IAR).", |
"-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" |
+ "<first> is user's first name." + Environment.NewLine |
+ "<last> is user's last name." + Environment.NewLine |
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine |
+ "<password> is the user's password." + Environment.NewLine |
+ "<IAR path> is the filesystem path or URI from which to load the IAR." |
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), |
HandleLoadInvConsoleCommand); |
@@ -126,7 +127,7 @@ |
|
scene.AddCommand( |
"Archiving", this, "save iar", |
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]", |
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]", |
"Save user inventory archive (IAR).", |
"<first> is the user's first name.\n" |
+ "<last> is the user's last name.\n" |
@@ -183,18 +184,18 @@ |
} |
|
public bool ArchiveInventory( |
Guid id, string firstName, string lastName, string invPath, Stream saveStream) |
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) |
{ |
return ArchiveInventory(id, firstName, lastName, invPath, saveStream, new Dictionary<string, object>()); |
return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>()); |
} |
|
public bool ArchiveInventory( |
Guid id, string firstName, string lastName, string invPath, Stream saveStream, |
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, |
Dictionary<string, object> options) |
{ |
if (m_scenes.Count > 0) |
{ |
UserAccount userInfo = GetUserInfo(firstName, lastName); |
UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
|
if (userInfo != null) |
{ |
@@ -229,7 +230,7 @@ |
} |
|
public bool ArchiveInventory( |
Guid id, string firstName, string lastName, string invPath, string savePath, |
Guid id, string firstName, string lastName, string invPath, string pass, string savePath, |
Dictionary<string, object> options) |
{ |
// if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) |
@@ -237,7 +238,7 @@ |
|
if (m_scenes.Count > 0) |
{ |
UserAccount userInfo = GetUserInfo(firstName, lastName); |
UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
|
if (userInfo != null) |
{ |
@@ -271,18 +272,18 @@ |
return false; |
} |
|
public bool DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream) |
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) |
{ |
return DearchiveInventory(firstName, lastName, invPath, loadStream, new Dictionary<string, object>()); |
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); |
} |
|
public bool DearchiveInventory( |
string firstName, string lastName, string invPath, Stream loadStream, |
string firstName, string lastName, string invPath, string pass, Stream loadStream, |
Dictionary<string, object> options) |
{ |
if (m_scenes.Count > 0) |
{ |
UserAccount userInfo = GetUserInfo(firstName, lastName); |
UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
|
if (userInfo != null) |
{ |
@@ -325,12 +326,12 @@ |
} |
|
public bool DearchiveInventory( |
string firstName, string lastName, string invPath, string loadPath, |
string firstName, string lastName, string invPath, string pass, string loadPath, |
Dictionary<string, object> options) |
{ |
if (m_scenes.Count > 0) |
{ |
UserAccount userInfo = GetUserInfo(firstName, lastName); |
UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
|
if (userInfo != null) |
{ |
@@ -382,10 +383,10 @@ |
|
List<string> mainParams = optionSet.Parse(cmdparams); |
|
if (mainParams.Count < 5) |
if (mainParams.Count < 6) |
{ |
m_log.Error( |
"[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> [<load file path>]"); |
"[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); |
return; |
} |
|
@@ -392,13 +393,14 @@ |
string firstName = mainParams[2]; |
string lastName = mainParams[3]; |
string invPath = mainParams[4]; |
string loadPath = (mainParams.Count > 5 ? mainParams[5] : DEFAULT_INV_BACKUP_FILENAME); |
string pass = mainParams[5]; |
string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
|
m_log.InfoFormat( |
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", |
loadPath, invPath, firstName, lastName); |
|
if (DearchiveInventory(firstName, lastName, invPath, loadPath, options)) |
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) |
m_log.InfoFormat( |
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", |
loadPath, firstName, lastName); |
@@ -442,10 +444,10 @@ |
|
try |
{ |
if (mainParams.Count < 5) |
if (mainParams.Count < 6) |
{ |
m_log.Error( |
"[INVENTORY ARCHIVER]: save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]"); |
"[INVENTORY ARCHIVER]: save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]"); |
return; |
} |
|
@@ -455,7 +457,8 @@ |
string firstName = mainParams[2]; |
string lastName = mainParams[3]; |
string invPath = mainParams[4]; |
string savePath = (mainParams.Count > 5 ? mainParams[5] : DEFAULT_INV_BACKUP_FILENAME); |
string pass = mainParams[5]; |
string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
|
m_log.InfoFormat( |
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", |
@@ -464,7 +467,7 @@ |
lock (m_pendingConsoleSaves) |
m_pendingConsoleSaves.Add(id); |
|
ArchiveInventory(id, firstName, lastName, invPath, savePath, options); |
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); |
} |
catch (InventoryArchiverException e) |
{ |
@@ -501,8 +504,9 @@ |
/// </summary> |
/// <param name="firstName"></param> |
/// <param name="lastName"></param> |
/// <param name="pass">User password</param> |
/// <returns></returns> |
protected UserAccount GetUserInfo(string firstName, string lastName) |
protected UserAccount GetUserInfo(string firstName, string lastName, string pass) |
{ |
UserAccount account |
= m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); |
@@ -514,7 +518,27 @@ |
firstName, lastName); |
return null; |
} |
return account; |
|
try |
{ |
string encpass = Util.Md5Hash(pass); |
if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, encpass, 1) != string.Empty) |
{ |
return account; |
} |
else |
{ |
m_log.ErrorFormat( |
"[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", |
firstName, lastName); |
return null; |
} |
} |
catch (Exception e) |
{ |
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e); |
return null; |
} |
} |
|
/// <summary> |