aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserAccountService/UserAccountService.cs
diff options
context:
space:
mode:
authorDan Lake2011-10-04 16:59:35 -0700
committerDan Lake2011-10-04 16:59:35 -0700
commit38d205502a83ed334d9827f43862579cec305639 (patch)
tree31358ac05557104e6e821309a9c68dd7b3151032 /OpenSim/Services/UserAccountService/UserAccountService.cs
parentRemoved redundant IClientAPI calls from TreePopulatorModule. Removing tree ob... (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-38d205502a83ed334d9827f43862579cec305639.zip
opensim-SC_OLD-38d205502a83ed334d9827f43862579cec305639.tar.gz
opensim-SC_OLD-38d205502a83ed334d9827f43862579cec305639.tar.bz2
opensim-SC_OLD-38d205502a83ed334d9827f43862579cec305639.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Services/UserAccountService/UserAccountService.cs')
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs19
1 files changed, 15 insertions, 4 deletions
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index e071b94..923be7e 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Services.UserAccountService
93 { 93 {
94 MainConsole.Instance.Commands.AddCommand("UserService", false, 94 MainConsole.Instance.Commands.AddCommand("UserService", false,
95 "create user", 95 "create user",
96 "create user [<first> [<last> [<pass> [<email>]]]]", 96 "create user [<first> [<last> [<pass> [<email> [<user id>]]]]]",
97 "Create a new user", HandleCreateUser); 97 "Create a new user", HandleCreateUser);
98 98
99 MainConsole.Instance.Commands.AddCommand("UserService", false, 99 MainConsole.Instance.Commands.AddCommand("UserService", false,
@@ -321,6 +321,7 @@ namespace OpenSim.Services.UserAccountService
321 string lastName; 321 string lastName;
322 string password; 322 string password;
323 string email; 323 string email;
324 string rawPrincipalId;
324 325
325 List<char> excluded = new List<char>(new char[]{' '}); 326 List<char> excluded = new List<char>(new char[]{' '});
326 327
@@ -340,7 +341,16 @@ namespace OpenSim.Services.UserAccountService
340 email = MainConsole.Instance.CmdPrompt("Email", ""); 341 email = MainConsole.Instance.CmdPrompt("Email", "");
341 else email = cmdparams[5]; 342 else email = cmdparams[5];
342 343
343 CreateUser(UUID.Zero, firstName, lastName, password, email); 344 if (cmdparams.Length < 7)
345 rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString());
346 else
347 rawPrincipalId = cmdparams[6];
348
349 UUID principalId = UUID.Zero;
350 if (!UUID.TryParse(rawPrincipalId, out principalId))
351 throw new Exception(string.Format("ID {0} is not a valid UUID", rawPrincipalId));
352
353 CreateUser(UUID.Zero, principalId, firstName, lastName, password, email);
344 } 354 }
345 355
346 protected void HandleShowAccount(string module, string[] cmdparams) 356 protected void HandleShowAccount(string module, string[] cmdparams)
@@ -453,16 +463,17 @@ namespace OpenSim.Services.UserAccountService
453 /// Create a user 463 /// Create a user
454 /// </summary> 464 /// </summary>
455 /// <param name="scopeID">Allows hosting of multiple grids in a single database. Normally left as UUID.Zero</param> 465 /// <param name="scopeID">Allows hosting of multiple grids in a single database. Normally left as UUID.Zero</param>
466 /// <param name="principalID">ID of the user</param>
456 /// <param name="firstName"></param> 467 /// <param name="firstName"></param>
457 /// <param name="lastName"></param> 468 /// <param name="lastName"></param>
458 /// <param name="password"></param> 469 /// <param name="password"></param>
459 /// <param name="email"></param> 470 /// <param name="email"></param>
460 public UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email) 471 public UserAccount CreateUser(UUID scopeID, UUID principalID, string firstName, string lastName, string password, string email)
461 { 472 {
462 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); 473 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
463 if (null == account) 474 if (null == account)
464 { 475 {
465 account = new UserAccount(UUID.Zero, firstName, lastName, email); 476 account = new UserAccount(UUID.Zero, principalID, firstName, lastName, email);
466 if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) 477 if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
467 { 478 {
468 account.ServiceURLs = new Dictionary<string, object>(); 479 account.ServiceURLs = new Dictionary<string, object>();