Updated the create_region command in the RemoteAdmin plugin to properly support estates without seeking further input on the console.

This commit is contained in:
randomhuman
2010-08-13 16:08:43 +01:00
committed by Justin Clark-Casey (justincc)
parent 8acb401a14
commit 8eeb3f2fd2
6 changed files with 133 additions and 67 deletions

View File

@@ -444,12 +444,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// <description>desired region X coordinate (integer)</description></item>
/// <item><term>region_y</term>
/// <description>desired region Y coordinate (integer)</description></item>
/// <item><term>region_master_first</term>
/// <description>firstname of region master</description></item>
/// <item><term>region_master_last</term>
/// <description>lastname of region master</description></item>
/// <item><term>region_master_uuid</term>
/// <description>explicit UUID to use for master avatar (optional)</description></item>
/// <item><term>estate_owner_first</term>
/// <description>firstname of estate owner (formerly region master)
/// (required if new estate is being created, optional otherwise)</description></item>
/// <item><term>estate_owner_last</term>
/// <description>lastname of estate owner (formerly region master)
/// (required if new estate is being created, optional otherwise)</description></item>
/// <item><term>estate_owner_uuid</term>
/// <description>explicit UUID to use for estate owner (optional)</description></item>
/// <item><term>listen_ip</term>
/// <description>internal IP address (dotted quad)</description></item>
/// <item><term>listen_port</term>
@@ -465,6 +467,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// <item><term>enable_voice</term>
/// <description>if true, enable voice on all parcels,
/// ('true' or 'false') (optional, default: false)</description></item>
/// <item><term>estate_name</term>
/// <description>the name of the estate to join (or to create if it doesn't
/// already exist)</description></item>
/// </list>
///
/// 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<int> 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
/// <param name="password"></param>
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;