aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-07-29 17:39:15 +0000
committerJustin Clarke Casey2008-07-29 17:39:15 +0000
commite595959d97f35bf866801fff8b9ceb1ed35b3825 (patch)
tree5242eebee228c922d0a4624c212e19039ef54ccb /OpenSim
parentadding copyright notice and help option to matrix.py. (diff)
downloadopensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.zip
opensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.tar.gz
opensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.tar.bz2
opensim-SC_OLD-e595959d97f35bf866801fff8b9ceb1ed35b3825.tar.xz
* refactor: move create user console command parsing down to OpenSim.cs from CommunicationsManager
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs47
-rw-r--r--OpenSim/Region/Application/OpenSim.cs71
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
3 files changed, 68 insertions, 52 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 3659d86..2bfe045 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -31,7 +31,6 @@ using System.Reflection;
31using libsecondlife; 31using libsecondlife;
32using log4net; 32using log4net;
33using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework.Console;
35using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
36 35
37namespace OpenSim.Framework.Communications 36namespace OpenSim.Framework.Communications
@@ -231,50 +230,6 @@ namespace OpenSim.Framework.Communications
231 230
232 #endregion 231 #endregion
233 232
234 public void doCreate(string[] cmmdParams)
235 {
236 switch (cmmdParams[0])
237 {
238 case "user":
239 string firstName;
240 string lastName;
241 string password;
242 uint regX = 1000;
243 uint regY = 1000;
244
245 if (cmmdParams.Length < 2)
246 firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
247 else firstName = cmmdParams[1];
248
249 if ( cmmdParams.Length < 3 )
250 lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
251 else lastName = cmmdParams[2];
252
253 if ( cmmdParams.Length < 4 )
254 password = MainConsole.Instance.PasswdPrompt("Password");
255 else password = cmmdParams[3];
256
257 if ( cmmdParams.Length < 5 )
258 regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
259 else regX = Convert.ToUInt32(cmmdParams[4]);
260
261 if ( cmmdParams.Length < 6 )
262 regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
263 else regY = Convert.ToUInt32(cmmdParams[5]);
264
265
266 if (null == m_userService.GetUserProfile(firstName, lastName))
267 {
268 AddUser(firstName, lastName, password, regX, regY);
269 }
270 else
271 {
272 m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
273 }
274 break;
275 }
276 }
277
278 /// <summary> 233 /// <summary>
279 /// Persistently adds a user to OpenSim. 234 /// Persistently adds a user to OpenSim.
280 /// </summary> 235 /// </summary>
@@ -283,7 +238,7 @@ namespace OpenSim.Framework.Communications
283 /// <param name="password"></param> 238 /// <param name="password"></param>
284 /// <param name="regX"></param> 239 /// <param name="regX"></param>
285 /// <param name="regY"></param> 240 /// <param name="regY"></param>
286 /// <returns>The UUID of the added user. Returns null if the add was unsuccessful</returns> 241 /// <returns>The UUID of the added user. Returns LLUUID.Zero if the add was unsuccessful</returns>
287 public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY) 242 public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY)
288 { 243 {
289 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); 244 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 66c7c48..71a941e 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -208,7 +208,6 @@ namespace OpenSim
208 } 208 }
209 } 209 }
210 210
211
212 /// <summary> 211 /// <summary>
213 /// Runs commands issued by the server console from the operator 212 /// Runs commands issued by the server console from the operator
214 /// </summary> 213 /// </summary>
@@ -348,9 +347,7 @@ namespace OpenSim
348 break; 347 break;
349 348
350 case "create": 349 case "create":
351 if (m_sandbox) 350 Create(cmdparams);
352 CreateAccount(cmdparams);
353
354 break; 351 break;
355 352
356 case "create-region": 353 case "create-region":
@@ -524,6 +521,23 @@ namespace OpenSim
524 break; 521 break;
525 } 522 }
526 } 523 }
524
525 /// <summary>
526 /// Execute switch for some of the create commands
527 /// </summary>
528 /// <param name="args"></param>
529 protected void Create(string[] args)
530 {
531 if (args.Length == 0)
532 return;
533
534 switch (args[0])
535 {
536 case "user":
537 CreateUser(args);
538 break;
539 }
540 }
527 541
528 /// <summary> 542 /// <summary>
529 /// Turn on some debugging values for OpenSim. 543 /// Turn on some debugging values for OpenSim.
@@ -653,6 +667,48 @@ namespace OpenSim
653 } 667 }
654 } 668 }
655 669
670 /// <summary>
671 /// Create a new user
672 /// </summary>
673 /// <param name="cmdparams"></param>
674 protected void CreateUser(string[] cmdparams)
675 {
676 string firstName;
677 string lastName;
678 string password;
679 uint regX = 1000;
680 uint regY = 1000;
681
682 if (cmdparams.Length < 2)
683 firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
684 else firstName = cmdparams[1];
685
686 if ( cmdparams.Length < 3 )
687 lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
688 else lastName = cmdparams[2];
689
690 if ( cmdparams.Length < 4 )
691 password = MainConsole.Instance.PasswdPrompt("Password");
692 else password = cmdparams[3];
693
694 if ( cmdparams.Length < 5 )
695 regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
696 else regX = Convert.ToUInt32(cmdparams[4]);
697
698 if ( cmdparams.Length < 6 )
699 regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
700 else regY = Convert.ToUInt32(cmdparams[5]);
701
702 if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName))
703 {
704 m_commsManager.AddUser(firstName, lastName, password, regX, regY);
705 }
706 else
707 {
708 m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName);
709 }
710 }
711
656 protected void SaveXml(string[] cmdparams) 712 protected void SaveXml(string[] cmdparams)
657 { 713 {
658 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."); 714 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
773 protected void SaveInv(string[] cmdparams) 829 protected void SaveInv(string[] cmdparams)
774 { 830 {
775 m_log.Error("[CONSOLE]: This has not been implemented yet!"); 831 m_log.Error("[CONSOLE]: This has not been implemented yet!");
832
833// CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails();
834// if (userInfo == null)
835// {
836// m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString());
837// return;
838// }
776 } 839 }
777 840
778 private static string CombineParams(string[] commandParams, int pos) 841 private static string CombineParams(string[] commandParams, int pos)
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index a9351d3..8de7c58 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -393,8 +393,6 @@ namespace OpenSim
393 m_gridInfoService = new GridInfoService(); 393 m_gridInfoService = new GridInfoService();
394 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); 394 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
395 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); 395 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
396
397 CreateAccount = localComms.doCreate;
398 } 396 }
399 else 397 else
400 { 398 {