aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserAccountService/UserAccountService.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-06-25 00:03:34 +0100
committerJustin Clark-Casey (justincc)2011-06-25 00:03:34 +0100
commit296774495b8544cbb3463e0a0694d7de910a5d7c (patch)
tree0c4a75936322df5f60e5bf59cb3b1c9391213787 /OpenSim/Services/UserAccountService/UserAccountService.cs
parentAdd a command "show account <first-name> <last-Name>" to the user account ser... (diff)
downloadopensim-SC_OLD-296774495b8544cbb3463e0a0694d7de910a5d7c.zip
opensim-SC_OLD-296774495b8544cbb3463e0a0694d7de910a5d7c.tar.gz
opensim-SC_OLD-296774495b8544cbb3463e0a0694d7de910a5d7c.tar.bz2
opensim-SC_OLD-296774495b8544cbb3463e0a0694d7de910a5d7c.tar.xz
Implement "set user level" console command to set the user level (which determines whether a user has a god account)
Adapted from Makopoppo's patch in http://opensimulator.org/mantis/view.php?id=5552. Thanks!
Diffstat (limited to 'OpenSim/Services/UserAccountService/UserAccountService.cs')
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs47
1 files changed, 47 insertions, 0 deletions
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 3525912..a65c04b 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -90,6 +90,14 @@ namespace OpenSim.Services.UserAccountService
90 "Reset a user password", HandleResetUserPassword); 90 "Reset a user password", HandleResetUserPassword);
91 91
92 MainConsole.Instance.Commands.AddCommand("UserService", false, 92 MainConsole.Instance.Commands.AddCommand("UserService", false,
93 "set user level",
94 "set user level [<first> [<last> [<level>]]]",
95 "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
96 + "this account will be treated as god-moded. "
97 + "It will also affect the 'login level' command. ",
98 HandleSetUserLevel);
99
100 MainConsole.Instance.Commands.AddCommand("UserService", false,
93 "show account", 101 "show account",
94 "show account <first> <last>", 102 "show account <first> <last>",
95 "Show account details for the given user", HandleShowAccount); 103 "Show account details for the given user", HandleShowAccount);
@@ -387,6 +395,45 @@ namespace OpenSim.Services.UserAccountService
387 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName); 395 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
388 } 396 }
389 397
398 protected void HandleSetUserLevel(string module, string[] cmdparams)
399 {
400 string firstName;
401 string lastName;
402 string rawLevel;
403 int level;
404
405 if (cmdparams.Length < 4)
406 firstName = MainConsole.Instance.CmdPrompt("First name");
407 else firstName = cmdparams[3];
408
409 if (cmdparams.Length < 5)
410 lastName = MainConsole.Instance.CmdPrompt("Last name");
411 else lastName = cmdparams[4];
412
413 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
414 if (account == null) {
415 MainConsole.Instance.OutputFormat("No such user");
416 return;
417 }
418
419 if (cmdparams.Length < 6)
420 rawLevel = MainConsole.Instance.CmdPrompt("User level");
421 else rawLevel = cmdparams[5];
422
423 if(int.TryParse(rawLevel, out level) == false) {
424 MainConsole.Instance.OutputFormat("Invalid user level");
425 return;
426 }
427
428 account.UserLevel = level;
429
430 bool success = StoreUserAccount(account);
431 if (!success)
432 MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName);
433 else
434 MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level);
435 }
436
390 #endregion 437 #endregion
391 438
392 /// <summary> 439 /// <summary>