aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/UserManagerBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs')
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs68
1 files changed, 46 insertions, 22 deletions
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index a5ca654..3946ea3 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -52,6 +52,17 @@ namespace OpenSim.Framework.Communications
52 /// List of plugins to search for user data 52 /// List of plugins to search for user data
53 /// </value> 53 /// </value>
54 private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); 54 private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>();
55
56 private IInterServiceInventoryServices m_interServiceInventoryService;
57
58 /// <summary>
59 /// Constructor
60 /// </summary>
61 /// <param name="interServiceInventoryService"></param>
62 public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService)
63 {
64 m_interServiceInventoryService = interServiceInventoryService;
65 }
55 66
56 /// <summary> 67 /// <summary>
57 /// Add a new user data plugin - plugins will be requested in the order they were added. 68 /// Add a new user data plugin - plugins will be requested in the order they were added.
@@ -80,7 +91,7 @@ namespace OpenSim.Framework.Communications
80 _plugins.AddRange(loader.Plugins); 91 _plugins.AddRange(loader.Plugins);
81 } 92 }
82 93
83 #region Get UserProfile 94 #region Get UserProfile
84 95
85 // see IUserService 96 // see IUserService
86 public UserProfileData GetUserProfile(string fname, string lname) 97 public UserProfileData GetUserProfile(string fname, string lname)
@@ -586,39 +597,42 @@ namespace OpenSim.Framework.Communications
586 #endregion 597 #endregion
587 598
588 /// <summary> 599 /// <summary>
589 /// Add a new user profile 600 /// Add a new user
590 /// </summary> 601 /// </summary>
591 /// <param name="firstName">first name.</param> 602 /// <param name="firstName">first name</param>
592 /// <param name="lastName">last name.</param> 603 /// <param name="lastName">last name</param>
593 /// <param name="pass">password</param> 604 /// <param name="password">password</param>
594 /// <param name="email">email.</param> 605 /// <param name="email">email</param>
595 /// <param name="regX">location X.</param> 606 /// <param name="regX">location X</param>
596 /// <param name="regY">location Y.</param> 607 /// <param name="regY">location Y</param>
597 /// <returns></returns> 608 /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
598 public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY) 609 public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY)
599 { 610 {
600 return AddUserProfile(firstName, lastName, pass, email, regX, regY, UUID.Random()); 611 return AddUser(firstName, lastName, password, email, regX, regY, UUID.Random());
601 } 612 }
602 613
603 /// <summary> 614 /// <summary>
604 /// Adds the user profile. 615 /// Add a new user
605 /// </summary> 616 /// </summary>
606 /// <param name="firstName">first name.</param> 617 /// <param name="firstName">first name</param>
607 /// <param name="lastName">last name.</param> 618 /// <param name="lastName">last name</param>
608 /// <param name="pass">password</param> 619 /// <param name="password">password</param>
609 /// <param name="email">email.</param> 620 /// <param name="email">email</param>
610 /// <param name="regX">location X.</param> 621 /// <param name="regX">location X</param>
611 /// <param name="regY">location Y.</param> 622 /// <param name="regY">location Y</param>
612 /// <param name="SetUUID">UUID of avatar.</param> 623 /// <param name="SetUUID">UUID of avatar.</param>
613 /// <returns></returns> 624 /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
614 public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID SetUUID) 625 public UUID AddUser(
626 string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
615 { 627 {
628 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
629
616 UserProfileData user = new UserProfileData(); 630 UserProfileData user = new UserProfileData();
617 user.HomeLocation = new Vector3(128, 128, 100); 631 user.HomeLocation = new Vector3(128, 128, 100);
618 user.ID = SetUUID; 632 user.ID = SetUUID;
619 user.FirstName = firstName; 633 user.FirstName = firstName;
620 user.SurName = lastName; 634 user.SurName = lastName;
621 user.PasswordHash = pass; 635 user.PasswordHash = md5PasswdHash;
622 user.PasswordSalt = String.Empty; 636 user.PasswordSalt = String.Empty;
623 user.Created = Util.UnixTimeSinceEpoch(); 637 user.Created = Util.UnixTimeSinceEpoch();
624 user.HomeLookAt = new Vector3(100, 100, 100); 638 user.HomeLookAt = new Vector3(100, 100, 100);
@@ -638,7 +652,17 @@ namespace OpenSim.Framework.Communications
638 } 652 }
639 } 653 }
640 654
641 return user.ID; 655 UserProfileData userProf = GetUserProfile(firstName, lastName);
656 if (userProf == null)
657 {
658 return UUID.Zero;
659 }
660 else
661 {
662 m_interServiceInventoryService.CreateNewUserInventory(userProf.ID);
663
664 return userProf.ID;
665 }
642 } 666 }
643 667
644 /// <summary> 668 /// <summary>