diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 93a6915..e20b487 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -709,6 +709,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
709 | // ok, client wants us to use an explicit UUID | 709 | // ok, client wants us to use an explicit UUID |
710 | // regardless of what the avatar name provided | 710 | // regardless of what the avatar name provided |
711 | userID = new UUID((string) requestData["estate_owner_uuid"]); | 711 | userID = new UUID((string) requestData["estate_owner_uuid"]); |
712 | |||
713 | // Check that the specified user exists | ||
714 | Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene; | ||
715 | IUserAccountService accountService = currentOrFirst.UserAccountService; | ||
716 | UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, userID); | ||
717 | |||
718 | if (user == null) | ||
719 | throw new Exception("Specified user was not found."); | ||
712 | } | 720 | } |
713 | else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last")) | 721 | else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last")) |
714 | { | 722 | { |
@@ -720,6 +728,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
720 | IUserAccountService accountService = currentOrFirst.UserAccountService; | 728 | IUserAccountService accountService = currentOrFirst.UserAccountService; |
721 | UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, | 729 | UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, |
722 | ownerFirst, ownerLast); | 730 | ownerFirst, ownerLast); |
731 | |||
732 | // Check that the specified user exists | ||
733 | if (user == null) | ||
734 | throw new Exception("Specified user was not found."); | ||
735 | |||
723 | userID = user.PrincipalID; | 736 | userID = user.PrincipalID; |
724 | } | 737 | } |
725 | else | 738 | else |
@@ -728,21 +741,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
728 | } | 741 | } |
729 | 742 | ||
730 | // Create a new estate with the name provided | 743 | // Create a new estate with the name provided |
731 | region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true); | 744 | region.EstateSettings = m_application.EstateDataService.CreateNewEstate(); |
732 | 745 | ||
733 | region.EstateSettings.EstateName = (string) requestData["estate_name"]; | 746 | region.EstateSettings.EstateName = (string) requestData["estate_name"]; |
734 | region.EstateSettings.EstateOwner = userID; | 747 | region.EstateSettings.EstateOwner = userID; |
735 | // Persistence does not seem to effect the need to save a new estate | 748 | // Persistence does not seem to effect the need to save a new estate |
736 | region.EstateSettings.Save(); | 749 | region.EstateSettings.Save(); |
750 | |||
751 | if (!m_application.EstateDataService.LinkRegion(region.RegionID, (int) region.EstateSettings.EstateID)) | ||
752 | throw new Exception("Failed to join estate."); | ||
737 | } | 753 | } |
738 | else | 754 | else |
739 | { | 755 | { |
740 | int estateID = estateIDs[0]; | 756 | int estateID = estateIDs[0]; |
741 | 757 | ||
742 | region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID); | 758 | region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, false); |
743 | 759 | ||
744 | if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID)) | 760 | if (region.EstateSettings.EstateID != estateID) |
745 | throw new Exception("Failed to join estate."); | 761 | { |
762 | // The region is already part of an estate, but not the one we want. | ||
763 | region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID); | ||
764 | |||
765 | if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID)) | ||
766 | throw new Exception("Failed to join estate."); | ||
767 | } | ||
746 | } | 768 | } |
747 | 769 | ||
748 | // Create the region and perform any initial initialization | 770 | // Create the region and perform any initial initialization |