diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index dd0ea67..77f38ed 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -41,11 +41,15 @@ using OpenSim.Framework.Servers; | |||
41 | using OpenSim.Framework.Servers.HttpServer; | 41 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Framework.Statistics; | 42 | using OpenSim.Framework.Statistics; |
43 | using OpenSim.Region.ClientStack; | 43 | using OpenSim.Region.ClientStack; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; | ||
44 | using OpenSim.Region.Framework; | 45 | using OpenSim.Region.Framework; |
45 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
46 | using OpenSim.Region.Framework.Scenes; | 47 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Physics.Manager; | 48 | using OpenSim.Region.Physics.Manager; |
48 | using OpenSim.Server.Base; | 49 | using OpenSim.Server.Base; |
50 | using OpenSim.Services.Base; | ||
51 | using OpenSim.Services.Interfaces; | ||
52 | using OpenSim.Services.UserAccountService; | ||
49 | 53 | ||
50 | namespace OpenSim | 54 | namespace OpenSim |
51 | { | 55 | { |
@@ -411,6 +415,9 @@ namespace OpenSim | |||
411 | scene.SnmpService.BootInfo("Loading prins", scene); | 415 | scene.SnmpService.BootInfo("Loading prins", scene); |
412 | } | 416 | } |
413 | 417 | ||
418 | while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | ||
419 | SetUpEstateOwner(scene); | ||
420 | |||
414 | // Prims have to be loaded after module configuration since some modules may be invoked during the load | 421 | // Prims have to be loaded after module configuration since some modules may be invoked during the load |
415 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); | 422 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); |
416 | 423 | ||
@@ -494,6 +501,64 @@ namespace OpenSim | |||
494 | return clientServer; | 501 | return clientServer; |
495 | } | 502 | } |
496 | 503 | ||
504 | /// <summary> | ||
505 | /// Try to set up the estate owner for the given scene. | ||
506 | /// </summary> | ||
507 | /// <remarks> | ||
508 | /// The involves asking the user for information about the user on the console. If the user does not already | ||
509 | /// exist then it is created. | ||
510 | /// </remarks> | ||
511 | /// <param name="scene"></param> | ||
512 | private void SetUpEstateOwner(Scene scene) | ||
513 | { | ||
514 | RegionInfo regionInfo = scene.RegionInfo; | ||
515 | |||
516 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); | ||
517 | List<char> excluded = new List<char>(new char[1]{' '}); | ||
518 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | ||
519 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | ||
520 | |||
521 | UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last); | ||
522 | |||
523 | if (account == null) | ||
524 | { | ||
525 | |||
526 | // XXX: The LocalUserAccountServicesConnector is currently registering its inner service rather than | ||
527 | // itself! | ||
528 | // if (scene.UserAccountService is LocalUserAccountServicesConnector) | ||
529 | // { | ||
530 | // IUserAccountService innerUas | ||
531 | // = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService; | ||
532 | // | ||
533 | // m_log.DebugFormat("B {0}", innerUas.GetType()); | ||
534 | // | ||
535 | // if (innerUas is UserAccountService) | ||
536 | // { | ||
537 | |||
538 | if (scene.UserAccountService is UserAccountService) | ||
539 | { | ||
540 | string password = MainConsole.Instance.PasswdPrompt("Password"); | ||
541 | string email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
542 | |||
543 | account | ||
544 | = ((UserAccountService)scene.UserAccountService).CreateUser( | ||
545 | regionInfo.ScopeID, first, last, password, email); | ||
546 | } | ||
547 | // } | ||
548 | } | ||
549 | |||
550 | if (account == null) | ||
551 | { | ||
552 | m_log.ErrorFormat( | ||
553 | "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); | ||
554 | } | ||
555 | else | ||
556 | { | ||
557 | regionInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
558 | regionInfo.EstateSettings.Save(); | ||
559 | } | ||
560 | } | ||
561 | |||
497 | private void ShutdownRegion(Scene scene) | 562 | private void ShutdownRegion(Scene scene) |
498 | { | 563 | { |
499 | m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); | 564 | m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); |