*Master Avatar can be specified by a previous UUID in either grid mode or standalone mode by specifying a master_avatar_uuid attribute in the place of master_avatar_xxxx_name and master_avatar_password.You will not be asked for the name and password if a valid UUID is specified.

afrisby
mingchen 2007-11-03 17:49:45 +00:00
parent 5b4e4cb3ac
commit b51a900beb
9 changed files with 98 additions and 20 deletions

View File

@ -376,5 +376,6 @@ namespace OpenSim.Framework.UserManagement
public abstract UserProfileData SetupMasterUser(string firstName, string lastName); public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
public abstract UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid);
} }
} }

View File

@ -92,6 +92,21 @@ namespace OpenSim.Framework
{ {
configurationPluginFilename = dll_filename; configurationPluginFilename = dll_filename;
} }
private void checkAndAddConfigOption(ConfigurationOption option)
{
if ((option.configurationKey != "" && option.configurationQuestion != "") || (option.configurationKey != "" && option.configurationUseDefaultNoPrompt))
{
if (!configurationOptions.Contains(option))
{
configurationOptions.Add(option);
}
}
else
{
MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + option.configurationKey + ")");
}
}
public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt)
{ {
ConfigurationOption configOption = new ConfigurationOption(); ConfigurationOption configOption = new ConfigurationOption();
@ -100,18 +115,20 @@ namespace OpenSim.Framework
configOption.configurationDefault = configuration_default; configOption.configurationDefault = configuration_default;
configOption.configurationType = configuration_type; configOption.configurationType = configuration_type;
configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
configOption.shouldIBeAsked = null; //Assumes true, I can ask whenever
checkAndAddConfigOption(configOption);
}
if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt)) public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt, ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate)
{ {
if (!configurationOptions.Contains(configOption)) ConfigurationOption configOption = new ConfigurationOption();
{ configOption.configurationKey = configuration_key;
configurationOptions.Add(configOption); configOption.configurationQuestion = configuration_question;
} configOption.configurationDefault = configuration_default;
} configOption.configurationType = configuration_type;
else configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
{ configOption.shouldIBeAsked = shouldIBeAskedDelegate;
MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); checkAndAddConfigOption(configOption);
}
} }
public void performConfigurationRetrieve() public void performConfigurationRetrieve()
@ -195,15 +212,23 @@ namespace OpenSim.Framework
} }
else else
{ {
if ((configOption.shouldIBeAsked != null && configOption.shouldIBeAsked(configOption.configurationKey)) || configOption.shouldIBeAsked == null)
if (configurationDescription.Trim() != "")
{ {
console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); if (configurationDescription.Trim() != "")
{
console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault);
}
else
{
console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault);
}
} }
else else
{ {
console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); //Dont Ask! Just use default
console_result = configOption.configurationDefault;
} }
} }
} }
else else

View File

@ -30,6 +30,9 @@ namespace OpenSim.Framework
{ {
public class ConfigurationOption public class ConfigurationOption
{ {
public delegate bool ConfigurationOptionShouldBeAsked(string configuration_key);
public enum ConfigurationTypes public enum ConfigurationTypes
{ {
TYPE_STRING, TYPE_STRING,
@ -56,5 +59,6 @@ namespace OpenSim.Framework
public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING;
public bool configurationUseDefaultNoPrompt = false; public bool configurationUseDefaultNoPrompt = false;
public ConfigurationOptionShouldBeAsked shouldIBeAsked; //Should I be asked now? Based on previous answers
} }
} }

View File

@ -38,6 +38,7 @@ namespace OpenSim.Framework.Interfaces
UserProfileData SetupMasterUser(string firstName, string lastName); UserProfileData SetupMasterUser(string firstName, string lastName);
UserProfileData SetupMasterUser(string firstName, string lastName, string password); UserProfileData SetupMasterUser(string firstName, string lastName, string password);
UserProfileData SetupMasterUser(LLUUID userId);
/// <summary> /// <summary>
/// ///

View File

@ -293,9 +293,19 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false);
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false);
configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false);
configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false); configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Master Avatar UUID", LLUUID.Zero.ToString(), true);
configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false); configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false,(ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked);
configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false); configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked);
configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked);
}
public bool shouldMasterAvatarDetailsBeAsked(string configuration_key)
{
if (MasterAvatarAssignedUUID == null || MasterAvatarAssignedUUID.ToStringHyphenated() == LLUUID.Zero.ToStringHyphenated())
{
return true;
}
return false;
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -334,6 +344,9 @@ namespace OpenSim.Framework
this.m_externalHostName = Util.GetLocalHost().ToString(); this.m_externalHostName = Util.GetLocalHost().ToString();
} }
break; break;
case "master_avatar_uuid":
this.MasterAvatarAssignedUUID = (LLUUID)configuration_result;
break;
case "master_avatar_first": case "master_avatar_first":
this.MasterAvatarFirstName = (string)configuration_result; this.MasterAvatarFirstName = (string)configuration_result;
break; break;

View File

@ -168,5 +168,10 @@ namespace OpenSim.Grid.UserServer
{ {
throw new Exception("The method or operation is not implemented."); throw new Exception("The method or operation is not implemented.");
} }
public override UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid)
{
throw new Exception("The method or operation is not implemented.");
}
} }
} }

View File

@ -113,10 +113,19 @@ namespace OpenSim.Region.ClientStack
scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D());
//Master Avatar Setup //Master Avatar Setup
UserProfileData masterAvatar = UserProfileData masterAvatar;
m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, if (scene.RegionInfo.MasterAvatarAssignedUUID != LLUUID.Zero)
{
masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID);
}
else
{
masterAvatar =
m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName,
scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarLastName,
scene.RegionInfo.MasterAvatarSandboxPassword); scene.RegionInfo.MasterAvatarSandboxPassword);
}
if (masterAvatar != null) if (masterAvatar != null)
{ {
m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]");

View File

@ -81,5 +81,15 @@ namespace OpenSim.Region.Communications.Local
return profile; return profile;
} }
public override UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid)
{
UserProfileData data = GetUserProfile(uuid);
if (data == null)
{
throw new Exception("Unknown master user UUID");
}
return data;
}
} }
} }

View File

@ -145,6 +145,16 @@ namespace OpenSim.Region.Communications.OGS1
return profile; return profile;
} }
public UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid)
{
UserProfileData data = GetUserProfile(uuid);
if (data == null)
{
throw new Exception("Unknown master user UUID");
}
return data;
}
public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
{ {
throw new Exception("The method or operation is not implemented."); throw new Exception("The method or operation is not implemented.");