aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-15 17:29:11 +0000
committerJustin Clarke Casey2008-09-15 17:29:11 +0000
commit6d289c3ae00b8d0f745d3345e8148b8d39b5206f (patch)
tree0a2f99813573fa61936202a2949532ac1f1685a1
parentAdd the option to use Allow_osFunction = false for each OS function (diff)
downloadopensim-SC_OLD-6d289c3ae00b8d0f745d3345e8148b8d39b5206f.zip
opensim-SC_OLD-6d289c3ae00b8d0f745d3345e8148b8d39b5206f.tar.gz
opensim-SC_OLD-6d289c3ae00b8d0f745d3345e8148b8d39b5206f.tar.bz2
opensim-SC_OLD-6d289c3ae00b8d0f745d3345e8148b8d39b5206f.tar.xz
* Add "reset user password" command to standalone region console
* Grid user server implementation to follow shortly
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs12
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs11
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs29
-rw-r--r--OpenSim/Region/Application/OpenSim.cs55
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs5
5 files changed, 109 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 969bdd8..1ac5fe4 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -256,6 +256,18 @@ namespace OpenSim.Framework.Communications
256 return userProf.ID; 256 return userProf.ID;
257 } 257 }
258 } 258 }
259
260 /// <summary>
261 /// Reset a user password
262 /// </summary>
263 /// <param name="firstName"></param>
264 /// <param name="lastName"></param>
265 /// <param name="newPassword"></param>
266 /// <returns>true if the update was successful, false otherwise</returns>
267 public bool ResetUserPassword(string firstName, string lastName, string newPassword)
268 {
269 return m_userService.ResetUserPassword(firstName, lastName, newPassword);
270 }
259 271
260 #region Friend Methods 272 #region Friend Methods
261 273
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index 7e3c77b..d52d1ea 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Framework.Communications
59 UserProfileData SetupMasterUser(UUID userId); 59 UserProfileData SetupMasterUser(UUID userId);
60 60
61 /// <summary> 61 /// <summary>
62 /// 62 /// Add a new user profile
63 /// </summary> 63 /// </summary>
64 /// <param name="user"></param> 64 /// <param name="user"></param>
65 UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); 65 UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
@@ -71,6 +71,15 @@ namespace OpenSim.Framework.Communications
71 /// via a call to GetUserProfile().</param> 71 /// via a call to GetUserProfile().</param>
72 /// <returns>true if the update could be applied, false if it could not be applied.</returns> 72 /// <returns>true if the update could be applied, false if it could not be applied.</returns>
73 bool UpdateUserProfile(UserProfileData data); 73 bool UpdateUserProfile(UserProfileData data);
74
75 /// <summary>
76 /// Reset a user password
77 /// </summary>
78 /// <param name="firstName"></param>
79 /// <param name="lastName"></param>
80 /// <param name="newPassword"></param>
81 /// <returns>true if the update was successful, false otherwise</returns>
82 bool ResetUserPassword(string firstName, string lastName, string newPassword);
74 83
75 /// <summary> 84 /// <summary>
76 /// Adds a new friend to the database for XUser 85 /// Adds a new friend to the database for XUser
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 75c4dc1..4fc2fea 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -361,8 +361,6 @@ namespace OpenSim.Framework.Communications
361 /// <param name="request">The users loginrequest</param> 361 /// <param name="request">The users loginrequest</param>
362 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 362 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
363 { 363 {
364 Hashtable requestData = (Hashtable) request.Params[0];
365
366 UserAgentData agent = new UserAgentData(); 364 UserAgentData agent = new UserAgentData();
367 365
368 // User connection 366 // User connection
@@ -574,6 +572,33 @@ namespace OpenSim.Framework.Communications
574 572
575 return user.ID; 573 return user.ID;
576 } 574 }
575
576 /// <summary>
577 /// Reset a user password
578 /// </summary>
579 /// <param name="firstName"></param>
580 /// <param name="lastName"></param>
581 /// <param name="newPassword"></param>
582 /// <returns>true if the update was successful, false otherwise</returns>
583 public bool ResetUserPassword(string firstName, string lastName, string newPassword)
584 {
585 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(newPassword) + ":" + String.Empty);
586
587 UserProfileData profile = GetUserProfile(firstName, lastName);
588
589 if (null == profile)
590 {
591 m_log.ErrorFormat("[USERSTORAGE]: Could not find user {0} {1}", firstName, lastName);
592 return false;
593 }
594
595 profile.PasswordHash = md5PasswdHash;
596 profile.PasswordSalt = String.Empty;
597
598 UpdateUserProfile(profile);
599
600 return true;
601 }
577 602
578 public bool UpdateUserProfileProperties(UserProfileData UserProfile) 603 public bool UpdateUserProfileProperties(UserProfileData UserProfile)
579 { 604 {
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 4cf34bc..12ef129 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -283,6 +283,7 @@ namespace OpenSim
283 { 283 {
284 m_console.Notice(""); 284 m_console.Notice("");
285 m_console.Notice("create user - adds a new user."); 285 m_console.Notice("create user - adds a new user.");
286 m_console.Notice("reset user password - reset a user's password.");
286 } 287 }
287 288
288 break; 289 break;
@@ -493,6 +494,10 @@ namespace OpenSim
493 m_commsManager.AddInventoryService(cmdparams[0]); 494 m_commsManager.AddInventoryService(cmdparams[0]);
494 } 495 }
495 break; 496 break;
497
498 case "reset":
499 Reset(cmdparams);
500 break;
496 501
497 default: 502 default:
498 string[] tmpPluginArgs = new string[cmdparams.Length + 1]; 503 string[] tmpPluginArgs = new string[cmdparams.Length + 1];
@@ -543,6 +548,30 @@ namespace OpenSim
543 break; 548 break;
544 } 549 }
545 } 550 }
551
552 /// <summary>
553 /// Execute switch for some of the reset commands
554 /// </summary>
555 /// <param name="args"></param>
556 protected void Reset(string[] args)
557 {
558 if (args.Length == 0)
559 return;
560
561 switch (args[0])
562 {
563 case "user":
564
565 switch (args[1])
566 {
567 case "password":
568 ResetUserPassword(args);
569 break;
570 }
571
572 break;
573 }
574 }
546 575
547 /// <summary> 576 /// <summary>
548 /// Turn on some debugging values for OpenSim. 577 /// Turn on some debugging values for OpenSim.
@@ -650,6 +679,7 @@ namespace OpenSim
650 { 679 {
651 m_console.Notice(""); 680 m_console.Notice("");
652 m_console.Notice("create user - adds a new user."); 681 m_console.Notice("create user - adds a new user.");
682 m_console.Notice("reset user password - reset a user's password.");
653 } 683 }
654 } 684 }
655 685
@@ -769,6 +799,31 @@ namespace OpenSim
769 m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName); 799 m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName);
770 } 800 }
771 } 801 }
802
803 /// <summary>
804 /// Reset a user password.
805 /// </summary>
806 /// <param name="cmdparams"></param>
807 private void ResetUserPassword(string[] cmdparams)
808 {
809 string firstName;
810 string lastName;
811 string newPassword;
812
813 if (cmdparams.Length < 3)
814 firstName = MainConsole.Instance.CmdPrompt("First name");
815 else firstName = cmdparams[2];
816
817 if ( cmdparams.Length < 4 )
818 lastName = MainConsole.Instance.CmdPrompt("Last name");
819 else lastName = cmdparams[3];
820
821 if ( cmdparams.Length < 5 )
822 newPassword = MainConsole.Instance.PasswdPrompt("New password");
823 else newPassword = cmdparams[4];
824
825 m_commsManager.ResetUserPassword(firstName, lastName, newPassword);
826 }
772 827
773 protected void SaveXml(string[] cmdparams) 828 protected void SaveXml(string[] cmdparams)
774 { 829 {
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index b8268eb..0ca85d2 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -469,6 +469,11 @@ namespace OpenSim.Region.Communications.OGS1
469 { 469 {
470 throw new Exception("The method or operation is not implemented."); 470 throw new Exception("The method or operation is not implemented.");
471 } 471 }
472
473 public bool ResetUserPassword(string firstName, string lastName, string newPassword)
474 {
475 throw new Exception("The method or operation is not implemented.");
476 }
472 477
473 // TODO 478 // TODO
474 public bool UpdateUserProfile(UserProfileData data) 479 public bool UpdateUserProfile(UserProfileData data)