diff options
author | Dan Lake | 2011-07-11 12:23:20 -0700 |
---|---|---|
committer | Dan Lake | 2011-07-11 12:23:20 -0700 |
commit | b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a (patch) | |
tree | 8fd2fa4567e2882e7f5dafdb8cf1de571917f23a /OpenSim/Services/UserAccountService | |
parent | Checkin 32 bit bulletsim shared library for Linux. (diff) | |
parent | minor Tack the prim name on the end of the "experimental mesh proxy generatio... (diff) | |
download | opensim-SC-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.zip opensim-SC-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.tar.gz opensim-SC-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.tar.bz2 opensim-SC-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.tar.xz |
Merge branch 'master' into bulletsim
Diffstat (limited to 'OpenSim/Services/UserAccountService')
-rw-r--r-- | OpenSim/Services/UserAccountService/UserAccountService.cs | 97 |
1 files changed, 92 insertions, 5 deletions
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index f376cf8..8b8a8f9 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -83,9 +83,24 @@ namespace OpenSim.Services.UserAccountService | |||
83 | "create user", | 83 | "create user", |
84 | "create user [<first> [<last> [<pass> [<email>]]]]", | 84 | "create user [<first> [<last> [<pass> [<email>]]]]", |
85 | "Create a new user", HandleCreateUser); | 85 | "Create a new user", HandleCreateUser); |
86 | MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password", | 86 | |
87 | MainConsole.Instance.Commands.AddCommand("UserService", false, | ||
88 | "reset user password", | ||
87 | "reset user password [<first> [<last> [<password>]]]", | 89 | "reset user password [<first> [<last> [<password>]]]", |
88 | "Reset a user password", HandleResetUserPassword); | 90 | "Reset a user password", HandleResetUserPassword); |
91 | |||
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, | ||
101 | "show account", | ||
102 | "show account <first> <last>", | ||
103 | "Show account details for the given user", HandleShowAccount); | ||
89 | } | 104 | } |
90 | 105 | ||
91 | } | 106 | } |
@@ -318,6 +333,36 @@ namespace OpenSim.Services.UserAccountService | |||
318 | CreateUser(firstName, lastName, password, email); | 333 | CreateUser(firstName, lastName, password, email); |
319 | } | 334 | } |
320 | 335 | ||
336 | protected void HandleShowAccount(string module, string[] cmdparams) | ||
337 | { | ||
338 | if (cmdparams.Length != 4) | ||
339 | { | ||
340 | MainConsole.Instance.Output("Usage: show account <first-name> <last-name>"); | ||
341 | return; | ||
342 | } | ||
343 | |||
344 | string firstName = cmdparams[2]; | ||
345 | string lastName = cmdparams[3]; | ||
346 | |||
347 | UserAccount ua = GetUserAccount(UUID.Zero, firstName, lastName); | ||
348 | |||
349 | if (ua == null) | ||
350 | { | ||
351 | MainConsole.Instance.OutputFormat("No user named {0} {1}", firstName, lastName); | ||
352 | return; | ||
353 | } | ||
354 | |||
355 | MainConsole.Instance.OutputFormat("Name: {0}", ua.Name); | ||
356 | MainConsole.Instance.OutputFormat("ID: {0}", ua.PrincipalID); | ||
357 | MainConsole.Instance.OutputFormat("Title: {0}", ua.UserTitle); | ||
358 | MainConsole.Instance.OutputFormat("E-mail: {0}", ua.Email); | ||
359 | MainConsole.Instance.OutputFormat("Created: {0}", Utils.UnixTimeToDateTime(ua.Created)); | ||
360 | MainConsole.Instance.OutputFormat("Level: {0}", ua.UserLevel); | ||
361 | MainConsole.Instance.OutputFormat("Flags: {0}", ua.UserFlags); | ||
362 | foreach (KeyValuePair<string, Object> kvp in ua.ServiceURLs) | ||
363 | MainConsole.Instance.OutputFormat("{0}: {1}", kvp.Key, kvp.Value); | ||
364 | } | ||
365 | |||
321 | protected void HandleResetUserPassword(string module, string[] cmdparams) | 366 | protected void HandleResetUserPassword(string module, string[] cmdparams) |
322 | { | 367 | { |
323 | string firstName; | 368 | string firstName; |
@@ -338,16 +383,58 @@ namespace OpenSim.Services.UserAccountService | |||
338 | 383 | ||
339 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | 384 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); |
340 | if (account == null) | 385 | if (account == null) |
341 | m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user"); | 386 | { |
387 | MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName); | ||
388 | return; | ||
389 | } | ||
342 | 390 | ||
343 | bool success = false; | 391 | bool success = false; |
344 | if (m_AuthenticationService != null) | 392 | if (m_AuthenticationService != null) |
345 | success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); | 393 | success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); |
394 | |||
395 | if (!success) | ||
396 | MainConsole.Instance.OutputFormat("Unable to reset password for account {0} {1}.", firstName, lastName); | ||
397 | else | ||
398 | MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName); | ||
399 | } | ||
400 | |||
401 | protected void HandleSetUserLevel(string module, string[] cmdparams) | ||
402 | { | ||
403 | string firstName; | ||
404 | string lastName; | ||
405 | string rawLevel; | ||
406 | int level; | ||
407 | |||
408 | if (cmdparams.Length < 4) | ||
409 | firstName = MainConsole.Instance.CmdPrompt("First name"); | ||
410 | else firstName = cmdparams[3]; | ||
411 | |||
412 | if (cmdparams.Length < 5) | ||
413 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | ||
414 | else lastName = cmdparams[4]; | ||
415 | |||
416 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | ||
417 | if (account == null) { | ||
418 | MainConsole.Instance.OutputFormat("No such user"); | ||
419 | return; | ||
420 | } | ||
421 | |||
422 | if (cmdparams.Length < 6) | ||
423 | rawLevel = MainConsole.Instance.CmdPrompt("User level"); | ||
424 | else rawLevel = cmdparams[5]; | ||
425 | |||
426 | if(int.TryParse(rawLevel, out level) == false) { | ||
427 | MainConsole.Instance.OutputFormat("Invalid user level"); | ||
428 | return; | ||
429 | } | ||
430 | |||
431 | account.UserLevel = level; | ||
432 | |||
433 | bool success = StoreUserAccount(account); | ||
346 | if (!success) | 434 | if (!success) |
347 | m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.", | 435 | MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName); |
348 | firstName, lastName); | ||
349 | else | 436 | else |
350 | m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName); | 437 | MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level); |
351 | } | 438 | } |
352 | 439 | ||
353 | #endregion | 440 | #endregion |