diff options
author | Justin Clark-Casey (justincc) | 2011-10-04 23:48:35 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-04 23:48:35 +0100 |
commit | b907a66f394b279d3ca2b1ac620bc7bb13cc6dd2 (patch) | |
tree | a1841184d9c88585afda4abdd31298501c74ab84 | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-b907a66f394b279d3ca2b1ac620bc7bb13cc6dd2.zip opensim-SC_OLD-b907a66f394b279d3ca2b1ac620bc7bb13cc6dd2.tar.gz opensim-SC_OLD-b907a66f394b279d3ca2b1ac620bc7bb13cc6dd2.tar.bz2 opensim-SC_OLD-b907a66f394b279d3ca2b1ac620bc7bb13cc6dd2.tar.xz |
When creating a new user on the comand line, give the option of allowing a UUID to be specified to override the randomly generated one.
This can be useful in some migration cases where recreating user accounts with known IDs will preserve region scene object ownership.
Diffstat (limited to '')
4 files changed, 28 insertions, 8 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 08f3dc7..c270428 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -3115,7 +3115,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3115 | UserAccount account = userAccountService.GetUserAccount(scopeID, firstName, lastName); | 3115 | UserAccount account = userAccountService.GetUserAccount(scopeID, firstName, lastName); |
3116 | if (null == account) | 3116 | if (null == account) |
3117 | { | 3117 | { |
3118 | account = new UserAccount(scopeID, firstName, lastName, email); | 3118 | account = new UserAccount(scopeID, UUID.Random(), firstName, lastName, email); |
3119 | if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) | 3119 | if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) |
3120 | { | 3120 | { |
3121 | account.ServiceURLs = new Dictionary<string, object>(); | 3121 | account.ServiceURLs = new Dictionary<string, object>(); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 866ba9a..a6b91a3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -462,9 +462,18 @@ namespace OpenSim | |||
462 | string password = MainConsole.Instance.PasswdPrompt("Password"); | 462 | string password = MainConsole.Instance.PasswdPrompt("Password"); |
463 | string email = MainConsole.Instance.CmdPrompt("Email", ""); | 463 | string email = MainConsole.Instance.CmdPrompt("Email", ""); |
464 | 464 | ||
465 | string rawPrincipalId = MainConsole.Instance.CmdPrompt("ID", UUID.Random().ToString()); | ||
466 | |||
467 | UUID principalId = UUID.Zero; | ||
468 | if (!UUID.TryParse(rawPrincipalId, out principalId)) | ||
469 | { | ||
470 | m_log.ErrorFormat("[OPENSIM]: ID {0} is not a valid UUID", rawPrincipalId); | ||
471 | return; | ||
472 | } | ||
473 | |||
465 | account | 474 | account |
466 | = ((UserAccountService)scene.UserAccountService).CreateUser( | 475 | = ((UserAccountService)scene.UserAccountService).CreateUser( |
467 | regionInfo.ScopeID, first, last, password, email); | 476 | regionInfo.ScopeID, principalId, first, last, password, email); |
468 | } | 477 | } |
469 | // } | 478 | // } |
470 | } | 479 | } |
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 9c992e0..20414f6 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -44,9 +44,9 @@ namespace OpenSim.Services.Interfaces | |||
44 | PrincipalID = principalID; | 44 | PrincipalID = principalID; |
45 | } | 45 | } |
46 | 46 | ||
47 | public UserAccount(UUID scopeID, string firstName, string lastName, string email) | 47 | public UserAccount(UUID scopeID, UUID principalID, string firstName, string lastName, string email) |
48 | { | 48 | { |
49 | PrincipalID = UUID.Random(); | 49 | PrincipalID = principalID; |
50 | ScopeID = scopeID; | 50 | ScopeID = scopeID; |
51 | FirstName = firstName; | 51 | FirstName = firstName; |
52 | LastName = lastName; | 52 | LastName = lastName; |
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>(); |