aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
diff options
context:
space:
mode:
authorrandomhuman2010-08-13 16:08:43 +0100
committerJustin Clark-Casey (justincc)2010-08-13 23:29:01 +0100
commit8eeb3f2fd21c05f0bfd141e333f34c4c69e8865b (patch)
tree90e2127451904c4e40d3c5382bbc96188ad7e004 /OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
parentminor: remove mono compiler warnings (diff)
downloadopensim-SC-8eeb3f2fd21c05f0bfd141e333f34c4c69e8865b.zip
opensim-SC-8eeb3f2fd21c05f0bfd141e333f34c4c69e8865b.tar.gz
opensim-SC-8eeb3f2fd21c05f0bfd141e333f34c4c69e8865b.tar.bz2
opensim-SC-8eeb3f2fd21c05f0bfd141e333f34c4c69e8865b.tar.xz
Updated the create_region command in the RemoteAdmin plugin to properly support estates without seeking further input on the console.
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs92
1 files changed, 65 insertions, 27 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 7e4a8e8..da3d3c2 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -444,12 +444,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
444 /// <description>desired region X coordinate (integer)</description></item> 444 /// <description>desired region X coordinate (integer)</description></item>
445 /// <item><term>region_y</term> 445 /// <item><term>region_y</term>
446 /// <description>desired region Y coordinate (integer)</description></item> 446 /// <description>desired region Y coordinate (integer)</description></item>
447 /// <item><term>region_master_first</term> 447 /// <item><term>estate_owner_first</term>
448 /// <description>firstname of region master</description></item> 448 /// <description>firstname of estate owner (formerly region master)
449 /// <item><term>region_master_last</term> 449 /// (required if new estate is being created, optional otherwise)</description></item>
450 /// <description>lastname of region master</description></item> 450 /// <item><term>estate_owner_last</term>
451 /// <item><term>region_master_uuid</term> 451 /// <description>lastname of estate owner (formerly region master)
452 /// <description>explicit UUID to use for master avatar (optional)</description></item> 452 /// (required if new estate is being created, optional otherwise)</description></item>
453 /// <item><term>estate_owner_uuid</term>
454 /// <description>explicit UUID to use for estate owner (optional)</description></item>
453 /// <item><term>listen_ip</term> 455 /// <item><term>listen_ip</term>
454 /// <description>internal IP address (dotted quad)</description></item> 456 /// <description>internal IP address (dotted quad)</description></item>
455 /// <item><term>listen_port</term> 457 /// <item><term>listen_port</term>
@@ -465,6 +467,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
465 /// <item><term>enable_voice</term> 467 /// <item><term>enable_voice</term>
466 /// <description>if true, enable voice on all parcels, 468 /// <description>if true, enable voice on all parcels,
467 /// ('true' or 'false') (optional, default: false)</description></item> 469 /// ('true' or 'false') (optional, default: false)</description></item>
470 /// <item><term>estate_name</term>
471 /// <description>the name of the estate to join (or to create if it doesn't
472 /// already exist)</description></item>
468 /// </list> 473 /// </list>
469 /// 474 ///
470 /// XmlRpcCreateRegionMethod returns 475 /// XmlRpcCreateRegionMethod returns
@@ -503,9 +508,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
503 { 508 {
504 "password", 509 "password",
505 "region_name", 510 "region_name",
506 "region_master_first", "region_master_last", 511 "listen_ip", "external_address",
507 "region_master_password", 512 "estate_name"
508 "listen_ip", "external_address"
509 }); 513 });
510 CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); 514 CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"});
511 515
@@ -576,18 +580,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
576 580
577 region.ExternalHostName = (string) requestData["external_address"]; 581 region.ExternalHostName = (string) requestData["external_address"];
578 582
579 string masterFirst = (string) requestData["region_master_first"];
580 string masterLast = (string) requestData["region_master_last"];
581 string masterPassword = (string) requestData["region_master_password"];
582
583 UUID userID = UUID.Zero;
584 if (requestData.ContainsKey("region_master_uuid"))
585 {
586 // ok, client wants us to use an explicit UUID
587 // regardless of what the avatar name provided
588 userID = new UUID((string) requestData["estate_owner_uuid"]);
589 }
590
591 bool persist = Convert.ToBoolean((string) requestData["persist"]); 583 bool persist = Convert.ToBoolean((string) requestData["persist"]);
592 if (persist) 584 if (persist)
593 { 585 {
@@ -622,7 +614,55 @@ namespace OpenSim.ApplicationPlugins.RemoteController
622 { 614 {
623 region.Persistent = false; 615 region.Persistent = false;
624 } 616 }
625 617
618 // Set the estate
619
620 // Check for an existing estate
621 List<int> estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]);
622 if (estateIDs.Count < 1)
623 {
624 UUID userID = UUID.Zero;
625 if (requestData.ContainsKey("estate_owner_uuid"))
626 {
627 // ok, client wants us to use an explicit UUID
628 // regardless of what the avatar name provided
629 userID = new UUID((string) requestData["estate_owner_uuid"]);
630 }
631 else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last"))
632 {
633 // We need to look up the UUID for the avatar with the provided name.
634 string ownerFirst = (string) requestData["estate_owner_first"];
635 string ownerLast = (string) requestData["estate_owner_last"];
636
637 Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
638 IUserAccountService accountService = currentOrFirst.UserAccountService;
639 UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID,
640 ownerFirst, ownerLast);
641 userID = user.PrincipalID;
642 }
643 else
644 {
645 throw new Exception("Estate owner details not provided.");
646 }
647
648 // Create a new estate with the name provided
649 region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true);
650
651 region.EstateSettings.EstateName = (string) requestData["estate_name"];
652 region.EstateSettings.EstateOwner = userID;
653 // Persistence does not seem to effect the need to save a new estate
654 region.EstateSettings.Save();
655 }
656 else
657 {
658 int estateID = estateIDs[0];
659
660 region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID);
661
662 if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID))
663 throw new Exception("Failed to join estate.");
664 }
665
626 // Create the region and perform any initial initialization 666 // Create the region and perform any initial initialization
627 667
628 IScene newScene; 668 IScene newScene;
@@ -631,9 +671,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
631 // If an access specification was provided, use it. 671 // If an access specification was provided, use it.
632 // Otherwise accept the default. 672 // Otherwise accept the default.
633 newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess); 673 newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess);
634 newScene.RegionInfo.EstateSettings.EstateOwner = userID; 674 newScene.RegionInfo.EstateSettings.Save();
635 if (persist)
636 newScene.RegionInfo.EstateSettings.Save();
637 675
638 // enable voice on newly created region if 676 // enable voice on newly created region if
639 // requested by either the XmlRpc request or the 677 // requested by either the XmlRpc request or the
@@ -1497,7 +1535,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1497 if (destinationFolder.Type != (short)AssetType.Clothing) 1535 if (destinationFolder.Type != (short)AssetType.Clothing)
1498 { 1536 {
1499 destinationFolder = new InventoryFolderBase(); 1537 destinationFolder = new InventoryFolderBase();
1500 1538
1501 destinationFolder.ID = UUID.Random(); 1539 destinationFolder.ID = UUID.Random();
1502 destinationFolder.Name = "Clothing"; 1540 destinationFolder.Name = "Clothing";
1503 destinationFolder.Owner = destination; 1541 destinationFolder.Owner = destination;
@@ -2982,7 +3020,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2982 /// <param name="password"></param> 3020 /// <param name="password"></param>
2983 private bool ChangeUserPassword(string firstName, string lastName, string password) 3021 private bool ChangeUserPassword(string firstName, string lastName, string password)
2984 { 3022 {
2985 Scene scene = m_application.SceneManager.CurrentOrFirstScene; 3023 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
2986 IUserAccountService userAccountService = scene.UserAccountService; 3024 IUserAccountService userAccountService = scene.UserAccountService;
2987 IAuthenticationService authenticationService = scene.AuthenticationService; 3025 IAuthenticationService authenticationService = scene.AuthenticationService;
2988 3026