diff options
author | Melanie | 2019-08-20 23:28:59 +0100 |
---|---|---|
committer | Melanie | 2019-08-20 23:28:59 +0100 |
commit | 0fd17c08ae642fac17b24dfad06c61cfe5739483 (patch) | |
tree | 4871c96eab2f5b118cb09d670a3a4ba024cf1210 /OpenSim/Services/UserAccountService/UserAccountService.cs | |
parent | change PGSQL migration (diff) | |
download | opensim-SC-0fd17c08ae642fac17b24dfad06c61cfe5739483.zip opensim-SC-0fd17c08ae642fac17b24dfad06c61cfe5739483.tar.gz opensim-SC-0fd17c08ae642fac17b24dfad06c61cfe5739483.tar.bz2 opensim-SC-0fd17c08ae642fac17b24dfad06c61cfe5739483.tar.xz |
Massive console refactor. Greatly simplify interface.
Diffstat (limited to 'OpenSim/Services/UserAccountService/UserAccountService.cs')
-rwxr-xr-x[-rw-r--r--] | OpenSim/Services/UserAccountService/UserAccountService.cs | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 9ac8418..5270799 100644..100755 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -385,28 +385,28 @@ namespace OpenSim.Services.UserAccountService | |||
385 | // List<char> excluded = new List<char>(new char[]{' '}); | 385 | // List<char> excluded = new List<char>(new char[]{' '}); |
386 | List<char> excluded = new List<char>(new char[]{' ', '@', '.', ':' }); //Protect user names from using valid HG identifiers. | 386 | List<char> excluded = new List<char>(new char[]{' ', '@', '.', ':' }); //Protect user names from using valid HG identifiers. |
387 | if (cmdparams.Length < 3) | 387 | if (cmdparams.Length < 3) |
388 | firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded); | 388 | firstName = MainConsole.Instance.Prompt("First name", "Default", excluded); |
389 | else firstName = cmdparams[2]; | 389 | else firstName = cmdparams[2]; |
390 | 390 | ||
391 | if (cmdparams.Length < 4) | 391 | if (cmdparams.Length < 4) |
392 | lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded); | 392 | lastName = MainConsole.Instance.Prompt("Last name", "User", excluded); |
393 | else lastName = cmdparams[3]; | 393 | else lastName = cmdparams[3]; |
394 | 394 | ||
395 | if (cmdparams.Length < 5) | 395 | if (cmdparams.Length < 5) |
396 | password = MainConsole.Instance.PasswdPrompt("Password"); | 396 | password = MainConsole.Instance.Prompt("Password", null, null, false); |
397 | else password = cmdparams[4]; | 397 | else password = cmdparams[4]; |
398 | 398 | ||
399 | if (cmdparams.Length < 6) | 399 | if (cmdparams.Length < 6) |
400 | email = MainConsole.Instance.CmdPrompt("Email", ""); | 400 | email = MainConsole.Instance.Prompt("Email", ""); |
401 | else email = cmdparams[5]; | 401 | else email = cmdparams[5]; |
402 | 402 | ||
403 | if (cmdparams.Length < 7) | 403 | if (cmdparams.Length < 7) |
404 | rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID (enter for random)", ""); | 404 | rawPrincipalId = MainConsole.Instance.Prompt("User ID (enter for random)", ""); |
405 | else | 405 | else |
406 | rawPrincipalId = cmdparams[6]; | 406 | rawPrincipalId = cmdparams[6]; |
407 | 407 | ||
408 | if (cmdparams.Length < 8) | 408 | if (cmdparams.Length < 8) |
409 | model = MainConsole.Instance.CmdPrompt("Model name",""); | 409 | model = MainConsole.Instance.Prompt("Model name",""); |
410 | else | 410 | else |
411 | model = cmdparams[7]; | 411 | model = cmdparams[7]; |
412 | 412 | ||
@@ -434,19 +434,19 @@ namespace OpenSim.Services.UserAccountService | |||
434 | 434 | ||
435 | if (ua == null) | 435 | if (ua == null) |
436 | { | 436 | { |
437 | MainConsole.Instance.OutputFormat("No user named {0} {1}", firstName, lastName); | 437 | MainConsole.Instance.Output("No user named {0} {1}", null, firstName, lastName); |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | 440 | ||
441 | MainConsole.Instance.OutputFormat("Name: {0}", ua.Name); | 441 | MainConsole.Instance.Output("Name: {0}", null, ua.Name); |
442 | MainConsole.Instance.OutputFormat("ID: {0}", ua.PrincipalID); | 442 | MainConsole.Instance.Output("ID: {0}", null, ua.PrincipalID); |
443 | MainConsole.Instance.OutputFormat("Title: {0}", ua.UserTitle); | 443 | MainConsole.Instance.Output("Title: {0}", null, ua.UserTitle); |
444 | MainConsole.Instance.OutputFormat("E-mail: {0}", ua.Email); | 444 | MainConsole.Instance.Output("E-mail: {0}", null, ua.Email); |
445 | MainConsole.Instance.OutputFormat("Created: {0}", Utils.UnixTimeToDateTime(ua.Created)); | 445 | MainConsole.Instance.Output("Created: {0}", null, Utils.UnixTimeToDateTime(ua.Created)); |
446 | MainConsole.Instance.OutputFormat("Level: {0}", ua.UserLevel); | 446 | MainConsole.Instance.Output("Level: {0}", null, ua.UserLevel); |
447 | MainConsole.Instance.OutputFormat("Flags: {0}", ua.UserFlags); | 447 | MainConsole.Instance.Output("Flags: {0}", null, ua.UserFlags); |
448 | foreach (KeyValuePair<string, Object> kvp in ua.ServiceURLs) | 448 | foreach (KeyValuePair<string, Object> kvp in ua.ServiceURLs) |
449 | MainConsole.Instance.OutputFormat("{0}: {1}", kvp.Key, kvp.Value); | 449 | MainConsole.Instance.Output("{0}: {1}", null, kvp.Key, kvp.Value); |
450 | } | 450 | } |
451 | 451 | ||
452 | protected void HandleResetUserPassword(string module, string[] cmdparams) | 452 | protected void HandleResetUserPassword(string module, string[] cmdparams) |
@@ -456,21 +456,21 @@ namespace OpenSim.Services.UserAccountService | |||
456 | string newPassword; | 456 | string newPassword; |
457 | 457 | ||
458 | if (cmdparams.Length < 4) | 458 | if (cmdparams.Length < 4) |
459 | firstName = MainConsole.Instance.CmdPrompt("First name"); | 459 | firstName = MainConsole.Instance.Prompt("First name"); |
460 | else firstName = cmdparams[3]; | 460 | else firstName = cmdparams[3]; |
461 | 461 | ||
462 | if (cmdparams.Length < 5) | 462 | if (cmdparams.Length < 5) |
463 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | 463 | lastName = MainConsole.Instance.Prompt("Last name"); |
464 | else lastName = cmdparams[4]; | 464 | else lastName = cmdparams[4]; |
465 | 465 | ||
466 | if (cmdparams.Length < 6) | 466 | if (cmdparams.Length < 6) |
467 | newPassword = MainConsole.Instance.PasswdPrompt("New password"); | 467 | newPassword = MainConsole.Instance.Prompt("New password", null, null, false); |
468 | else newPassword = cmdparams[5]; | 468 | else newPassword = cmdparams[5]; |
469 | 469 | ||
470 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | 470 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); |
471 | if (account == null) | 471 | if (account == null) |
472 | { | 472 | { |
473 | MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName); | 473 | MainConsole.Instance.Output("No such user as {0} {1}", null, firstName, lastName); |
474 | return; | 474 | return; |
475 | } | 475 | } |
476 | 476 | ||
@@ -479,9 +479,9 @@ namespace OpenSim.Services.UserAccountService | |||
479 | success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); | 479 | success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); |
480 | 480 | ||
481 | if (!success) | 481 | if (!success) |
482 | MainConsole.Instance.OutputFormat("Unable to reset password for account {0} {1}.", firstName, lastName); | 482 | MainConsole.Instance.Output("Unable to reset password for account {0} {1}.", null, firstName, lastName); |
483 | else | 483 | else |
484 | MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName); | 484 | MainConsole.Instance.Output("Password reset for user {0} {1}", null, firstName, lastName); |
485 | } | 485 | } |
486 | 486 | ||
487 | protected void HandleResetUserEmail(string module, string[] cmdparams) | 487 | protected void HandleResetUserEmail(string module, string[] cmdparams) |
@@ -491,21 +491,21 @@ namespace OpenSim.Services.UserAccountService | |||
491 | string newEmail; | 491 | string newEmail; |
492 | 492 | ||
493 | if (cmdparams.Length < 4) | 493 | if (cmdparams.Length < 4) |
494 | firstName = MainConsole.Instance.CmdPrompt("First name"); | 494 | firstName = MainConsole.Instance.Prompt("First name"); |
495 | else firstName = cmdparams[3]; | 495 | else firstName = cmdparams[3]; |
496 | 496 | ||
497 | if (cmdparams.Length < 5) | 497 | if (cmdparams.Length < 5) |
498 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | 498 | lastName = MainConsole.Instance.Prompt("Last name"); |
499 | else lastName = cmdparams[4]; | 499 | else lastName = cmdparams[4]; |
500 | 500 | ||
501 | if (cmdparams.Length < 6) | 501 | if (cmdparams.Length < 6) |
502 | newEmail = MainConsole.Instance.PasswdPrompt("New Email"); | 502 | newEmail = MainConsole.Instance.Prompt("New Email"); |
503 | else newEmail = cmdparams[5]; | 503 | else newEmail = cmdparams[5]; |
504 | 504 | ||
505 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | 505 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); |
506 | if (account == null) | 506 | if (account == null) |
507 | { | 507 | { |
508 | MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName); | 508 | MainConsole.Instance.Output("No such user as {0} {1}", null, firstName, lastName); |
509 | return; | 509 | return; |
510 | } | 510 | } |
511 | 511 | ||
@@ -515,9 +515,9 @@ namespace OpenSim.Services.UserAccountService | |||
515 | 515 | ||
516 | success = StoreUserAccount(account); | 516 | success = StoreUserAccount(account); |
517 | if (!success) | 517 | if (!success) |
518 | MainConsole.Instance.OutputFormat("Unable to set Email for account {0} {1}.", firstName, lastName); | 518 | MainConsole.Instance.Output("Unable to set Email for account {0} {1}.", null, firstName, lastName); |
519 | else | 519 | else |
520 | MainConsole.Instance.OutputFormat("User Email set for user {0} {1} to {2}", firstName, lastName, account.Email); | 520 | MainConsole.Instance.Output("User Email set for user {0} {1} to {2}", null, firstName, lastName, account.Email); |
521 | } | 521 | } |
522 | 522 | ||
523 | 523 | ||
@@ -529,25 +529,25 @@ namespace OpenSim.Services.UserAccountService | |||
529 | int level; | 529 | int level; |
530 | 530 | ||
531 | if (cmdparams.Length < 4) | 531 | if (cmdparams.Length < 4) |
532 | firstName = MainConsole.Instance.CmdPrompt("First name"); | 532 | firstName = MainConsole.Instance.Prompt("First name"); |
533 | else firstName = cmdparams[3]; | 533 | else firstName = cmdparams[3]; |
534 | 534 | ||
535 | if (cmdparams.Length < 5) | 535 | if (cmdparams.Length < 5) |
536 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | 536 | lastName = MainConsole.Instance.Prompt("Last name"); |
537 | else lastName = cmdparams[4]; | 537 | else lastName = cmdparams[4]; |
538 | 538 | ||
539 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | 539 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); |
540 | if (account == null) { | 540 | if (account == null) { |
541 | MainConsole.Instance.OutputFormat("No such user"); | 541 | MainConsole.Instance.Output("No such user"); |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | 544 | ||
545 | if (cmdparams.Length < 6) | 545 | if (cmdparams.Length < 6) |
546 | rawLevel = MainConsole.Instance.CmdPrompt("User level"); | 546 | rawLevel = MainConsole.Instance.Prompt("User level"); |
547 | else rawLevel = cmdparams[5]; | 547 | else rawLevel = cmdparams[5]; |
548 | 548 | ||
549 | if(int.TryParse(rawLevel, out level) == false) { | 549 | if(int.TryParse(rawLevel, out level) == false) { |
550 | MainConsole.Instance.OutputFormat("Invalid user level"); | 550 | MainConsole.Instance.Output("Invalid user level"); |
551 | return; | 551 | return; |
552 | } | 552 | } |
553 | 553 | ||
@@ -555,9 +555,9 @@ namespace OpenSim.Services.UserAccountService | |||
555 | 555 | ||
556 | bool success = StoreUserAccount(account); | 556 | bool success = StoreUserAccount(account); |
557 | if (!success) | 557 | if (!success) |
558 | MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName); | 558 | MainConsole.Instance.Output("Unable to set user level for account {0} {1}.", null, firstName, lastName); |
559 | else | 559 | else |
560 | MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level); | 560 | MainConsole.Instance.Output("User level set for user {0} {1} to {2}", null, firstName, lastName, level); |
561 | } | 561 | } |
562 | 562 | ||
563 | #endregion | 563 | #endregion |