* refactor: move create user console command parsing down to OpenSim.cs from CommunicationsManager
parent
9f600b378d
commit
e595959d97
|
@ -31,7 +31,6 @@ using System.Reflection;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications
|
namespace OpenSim.Framework.Communications
|
||||||
|
@ -231,50 +230,6 @@ namespace OpenSim.Framework.Communications
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void doCreate(string[] cmmdParams)
|
|
||||||
{
|
|
||||||
switch (cmmdParams[0])
|
|
||||||
{
|
|
||||||
case "user":
|
|
||||||
string firstName;
|
|
||||||
string lastName;
|
|
||||||
string password;
|
|
||||||
uint regX = 1000;
|
|
||||||
uint regY = 1000;
|
|
||||||
|
|
||||||
if (cmmdParams.Length < 2)
|
|
||||||
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
|
||||||
else firstName = cmmdParams[1];
|
|
||||||
|
|
||||||
if ( cmmdParams.Length < 3 )
|
|
||||||
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
|
||||||
else lastName = cmmdParams[2];
|
|
||||||
|
|
||||||
if ( cmmdParams.Length < 4 )
|
|
||||||
password = MainConsole.Instance.PasswdPrompt("Password");
|
|
||||||
else password = cmmdParams[3];
|
|
||||||
|
|
||||||
if ( cmmdParams.Length < 5 )
|
|
||||||
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
|
|
||||||
else regX = Convert.ToUInt32(cmmdParams[4]);
|
|
||||||
|
|
||||||
if ( cmmdParams.Length < 6 )
|
|
||||||
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
|
||||||
else regY = Convert.ToUInt32(cmmdParams[5]);
|
|
||||||
|
|
||||||
|
|
||||||
if (null == m_userService.GetUserProfile(firstName, lastName))
|
|
||||||
{
|
|
||||||
AddUser(firstName, lastName, password, regX, regY);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Persistently adds a user to OpenSim.
|
/// Persistently adds a user to OpenSim.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -283,7 +238,7 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
/// <param name="regX"></param>
|
/// <param name="regX"></param>
|
||||||
/// <param name="regY"></param>
|
/// <param name="regY"></param>
|
||||||
/// <returns>The UUID of the added user. Returns null if the add was unsuccessful</returns>
|
/// <returns>The UUID of the added user. Returns LLUUID.Zero if the add was unsuccessful</returns>
|
||||||
public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY)
|
public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY)
|
||||||
{
|
{
|
||||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||||
|
|
|
@ -208,7 +208,6 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs commands issued by the server console from the operator
|
/// Runs commands issued by the server console from the operator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -348,9 +347,7 @@ namespace OpenSim
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "create":
|
case "create":
|
||||||
if (m_sandbox)
|
Create(cmdparams);
|
||||||
CreateAccount(cmdparams);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "create-region":
|
case "create-region":
|
||||||
|
@ -524,6 +521,23 @@ namespace OpenSim
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Execute switch for some of the create commands
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
protected void Create(string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (args[0])
|
||||||
|
{
|
||||||
|
case "user":
|
||||||
|
CreateUser(args);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turn on some debugging values for OpenSim.
|
/// Turn on some debugging values for OpenSim.
|
||||||
|
@ -653,6 +667,48 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cmdparams"></param>
|
||||||
|
protected void CreateUser(string[] cmdparams)
|
||||||
|
{
|
||||||
|
string firstName;
|
||||||
|
string lastName;
|
||||||
|
string password;
|
||||||
|
uint regX = 1000;
|
||||||
|
uint regY = 1000;
|
||||||
|
|
||||||
|
if (cmdparams.Length < 2)
|
||||||
|
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
||||||
|
else firstName = cmdparams[1];
|
||||||
|
|
||||||
|
if ( cmdparams.Length < 3 )
|
||||||
|
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
||||||
|
else lastName = cmdparams[2];
|
||||||
|
|
||||||
|
if ( cmdparams.Length < 4 )
|
||||||
|
password = MainConsole.Instance.PasswdPrompt("Password");
|
||||||
|
else password = cmdparams[3];
|
||||||
|
|
||||||
|
if ( cmdparams.Length < 5 )
|
||||||
|
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
|
||||||
|
else regX = Convert.ToUInt32(cmdparams[4]);
|
||||||
|
|
||||||
|
if ( cmdparams.Length < 6 )
|
||||||
|
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
||||||
|
else regY = Convert.ToUInt32(cmdparams[5]);
|
||||||
|
|
||||||
|
if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName))
|
||||||
|
{
|
||||||
|
m_commsManager.AddUser(firstName, lastName, password, regX, regY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void SaveXml(string[] cmdparams)
|
protected void SaveXml(string[] cmdparams)
|
||||||
{
|
{
|
||||||
m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
|
m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
|
||||||
|
@ -773,6 +829,13 @@ namespace OpenSim
|
||||||
protected void SaveInv(string[] cmdparams)
|
protected void SaveInv(string[] cmdparams)
|
||||||
{
|
{
|
||||||
m_log.Error("[CONSOLE]: This has not been implemented yet!");
|
m_log.Error("[CONSOLE]: This has not been implemented yet!");
|
||||||
|
|
||||||
|
// CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails();
|
||||||
|
// if (userInfo == null)
|
||||||
|
// {
|
||||||
|
// m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString());
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string CombineParams(string[] commandParams, int pos)
|
private static string CombineParams(string[] commandParams, int pos)
|
||||||
|
|
|
@ -393,8 +393,6 @@ namespace OpenSim
|
||||||
m_gridInfoService = new GridInfoService();
|
m_gridInfoService = new GridInfoService();
|
||||||
m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
|
m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
|
||||||
m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
|
m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
|
||||||
|
|
||||||
CreateAccount = localComms.doCreate;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue