aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/UserServer')
-rw-r--r--OpenSim/Grid/UserServer/Main.cs94
1 files changed, 70 insertions, 24 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index be26ab3..0b0bee1 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Grid.UserServer
46 /// <summary> 46 /// <summary>
47 /// Grid user server main class 47 /// Grid user server main class
48 /// </summary> 48 /// </summary>
49 public class OpenUser_Main : BaseOpenSimServer, conscmd_callback 49 public class OpenUser_Main : BaseOpenSimServer
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
@@ -73,7 +73,7 @@ namespace OpenSim.Grid.UserServer
73 73
74 public OpenUser_Main() 74 public OpenUser_Main()
75 { 75 {
76 m_console = new ConsoleBase("User", this); 76 m_console = new ConsoleBase("User");
77 MainConsole.Instance = m_console; 77 MainConsole.Instance = m_console;
78 } 78 }
79 79
@@ -119,6 +119,37 @@ namespace OpenSim.Grid.UserServer
119 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 119 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
120 AddHttpHandlers(); 120 AddHttpHandlers();
121 m_httpServer.Start(); 121 m_httpServer.Start();
122
123 base.StartupSpecific();
124
125 m_console.Commands.AddCommand("userserver", "create user",
126 "create user [<first> [<last> [<x> <y> [email]]]]",
127 "Create a new user account", RunCommand);
128
129 m_console.Commands.AddCommand("userserver", "reset user password",
130 "reset user password [<first> [<last> [<new password>]]]",
131 "Reset a user's password", RunCommand);
132
133 m_console.Commands.AddCommand("userserver", "login level",
134 "login level <level>",
135 "Set the minimum user level to log in", HandleLoginCommand);
136
137 m_console.Commands.AddCommand("userserver", "login reset",
138 "login reset",
139 "Reset the login level to allow all users",
140 HandleLoginCommand);
141
142 m_console.Commands.AddCommand("userserver", "login text",
143 "login text <text>",
144 "Set the text users will see on login", HandleLoginCommand);
145
146 m_console.Commands.AddCommand("userserver", "test-inventory",
147 "test-inventory",
148 "Perform a test inventory transaction", RunCommand);
149
150 m_console.Commands.AddCommand("userserver", "logoff-user",
151 "logoff-user <first> <last> <message>",
152 "Log off a named user", RunCommand);
122 } 153 }
123 154
124 /// <summary> 155 /// <summary>
@@ -301,39 +332,54 @@ namespace OpenSim.Grid.UserServer
301 m_userManager.ResetUserPassword(firstName, lastName, newPassword); 332 m_userManager.ResetUserPassword(firstName, lastName, newPassword);
302 } 333 }
303 334
304 public override void RunCmd(string cmd, string[] cmdparams) 335 private void HandleLoginCommand(string module, string[] cmd)
305 { 336 {
306 base.RunCmd(cmd, cmdparams); 337 string subcommand = cmd[1];
307 switch (cmd) 338
339 switch (subcommand)
308 { 340 {
309 case "create": 341 case "level":
310 do_create(cmdparams); 342 // Set the minimal level to allow login
311 break; 343 // Useful to allow grid update without worrying about users.
312 344 // or fixing critical issues
313 case "reset": 345 //
314 Reset(cmdparams); 346 if (cmd.Length > 2)
315 break;
316
317
318 case "login-level":
319 // Set the minimal level to allow login
320 // Usefull to allow grid update without worrying about users.
321 // or fixing critical issue
322 if (cmdparams.Length == 1)
323 { 347 {
324 int level = Convert.ToInt32(cmdparams[0]); 348 int level = Convert.ToInt32(cmd[2]);
325 m_loginService.setloginlevel(level); 349 m_loginService.setloginlevel(level);
326 } 350 }
327 break; 351 break;
328 case "login-reset": 352 case "reset":
329 m_loginService.setloginlevel(0); 353 m_loginService.setloginlevel(0);
330 break; 354 break;
331 case "login-text": 355 case "text":
332 if (cmdparams.Length == 1) 356 if (cmd.Length > 2)
333 { 357 {
334 m_loginService.setwelcometext(cmdparams[0]); 358 m_loginService.setwelcometext(cmd[2]);
335 } 359 }
336 break; 360 break;
361 }
362 }
363
364 public void RunCommand(string module, string[] cmd)
365 {
366 List<string> args = new List<string>(cmd);
367 string command = cmd[0];
368
369 args.RemoveAt(0);
370
371 string[] cmdparams = args.ToArray();
372
373 switch (command)
374 {
375 case "create":
376 do_create(cmdparams);
377 break;
378
379 case "reset":
380 Reset(cmdparams);
381 break;
382
337 383
338 case "test-inventory": 384 case "test-inventory":
339 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); 385 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();