aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-09-16 00:24:23 +0100
committerJustin Clark-Casey (justincc)2011-09-16 00:24:23 +0100
commit4ae4b14b5da9b828bbb7c4e5b05693ad8528556a (patch)
treec33b3b79b081e9b43bb4dfccda3fd3a7e43272d5 /OpenSim/Region/Application
parentCorrectly create a freshly created estate owner's default items and avatar en... (diff)
downloadopensim-SC_OLD-4ae4b14b5da9b828bbb7c4e5b05693ad8528556a.zip
opensim-SC_OLD-4ae4b14b5da9b828bbb7c4e5b05693ad8528556a.tar.gz
opensim-SC_OLD-4ae4b14b5da9b828bbb7c4e5b05693ad8528556a.tar.bz2
opensim-SC_OLD-4ae4b14b5da9b828bbb7c4e5b05693ad8528556a.tar.xz
refactor: move estate owner setup code into separate method
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs95
1 files changed, 50 insertions, 45 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 3060169..8662ea8 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -365,52 +365,8 @@ namespace OpenSim
365 365
366 scene.SetModuleInterfaces(); 366 scene.SetModuleInterfaces();
367 367
368 // FIXME: Put me into a separate method!
369 while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 368 while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
370 { 369 SetUpEstateOwner(scene);
371 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
372 List<char> excluded = new List<char>(new char[1]{' '});
373 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
374 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
375
376 UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last);
377
378 if (account == null)
379 {
380 m_log.DebugFormat("A {0}", scene.UserAccountService.GetType());
381
382// if (scene.UserAccountService is LocalUserAccountServicesConnector)
383// {
384// IUserAccountService innerUas
385// = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService;
386//
387// m_log.DebugFormat("B {0}", innerUas.GetType());
388//
389// if (innerUas is UserAccountService)
390// {
391
392 if (scene.UserAccountService is UserAccountService)
393 {
394 string password = MainConsole.Instance.PasswdPrompt("Password");
395 string email = MainConsole.Instance.CmdPrompt("Email", "");
396
397 // TODO: Where do we put m_regInfo.ScopeID?
398 account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email);
399 }
400// }
401 }
402
403 if (account == null)
404 {
405 m_log.ErrorFormat(
406 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
407 }
408 else
409 {
410 regionInfo.EstateSettings.EstateOwner = account.PrincipalID;
411 regionInfo.EstateSettings.Save();
412 }
413 }
414 370
415 // Prims have to be loaded after module configuration since some modules may be invoked during the load 371 // Prims have to be loaded after module configuration since some modules may be invoked during the load
416 scene.LoadPrimsFromStorage(regionInfo.originRegionID); 372 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
@@ -466,6 +422,55 @@ namespace OpenSim
466 return clientServer; 422 return clientServer;
467 } 423 }
468 424
425 private void SetUpEstateOwner(Scene scene)
426 {
427 RegionInfo regionInfo = scene.RegionInfo;
428
429 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
430 List<char> excluded = new List<char>(new char[1]{' '});
431 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
432 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
433
434 UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last);
435
436 if (account == null)
437 {
438
439 // XXX: The LocalUserAccountServicesConnector is currently registering its inner service rather than
440 // itself!
441// if (scene.UserAccountService is LocalUserAccountServicesConnector)
442// {
443// IUserAccountService innerUas
444// = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService;
445//
446// m_log.DebugFormat("B {0}", innerUas.GetType());
447//
448// if (innerUas is UserAccountService)
449// {
450
451 if (scene.UserAccountService is UserAccountService)
452 {
453 string password = MainConsole.Instance.PasswdPrompt("Password");
454 string email = MainConsole.Instance.CmdPrompt("Email", "");
455
456 // TODO: Where do we put m_regInfo.ScopeID?
457 account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email);
458 }
459// }
460 }
461
462 if (account == null)
463 {
464 m_log.ErrorFormat(
465 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
466 }
467 else
468 {
469 regionInfo.EstateSettings.EstateOwner = account.PrincipalID;
470 regionInfo.EstateSettings.Save();
471 }
472 }
473
469 private void ShutdownRegion(Scene scene) 474 private void ShutdownRegion(Scene scene)
470 { 475 {
471 m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); 476 m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName);