clockwerk-opensim-stable – Diff between revs 1 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 1 Rev 3
Line 112... Line 112...
112 scene.RegisterModuleInterface<IInventoryArchiverModule>(this); 112 scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
113 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; 113 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
Line 114... Line 114...
114   114  
115 scene.AddCommand( 115 scene.AddCommand(
116 "Archiving", this, "load iar", 116 "Archiving", this, "load iar",
117 "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", 117 "load iar [-m|--merge] <first> <last> <inventory path> [<IAR path>]",
118 "Load user inventory archive (IAR).", 118 "Load user inventory archive (IAR).",
119 "-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" 119 "-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
120 + "<first> is user's first name." + Environment.NewLine 120 + "<first> is user's first name." + Environment.NewLine
121 + "<last> is user's last name." + Environment.NewLine 121 + "<last> is user's last name." + Environment.NewLine
122 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine -  
123 + "<password> is the user's password." + Environment.NewLine 122 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
124 + "<IAR path> is the filesystem path or URI from which to load the IAR." 123 + "<IAR path> is the filesystem path or URI from which to load the IAR."
125 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), 124 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
Line 126... Line 125...
126 HandleLoadInvConsoleCommand); 125 HandleLoadInvConsoleCommand);
127   126  
128 scene.AddCommand( 127 scene.AddCommand(
129 "Archiving", this, "save iar", 128 "Archiving", this, "save iar",
130 "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]", 129 "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]",
131 "Save user inventory archive (IAR).", 130 "Save user inventory archive (IAR).",
132 "<first> is the user's first name.\n" 131 "<first> is the user's first name.\n"
133 + "<last> is the user's last name.\n" 132 + "<last> is the user's last name.\n"
Line 182... Line 181...
182 if (handlerInventoryArchiveSaved != null) 181 if (handlerInventoryArchiveSaved != null)
183 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); 182 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
184 } 183 }
Line 185... Line 184...
185   184  
186 public bool ArchiveInventory( 185 public bool ArchiveInventory(
187 Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) 186 Guid id, string firstName, string lastName, string invPath, Stream saveStream)
188 { 187 {
189 return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>()); 188 return ArchiveInventory(id, firstName, lastName, invPath, saveStream, new Dictionary<string, object>());
Line 190... Line 189...
190 } 189 }
191   190  
192 public bool ArchiveInventory( 191 public bool ArchiveInventory(
193 Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, 192 Guid id, string firstName, string lastName, string invPath, Stream saveStream,
194 Dictionary<string, object> options) 193 Dictionary<string, object> options)
195 { 194 {
196 if (m_scenes.Count > 0) 195 if (m_scenes.Count > 0)
Line 197... Line 196...
197 { 196 {
198 UserAccount userInfo = GetUserInfo(firstName, lastName, pass); 197 UserAccount userInfo = GetUserInfo(firstName, lastName);
199   198  
200 if (userInfo != null) 199 if (userInfo != null)
Line 228... Line 227...
228   227  
229 return false; 228 return false;
Line 230... Line 229...
230 } 229 }
231   230  
232 public bool ArchiveInventory( 231 public bool ArchiveInventory(
233 Guid id, string firstName, string lastName, string invPath, string pass, string savePath, 232 Guid id, string firstName, string lastName, string invPath, string savePath,
234 Dictionary<string, object> options) 233 Dictionary<string, object> options)
235 { 234 {
Line 236... Line 235...
236 // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) 235 // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath))
237 // return false; 236 // return false;
238   237  
Line 239... Line 238...
239 if (m_scenes.Count > 0) 238 if (m_scenes.Count > 0)
240 { 239 {
241 UserAccount userInfo = GetUserInfo(firstName, lastName, pass); 240 UserAccount userInfo = GetUserInfo(firstName, lastName);
242   241  
Line 270... Line 269...
270 } 269 }
Line 271... Line 270...
271   270  
272 return false; 271 return false;
Line 273... Line 272...
273 } 272 }
274   273  
275 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) 274 public bool DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream)
276 { 275 {
Line 277... Line 276...
277 return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); 276 return DearchiveInventory(firstName, lastName, invPath, loadStream, new Dictionary<string, object>());
278 } 277 }
279   278  
280 public bool DearchiveInventory( 279 public bool DearchiveInventory(
281 string firstName, string lastName, string invPath, string pass, Stream loadStream, 280 string firstName, string lastName, string invPath, Stream loadStream,
282 Dictionary<string, object> options) 281 Dictionary<string, object> options)
283 { 282 {
Line 284... Line 283...
284 if (m_scenes.Count > 0) 283 if (m_scenes.Count > 0)
285 { 284 {
286 UserAccount userInfo = GetUserInfo(firstName, lastName, pass); 285 UserAccount userInfo = GetUserInfo(firstName, lastName);
287   286  
Line 324... Line 323...
324   323  
325 return false; 324 return false;
Line 326... Line 325...
326 } 325 }
327   326  
328 public bool DearchiveInventory( 327 public bool DearchiveInventory(
329 string firstName, string lastName, string invPath, string pass, string loadPath, 328 string firstName, string lastName, string invPath, string loadPath,
330 Dictionary<string, object> options) 329 Dictionary<string, object> options)
331 { 330 {
332 if (m_scenes.Count > 0) 331 if (m_scenes.Count > 0)
Line 333... Line 332...
333 { 332 {
334 UserAccount userInfo = GetUserInfo(firstName, lastName, pass); 333 UserAccount userInfo = GetUserInfo(firstName, lastName);
335   334  
336 if (userInfo != null) 335 if (userInfo != null)
Line 381... Line 380...
381 Dictionary<string, object> options = new Dictionary<string, object>(); 380 Dictionary<string, object> options = new Dictionary<string, object>();
382 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 381 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
Line 383... Line 382...
383   382  
Line 384... Line 383...
384 List<string> mainParams = optionSet.Parse(cmdparams); 383 List<string> mainParams = optionSet.Parse(cmdparams);
385   384  
386 if (mainParams.Count < 6) 385 if (mainParams.Count < 5)
387 { 386 {
388 m_log.Error( 387 m_log.Error(
389 "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); 388 "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> [<load file path>]");
Line 390... Line 389...
390 return; 389 return;
391 } 390 }
392   391  
393 string firstName = mainParams[2]; -  
394 string lastName = mainParams[3]; 392 string firstName = mainParams[2];
Line 395... Line 393...
395 string invPath = mainParams[4]; 393 string lastName = mainParams[3];
396 string pass = mainParams[5]; 394 string invPath = mainParams[4];
397 string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); 395 string loadPath = (mainParams.Count > 5 ? mainParams[5] : DEFAULT_INV_BACKUP_FILENAME);
Line 398... Line 396...
398   396  
399 m_log.InfoFormat( 397 m_log.InfoFormat(
400 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 398 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
401 loadPath, invPath, firstName, lastName); 399 loadPath, invPath, firstName, lastName);
402   400  
403 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) 401 if (DearchiveInventory(firstName, lastName, invPath, loadPath, options))
Line 442... Line 440...
442   440  
Line 443... Line 441...
443 List<string> mainParams = ops.Parse(cmdparams); 441 List<string> mainParams = ops.Parse(cmdparams);
444   442  
445 try 443 try
446 { 444 {
447 if (mainParams.Count < 6) 445 if (mainParams.Count < 5)
448 { 446 {
449 m_log.Error( 447 m_log.Error(
450 "[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]"); 448 "[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]");
Line 451... Line 449...
451 return; 449 return;
452 } 450 }
Line 453... Line 451...
453   451  
454 if (options.ContainsKey("home")) 452 if (options.ContainsKey("home"))
455 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); 453 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR");
456   -  
457 string firstName = mainParams[2]; 454  
Line 458... Line 455...
458 string lastName = mainParams[3]; 455 string firstName = mainParams[2];
459 string invPath = mainParams[4]; 456 string lastName = mainParams[3];
460 string pass = mainParams[5]; 457 string invPath = mainParams[4];
Line 461... Line 458...
461 string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); 458 string savePath = (mainParams.Count > 5 ? mainParams[5] : DEFAULT_INV_BACKUP_FILENAME);
462   459  
Line 463... Line 460...
463 m_log.InfoFormat( 460 m_log.InfoFormat(
464 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", 461 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
465 savePath, invPath, firstName, lastName); 462 savePath, invPath, firstName, lastName);
466   463  
467 lock (m_pendingConsoleSaves) 464 lock (m_pendingConsoleSaves)
468 m_pendingConsoleSaves.Add(id); 465 m_pendingConsoleSaves.Add(id);
Line 502... Line 499...
502 /// <summary> 499 /// <summary>
503 /// Get user information for the given name. 500 /// Get user information for the given name.
504 /// </summary> 501 /// </summary>
505 /// <param name="firstName"></param> 502 /// <param name="firstName"></param>
506 /// <param name="lastName"></param> 503 /// <param name="lastName"></param>
507 /// <param name="pass">User password</param> -  
508 /// <returns></returns> 504 /// <returns></returns>
509 protected UserAccount GetUserInfo(string firstName, string lastName, string pass) 505 protected UserAccount GetUserInfo(string firstName, string lastName)
510 { 506 {
511 UserAccount account 507 UserAccount account
512 = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); 508 = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName);
Line 513... Line 509...
513   509  
Line 516... Line 512...
516 m_log.ErrorFormat( 512 m_log.ErrorFormat(
517 "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", 513 "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}",
518 firstName, lastName); 514 firstName, lastName);
519 return null; 515 return null;
520 } 516 }
521   -  
522 try -  
523 { -  
524 string encpass = Util.Md5Hash(pass); -  
525 if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, encpass, 1) != string.Empty) -  
526 { -  
527 return account; 517 return account;
528 } -  
529 else -  
530 { -  
531 m_log.ErrorFormat( -  
532 "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", -  
533 firstName, lastName); -  
534 return null; -  
535 } -  
536 } -  
537 catch (Exception e) -  
538 { -  
539 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e); -  
540 return null; -  
541 } -  
542 } 518 }
Line 543... Line 519...
543   519  
544 /// <summary> 520 /// <summary>
545 /// Notify the client of loaded nodes if they are logged in 521 /// Notify the client of loaded nodes if they are logged in