* Patch from Ansi (IBM)

* Allows the creation of a user via the RemoteAdminPlugin.
* Many thanks!
ThreadPoolClientBranch
Justin Clarke Casey 2008-01-29 14:43:45 +00:00
parent 832243c6e8
commit 55dc0dc267
2 changed files with 59 additions and 2 deletions

View File

@ -67,6 +67,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod);
m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod);
m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod);
}
}
catch (NullReferenceException)
@ -281,9 +282,60 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
return response;
}
public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request)
{
MainLog.Instance.Verbose("RADMIN", "Received Create User Administrator Request");
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable();
if (requiredPassword != System.String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
{
responseData["created"] = "false";
response.Value = responseData;
}
else
{
try
{
string tempfirstname = (string) requestData["user_firstname"];
string templastname = (string) requestData["user_lastname"];
string tempPasswd = (string) requestData["user_password"];
uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
LLUUID tempuserID = m_app.CreateUser(tempfirstname, templastname, tempPasswd, regX, regY);
if (tempuserID == LLUUID.Zero)
{
responseData["created"] = "false";
responseData["error"] = "Error creating user";
responseData["avatar_uuid"] = LLUUID.Zero;
response.Value = responseData;
MainLog.Instance.Error("RADMIN", "Error creating user (" + tempfirstname + " " + templastname + ") :");
}
else
{
responseData["created"] = "true";
responseData["avatar_uuid"] = tempuserID;
response.Value = responseData;
MainLog.Instance.Verbose("RADMIN", "User " + tempfirstname + " " + templastname + " created. Userid " + tempuserID + " assigned.");
}
}
catch (Exception e)
{
responseData["created"] = "false";
responseData["error"] = e.ToString();
responseData["avatar_uuid"] = LLUUID.Zero;
response.Value = responseData;
}
}
return response;
}
public void Close()
{
}
}
}

View File

@ -436,6 +436,10 @@ namespace OpenSim
m_sceneManager.OnRestartSim += handleRestartRegion;
}
public LLUUID CreateUser(string tempfirstname, string templastname, string tempPasswd, uint regX, uint regY)
{
return m_commsManager.AddUser(tempfirstname,templastname,tempPasswd,regX,regY);
}
public UDPServer CreateRegion(RegionInfo regionInfo)
{
@ -678,6 +682,7 @@ namespace OpenSim
m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
m_log.Error(" alert general [Message] - send an alert to all users.");
m_log.Error("backup - trigger a simulator backup");
m_log.Error("create user - adds a new user");
m_log.Error("change-region [name] - sets the region that many of these commands affect.");
m_log.Error("command-script [filename] - Execute command in a file.");
m_log.Error("debug - debugging commands");