From b51a900bebe914650c1c7db7b77f74c5ac107f6d Mon Sep 17 00:00:00 2001 From: mingchen Date: Sat, 3 Nov 2007 17:49:45 +0000 Subject: *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. --- .../Framework/Communications/UserManagerBase.cs | 1 + OpenSim/Framework/ConfigurationMember.cs | 55 ++++++++++++++++------ OpenSim/Framework/ConfigurationOption.cs | 4 ++ OpenSim/Framework/IUserService.cs | 1 + OpenSim/Framework/RegionInfo.cs | 19 ++++++-- OpenSim/Grid/UserServer/UserManager.cs | 5 ++ .../Region/ClientStack/RegionApplicationBase.cs | 13 ++++- .../Communications/Local/LocalUserServices.cs | 10 ++++ .../Region/Communications/OGS1/OGS1UserServices.cs | 10 ++++ 9 files changed, 98 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index cdc3baf..408f37c 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -376,5 +376,6 @@ namespace OpenSim.Framework.UserManagement public abstract UserProfileData SetupMasterUser(string firstName, string lastName); public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); + public abstract UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid); } } \ No newline at end of file diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index 19275b3..e4cd9d8 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs @@ -92,6 +92,21 @@ namespace OpenSim.Framework { 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) { ConfigurationOption configOption = new ConfigurationOption(); @@ -100,18 +115,20 @@ namespace OpenSim.Framework configOption.configurationDefault = configuration_default; configOption.configurationType = configuration_type; 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)) - { - if (!configurationOptions.Contains(configOption)) - { - configurationOptions.Add(configOption); - } - } - else - { - MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); - } + public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt, ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate) + { + ConfigurationOption configOption = new ConfigurationOption(); + configOption.configurationKey = configuration_key; + configOption.configurationQuestion = configuration_question; + configOption.configurationDefault = configuration_default; + configOption.configurationType = configuration_type; + configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; + configOption.shouldIBeAsked = shouldIBeAskedDelegate; + checkAndAddConfigOption(configOption); } public void performConfigurationRetrieve() @@ -195,15 +212,23 @@ namespace OpenSim.Framework } else { - - if (configurationDescription.Trim() != "") + if ((configOption.shouldIBeAsked != null && configOption.shouldIBeAsked(configOption.configurationKey)) || configOption.shouldIBeAsked == null) { - 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 { - console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); + //Dont Ask! Just use default + console_result = configOption.configurationDefault; } + } } else diff --git a/OpenSim/Framework/ConfigurationOption.cs b/OpenSim/Framework/ConfigurationOption.cs index ec39d3d..b83be5e 100644 --- a/OpenSim/Framework/ConfigurationOption.cs +++ b/OpenSim/Framework/ConfigurationOption.cs @@ -30,6 +30,9 @@ namespace OpenSim.Framework { public class ConfigurationOption { + + public delegate bool ConfigurationOptionShouldBeAsked(string configuration_key); + public enum ConfigurationTypes { TYPE_STRING, @@ -56,5 +59,6 @@ namespace OpenSim.Framework public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; public bool configurationUseDefaultNoPrompt = false; + public ConfigurationOptionShouldBeAsked shouldIBeAsked; //Should I be asked now? Based on previous answers } } \ No newline at end of file diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs index ed9032b..6465a48 100644 --- a/OpenSim/Framework/IUserService.cs +++ b/OpenSim/Framework/IUserService.cs @@ -38,6 +38,7 @@ namespace OpenSim.Framework.Interfaces UserProfileData SetupMasterUser(string firstName, string lastName); UserProfileData SetupMasterUser(string firstName, string lastName, string password); + UserProfileData SetupMasterUser(LLUUID userId); /// /// diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index a32b43c..2a75dbc 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -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_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("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false); - configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false); - configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false); + configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Master Avatar UUID", LLUUID.Zero.ToString(), true); + 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_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) @@ -334,6 +344,9 @@ namespace OpenSim.Framework this.m_externalHostName = Util.GetLocalHost().ToString(); } break; + case "master_avatar_uuid": + this.MasterAvatarAssignedUUID = (LLUUID)configuration_result; + break; case "master_avatar_first": this.MasterAvatarFirstName = (string)configuration_result; break; diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 96cdfb3..58e9677 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs @@ -168,5 +168,10 @@ namespace OpenSim.Grid.UserServer { 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."); + } } } \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 7551bff..6071dcd 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -113,10 +113,19 @@ namespace OpenSim.Region.ClientStack scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); //Master Avatar Setup - UserProfileData masterAvatar = - m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, + UserProfileData masterAvatar; + 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.MasterAvatarSandboxPassword); + } + if (masterAvatar != null) { m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index a7687c7..d8c4b1d 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -81,5 +81,15 @@ namespace OpenSim.Region.Communications.Local 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; + } } } \ No newline at end of file diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index d00a813..990998e 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -145,6 +145,16 @@ namespace OpenSim.Region.Communications.OGS1 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) { throw new Exception("The method or operation is not implemented."); -- cgit v1.1