From 8eeb3f2fd21c05f0bfd141e333f34c4c69e8865b Mon Sep 17 00:00:00 2001
From: randomhuman
Date: Fri, 13 Aug 2010 16:08:43 +0100
Subject: Updated the create_region command in the RemoteAdmin plugin to
properly support estates without seeking further input on the console.
---
.../RemoteController/RemoteAdminPlugin.cs | 92 +++++++++++++++-------
1 file changed, 65 insertions(+), 27 deletions(-)
(limited to 'OpenSim/ApplicationPlugins/RemoteController')
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
/// desired region X coordinate (integer)
/// - region_y
/// desired region Y coordinate (integer)
- /// - region_master_first
- /// firstname of region master
- /// - region_master_last
- /// lastname of region master
- /// - region_master_uuid
- /// explicit UUID to use for master avatar (optional)
+ /// - estate_owner_first
+ /// firstname of estate owner (formerly region master)
+ /// (required if new estate is being created, optional otherwise)
+ /// - estate_owner_last
+ /// lastname of estate owner (formerly region master)
+ /// (required if new estate is being created, optional otherwise)
+ /// - estate_owner_uuid
+ /// explicit UUID to use for estate owner (optional)
/// - listen_ip
/// internal IP address (dotted quad)
/// - listen_port
@@ -465,6 +467,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
///
- enable_voice
/// if true, enable voice on all parcels,
/// ('true' or 'false') (optional, default: false)
+ /// - estate_name
+ /// the name of the estate to join (or to create if it doesn't
+ /// already exist)
///
///
/// XmlRpcCreateRegionMethod returns
@@ -503,9 +508,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
"password",
"region_name",
- "region_master_first", "region_master_last",
- "region_master_password",
- "listen_ip", "external_address"
+ "listen_ip", "external_address",
+ "estate_name"
});
CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"});
@@ -576,18 +580,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
region.ExternalHostName = (string) requestData["external_address"];
- string masterFirst = (string) requestData["region_master_first"];
- string masterLast = (string) requestData["region_master_last"];
- string masterPassword = (string) requestData["region_master_password"];
-
- UUID userID = UUID.Zero;
- if (requestData.ContainsKey("region_master_uuid"))
- {
- // ok, client wants us to use an explicit UUID
- // regardless of what the avatar name provided
- userID = new UUID((string) requestData["estate_owner_uuid"]);
- }
-
bool persist = Convert.ToBoolean((string) requestData["persist"]);
if (persist)
{
@@ -622,7 +614,55 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
region.Persistent = false;
}
-
+
+ // Set the estate
+
+ // Check for an existing estate
+ List estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]);
+ if (estateIDs.Count < 1)
+ {
+ UUID userID = UUID.Zero;
+ if (requestData.ContainsKey("estate_owner_uuid"))
+ {
+ // ok, client wants us to use an explicit UUID
+ // regardless of what the avatar name provided
+ userID = new UUID((string) requestData["estate_owner_uuid"]);
+ }
+ else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last"))
+ {
+ // We need to look up the UUID for the avatar with the provided name.
+ string ownerFirst = (string) requestData["estate_owner_first"];
+ string ownerLast = (string) requestData["estate_owner_last"];
+
+ Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
+ IUserAccountService accountService = currentOrFirst.UserAccountService;
+ UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID,
+ ownerFirst, ownerLast);
+ userID = user.PrincipalID;
+ }
+ else
+ {
+ throw new Exception("Estate owner details not provided.");
+ }
+
+ // Create a new estate with the name provided
+ region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true);
+
+ region.EstateSettings.EstateName = (string) requestData["estate_name"];
+ region.EstateSettings.EstateOwner = userID;
+ // Persistence does not seem to effect the need to save a new estate
+ region.EstateSettings.Save();
+ }
+ else
+ {
+ int estateID = estateIDs[0];
+
+ region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID);
+
+ if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID))
+ throw new Exception("Failed to join estate.");
+ }
+
// Create the region and perform any initial initialization
IScene newScene;
@@ -631,9 +671,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// If an access specification was provided, use it.
// Otherwise accept the default.
newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess);
- newScene.RegionInfo.EstateSettings.EstateOwner = userID;
- if (persist)
- newScene.RegionInfo.EstateSettings.Save();
+ newScene.RegionInfo.EstateSettings.Save();
// enable voice on newly created region if
// requested by either the XmlRpc request or the
@@ -1497,7 +1535,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (destinationFolder.Type != (short)AssetType.Clothing)
{
destinationFolder = new InventoryFolderBase();
-
+
destinationFolder.ID = UUID.Random();
destinationFolder.Name = "Clothing";
destinationFolder.Owner = destination;
@@ -2982,7 +3020,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
///
private bool ChangeUserPassword(string firstName, string lastName, string password)
{
- Scene scene = m_application.SceneManager.CurrentOrFirstScene;
+ Scene scene = m_application.SceneManager.CurrentOrFirstScene;
IUserAccountService userAccountService = scene.UserAccountService;
IAuthenticationService authenticationService = scene.AuthenticationService;
--
cgit v1.1