diff options
author | Melanie | 2011-10-11 21:29:04 +0100 |
---|---|---|
committer | Melanie | 2011-10-11 21:29:04 +0100 |
commit | 5b4038935246d98059f363374d3f0628f40fb57b (patch) | |
tree | 3f24fe4f5ddfcb085e34b6b8a41bde038d6a03e6 /OpenSim | |
parent | Merge commit '522d6261f11ffaf8320c3f0775beb5d0608ce226' into bigmerge (diff) | |
parent | refactor: move estate owner setup code into separate method (diff) | |
download | opensim-SC_OLD-5b4038935246d98059f363374d3f0628f40fb57b.zip opensim-SC_OLD-5b4038935246d98059f363374d3f0628f40fb57b.tar.gz opensim-SC_OLD-5b4038935246d98059f363374d3f0628f40fb57b.tar.bz2 opensim-SC_OLD-5b4038935246d98059f363374d3f0628f40fb57b.tar.xz |
Merge commit '4ae4b14b5da9b828bbb7c4e5b05693ad8528556a' into bigmerge
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 95 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | 2 |
2 files changed, 52 insertions, 45 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 85870f0..4b87f84 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -414,52 +414,8 @@ namespace OpenSim | |||
414 | scene.SnmpService.BootInfo("Loading prins", scene); | 414 | scene.SnmpService.BootInfo("Loading prins", scene); |
415 | } | 415 | } |
416 | 416 | ||
417 | // FIXME: Put me into a separate method! | ||
418 | while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | 417 | while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) |
419 | { | 418 | SetUpEstateOwner(scene); |
420 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); | ||
421 | List<char> excluded = new List<char>(new char[1]{' '}); | ||
422 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | ||
423 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | ||
424 | |||
425 | UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last); | ||
426 | |||
427 | if (account == null) | ||
428 | { | ||
429 | m_log.DebugFormat("A {0}", scene.UserAccountService.GetType()); | ||
430 | |||
431 | // if (scene.UserAccountService is LocalUserAccountServicesConnector) | ||
432 | // { | ||
433 | // IUserAccountService innerUas | ||
434 | // = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService; | ||
435 | // | ||
436 | // m_log.DebugFormat("B {0}", innerUas.GetType()); | ||
437 | // | ||
438 | // if (innerUas is UserAccountService) | ||
439 | // { | ||
440 | |||
441 | if (scene.UserAccountService is UserAccountService) | ||
442 | { | ||
443 | string password = MainConsole.Instance.PasswdPrompt("Password"); | ||
444 | string email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
445 | |||
446 | // TODO: Where do we put m_regInfo.ScopeID? | ||
447 | account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email); | ||
448 | } | ||
449 | // } | ||
450 | } | ||
451 | |||
452 | if (account == null) | ||
453 | { | ||
454 | m_log.ErrorFormat( | ||
455 | "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); | ||
456 | } | ||
457 | else | ||
458 | { | ||
459 | regionInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
460 | regionInfo.EstateSettings.Save(); | ||
461 | } | ||
462 | } | ||
463 | 419 | ||
464 | // Prims have to be loaded after module configuration since some modules may be invoked during the load | 420 | // Prims have to be loaded after module configuration since some modules may be invoked during the load |
465 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); | 421 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); |
@@ -544,6 +500,55 @@ namespace OpenSim | |||
544 | return clientServer; | 500 | return clientServer; |
545 | } | 501 | } |
546 | 502 | ||
503 | private void SetUpEstateOwner(Scene scene) | ||
504 | { | ||
505 | RegionInfo regionInfo = scene.RegionInfo; | ||
506 | |||
507 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); | ||
508 | List<char> excluded = new List<char>(new char[1]{' '}); | ||
509 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | ||
510 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | ||
511 | |||
512 | UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last); | ||
513 | |||
514 | if (account == null) | ||
515 | { | ||
516 | |||
517 | // XXX: The LocalUserAccountServicesConnector is currently registering its inner service rather than | ||
518 | // itself! | ||
519 | // if (scene.UserAccountService is LocalUserAccountServicesConnector) | ||
520 | // { | ||
521 | // IUserAccountService innerUas | ||
522 | // = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService; | ||
523 | // | ||
524 | // m_log.DebugFormat("B {0}", innerUas.GetType()); | ||
525 | // | ||
526 | // if (innerUas is UserAccountService) | ||
527 | // { | ||
528 | |||
529 | if (scene.UserAccountService is UserAccountService) | ||
530 | { | ||
531 | string password = MainConsole.Instance.PasswdPrompt("Password"); | ||
532 | string email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
533 | |||
534 | // TODO: Where do we put m_regInfo.ScopeID? | ||
535 | account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email); | ||
536 | } | ||
537 | // } | ||
538 | } | ||
539 | |||
540 | if (account == null) | ||
541 | { | ||
542 | m_log.ErrorFormat( | ||
543 | "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); | ||
544 | } | ||
545 | else | ||
546 | { | ||
547 | regionInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
548 | regionInfo.EstateSettings.Save(); | ||
549 | } | ||
550 | } | ||
551 | |||
547 | private void ShutdownRegion(Scene scene) | 552 | private void ShutdownRegion(Scene scene) |
548 | { | 553 | { |
549 | m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); | 554 | m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index df31089..1ffd480 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -124,6 +124,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
124 | if (!m_Enabled) | 124 | if (!m_Enabled) |
125 | return; | 125 | return; |
126 | 126 | ||
127 | // FIXME: Why do we bother setting this module and caching up if we just end up registering the inner | ||
128 | // user account service?! | ||
127 | scene.RegisterModuleInterface<IUserAccountService>(UserAccountService); | 129 | scene.RegisterModuleInterface<IUserAccountService>(UserAccountService); |
128 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); | 130 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); |
129 | } | 131 | } |