diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index fa76078..770abe7 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
67 | m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); | 67 | m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); |
68 | m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); | 68 | m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); |
69 | m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod); | 69 | m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod); |
70 | m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod); | ||
70 | } | 71 | } |
71 | } | 72 | } |
72 | catch (NullReferenceException) | 73 | catch (NullReferenceException) |
@@ -281,9 +282,60 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
281 | return response; | 282 | return response; |
282 | } | 283 | } |
283 | 284 | ||
284 | public void Close() | 285 | public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request) |
285 | { | 286 | { |
287 | MainLog.Instance.Verbose("RADMIN", "Received Create User Administrator Request"); | ||
288 | XmlRpcResponse response = new XmlRpcResponse(); | ||
289 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
290 | Hashtable responseData = new Hashtable(); | ||
291 | if (requiredPassword != System.String.Empty && | ||
292 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | ||
293 | { | ||
294 | responseData["created"] = "false"; | ||
295 | response.Value = responseData; | ||
296 | } | ||
297 | else | ||
298 | { | ||
299 | try | ||
300 | { | ||
301 | string tempfirstname = (string) requestData["user_firstname"]; | ||
302 | string templastname = (string) requestData["user_lastname"]; | ||
303 | string tempPasswd = (string) requestData["user_password"]; | ||
304 | uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | ||
305 | uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | ||
306 | |||
307 | LLUUID tempuserID = m_app.CreateUser(tempfirstname, templastname, tempPasswd, regX, regY); | ||
308 | |||
309 | if (tempuserID == LLUUID.Zero) | ||
310 | { | ||
311 | responseData["created"] = "false"; | ||
312 | responseData["error"] = "Error creating user"; | ||
313 | responseData["avatar_uuid"] = LLUUID.Zero; | ||
314 | response.Value = responseData; | ||
315 | MainLog.Instance.Error("RADMIN", "Error creating user (" + tempfirstname + " " + templastname + ") :"); | ||
316 | } | ||
317 | else | ||
318 | { | ||
319 | responseData["created"] = "true"; | ||
320 | responseData["avatar_uuid"] = tempuserID; | ||
321 | response.Value = responseData; | ||
322 | MainLog.Instance.Verbose("RADMIN", "User " + tempfirstname + " " + templastname + " created. Userid " + tempuserID + " assigned."); | ||
323 | } | ||
324 | } | ||
325 | catch (Exception e) | ||
326 | { | ||
327 | responseData["created"] = "false"; | ||
328 | responseData["error"] = e.ToString(); | ||
329 | responseData["avatar_uuid"] = LLUUID.Zero; | ||
330 | response.Value = responseData; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | return response; | ||
286 | } | 335 | } |
287 | 336 | ||
337 | public void Close() | ||
338 | { | ||
339 | } | ||
288 | } | 340 | } |
289 | } \ No newline at end of file | 341 | } |