aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCharles Krinke2008-11-23 03:38:40 +0000
committerCharles Krinke2008-11-23 03:38:40 +0000
commit02fd7751d9b89d838fc8ca2dc60fe11f4cfe93a8 (patch)
treef95a3170f3dd41be8ccf10957aef7209492a0279
parentAdd error handling to catch the WebExceptions thrown if you have (diff)
downloadopensim-SC-02fd7751d9b89d838fc8ca2dc60fe11f4cfe93a8.zip
opensim-SC-02fd7751d9b89d838fc8ca2dc60fe11f4cfe93a8.tar.gz
opensim-SC-02fd7751d9b89d838fc8ca2dc60fe11f4cfe93a8.tar.bz2
opensim-SC-02fd7751d9b89d838fc8ca2dc60fe11f4cfe93a8.tar.xz
Mantis#2660. Thank you kindly, Ruud Lathrop for a patch that:
This patch adds the option of adding the email when you create a new user. This works in Gridmode as none Gridmode. This option is also added to RemoteAdminPlugin. With a new handler you can create a user with a email.
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs104
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs20
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs17
-rw-r--r--OpenSim/Framework/Communications/IUserServiceAdmin.cs26
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs29
-rw-r--r--OpenSim/Grid/UserServer/Main.cs141
-rw-r--r--OpenSim/Region/Application/OpenSim.cs29
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs4
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs2
11 files changed, 285 insertions, 91 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 1490893..db99450 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -93,6 +93,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
93 m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod, false); 93 m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod, false);
94 m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod, false); 94 m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod, false);
95 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod, false); 95 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod, false);
96 //This handler creates a user with a email,
97 m_httpd.AddXmlRPCHandler("admin_create_user_email", XmlRpcCreateUserMethodEmail, false);
96 m_httpd.AddXmlRPCHandler("admin_exists_user", XmlRpcUserExistsMethod, false); 98 m_httpd.AddXmlRPCHandler("admin_exists_user", XmlRpcUserExistsMethod, false);
97 m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod, false); 99 m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod, false);
98 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod, false); 100 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod, false);
@@ -472,7 +474,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
472 { 474 {
473 m_log.InfoFormat("master avatar does not exist, creating it"); 475 m_log.InfoFormat("master avatar does not exist, creating it");
474 // ...or create new user 476 // ...or create new user
475 userID = m_app.CreateUser(masterFirst, masterLast, masterPassword, region.RegionLocX, region.RegionLocY); 477 userID = m_app.CreateUser(masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
476 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 478 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
477 masterFirst, masterLast)); 479 masterFirst, masterLast));
478 } 480 }
@@ -647,7 +649,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
647 649
648 // check completeness 650 // check completeness
649 checkStringParameters(request, new string[] { "password", "user_firstname", 651 checkStringParameters(request, new string[] { "password", "user_firstname",
650 "user_lastname", "user_password" }); 652 "user_lastname", "user_password", });
651 checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" }); 653 checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
652 654
653 // check password 655 // check password
@@ -658,6 +660,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
658 string firstname = (string) requestData["user_firstname"]; 660 string firstname = (string) requestData["user_firstname"];
659 string lastname = (string) requestData["user_lastname"]; 661 string lastname = (string) requestData["user_lastname"];
660 string passwd = (string) requestData["user_password"]; 662 string passwd = (string) requestData["user_password"];
663 string email = ""; //Empty string for email
661 uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); 664 uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
662 uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); 665 uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
663 666
@@ -665,7 +668,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
665 if (null != userProfile) 668 if (null != userProfile)
666 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 669 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
667 670
668 UUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); 671 UUID userID = m_app.CreateUser(firstname, lastname, passwd, email, regX, regY);
669 672
670 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 673 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
671 firstname, lastname)); 674 firstname, lastname));
@@ -692,6 +695,101 @@ namespace OpenSim.ApplicationPlugins.RemoteController
692 return response; 695 return response;
693 } 696 }
694 697
698 /// <summary>
699 /// Create a new user account.
700 /// <summary>
701 /// <param name="request">incoming XML RPC request</param>
702 /// <remarks>
703 /// XmlRpcCreateUserMethod takes the following XMLRPC
704 /// parameters
705 /// <list type="table">
706 /// <listheader><term>parameter name</term><description>description</description></listheader>
707 /// <item><term>password</term>
708 /// <description>admin password as set in OpenSim.ini</description></item>
709 /// <item><term>user_firstname</term>
710 /// <description>avatar's first name</description></item>
711 /// <item><term>user_lastname</term>
712 /// <description>avatar's last name</description></item>
713 /// <item><term>user_password</term>
714 /// <description>avatar's password</description></item>
715 /// <item><term>start_region_x</term>
716 /// <description>avatar's start region coordinates, X value</description></item>
717 /// <item><term>start_region_y</term>
718 /// <description>avatar's start region coordinates, Y value</description></item>
719 /// <item><term>user_email</term>
720 /// <description>email of avatar</description></item>
721 /// </list>
722 ///
723 /// XmlRpcCreateUserMethod returns
724 /// <list type="table">
725 /// <listheader><term>name</term><description>description</description></listheader>
726 /// <item><term>success</term>
727 /// <description>true or false</description></item>
728 /// <item><term>error</term>
729 /// <description>error message if success is false</description></item>
730 /// <item><term>avatar_uuid</term>
731 /// <description>UUID of the newly created avatar
732 /// account; UUID.Zero if failed.
733 /// </description></item>
734 /// </list>
735 /// </remarks>
736 public XmlRpcResponse XmlRpcCreateUserMethodEmail(XmlRpcRequest request)
737 {
738 m_log.Info("[RADMIN]: CreateUser: new request");
739 XmlRpcResponse response = new XmlRpcResponse();
740 Hashtable responseData = new Hashtable();
741
742 try
743 {
744 Hashtable requestData = (Hashtable)request.Params[0];
745
746 // check completeness
747 checkStringParameters(request, new string[] { "password", "user_firstname",
748 "user_lastname", "user_password", "user_email" });
749 checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
750
751 // check password
752 if (!String.IsNullOrEmpty(requiredPassword) &&
753 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
754
755 // do the job
756 string firstname = (string)requestData["user_firstname"];
757 string lastname = (string)requestData["user_lastname"];
758 string passwd = (string)requestData["user_password"];
759 string email = (string)requestData["user_email"];
760 uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
761 uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
762
763 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
764 if (null != userProfile)
765 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
766
767 UUID userID = m_app.CreateUser(firstname, lastname, passwd, email, regX, regY);
768
769 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
770 firstname, lastname));
771
772 responseData["success"] = "true";
773 responseData["avatar_uuid"] = userID.ToString();
774
775 response.Value = responseData;
776
777 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
778 }
779 catch (Exception e)
780 {
781 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
782 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
783
784 responseData["success"] = "false";
785 responseData["avatar_uuid"] = UUID.Zero.ToString();
786 responseData["error"] = e.Message;
787
788 response.Value = responseData;
789 }
790
791 return response;
792 }
695 793
696 /// <summary> 794 /// <summary>
697 /// Check whether a certain user account exists. 795 /// Check whether a certain user account exists.
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index bb4a853..3f46776 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -255,14 +255,15 @@ namespace OpenSim.Framework.Communications
255 /// <param name="firstName"></param> 255 /// <param name="firstName"></param>
256 /// <param name="lastName"></param> 256 /// <param name="lastName"></param>
257 /// <param name="password"></param> 257 /// <param name="password"></param>
258 /// <param name="email"></param>
258 /// <param name="regX"></param> 259 /// <param name="regX"></param>
259 /// <param name="regY"></param> 260 /// <param name="regY"></param>
260 /// <returns>The UUID of the added user. Returns UUID.Zero if the add was unsuccessful</returns> 261 /// <returns>The UUID of the added user. Returns UUID.Zero if the add was unsuccessful</returns>
261 public UUID AddUser(string firstName, string lastName, string password, uint regX, uint regY) 262 public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY)
262 { 263 {
263 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); 264 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
264 265
265 m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY); 266 m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY);
266 UserProfileData userProf = UserService.GetUserProfile(firstName, lastName); 267 UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
267 if (userProf == null) 268 if (userProf == null)
268 { 269 {
@@ -276,11 +277,22 @@ namespace OpenSim.Framework.Communications
276 } 277 }
277 } 278 }
278 279
279 public UUID AddUser(string firstName, string lastName, string password, uint regX, uint regY, UUID SetUUID) 280 /// <summary>
281 /// Adds the user.
282 /// </summary>
283 /// <param name="firstName">The first name.</param>
284 /// <param name="lastName">The last name.</param>
285 /// <param name="password">The password.</param>
286 /// <param name="email">The email.</param>
287 /// <param name="regX">The reg X.</param>
288 /// <param name="regY">The reg Y.</param>
289 /// <param name="SetUUID">The set UUID.</param>
290 /// <returns></returns>
291 public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
280 { 292 {
281 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); 293 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
282 294
283 m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY, SetUUID); 295 m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY, SetUUID);
284 UserProfileData userProf = UserService.GetUserProfile(firstName, lastName); 296 UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
285 if (userProf == null) 297 if (userProf == null)
286 { 298 {
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index 50c9917..178b5a0 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -35,15 +35,15 @@ namespace OpenSim.Framework.Communications
35 /// <summary> 35 /// <summary>
36 /// Loads a user profile by name 36 /// Loads a user profile by name
37 /// </summary> 37 /// </summary>
38 /// <param name="fname">First name</param> 38 /// <param name="firstName">First name</param>
39 /// <param name="lname">Last name</param> 39 /// <param name="lastName">Last name</param>
40 /// <returns>A user profile. Returns null if no profile is found</returns> 40 /// <returns>A user profile. Returns null if no profile is found</returns>
41 UserProfileData GetUserProfile(string firstName, string lastName); 41 UserProfileData GetUserProfile(string firstName, string lastName);
42 42
43 /// <summary> 43 /// <summary>
44 /// Loads a user profile from a database by UUID 44 /// Loads a user profile from a database by UUID
45 /// </summary> 45 /// </summary>
46 /// <param name="uuid">The target UUID</param> 46 /// <param name="userId">The target UUID</param>
47 /// <returns>A user profile. Returns null if no user profile is found.</returns> 47 /// <returns>A user profile. Returns null if no user profile is found.</returns>
48 UserProfileData GetUserProfile(UUID userId); 48 UserProfileData GetUserProfile(UUID userId);
49 49
@@ -90,8 +90,8 @@ namespace OpenSim.Framework.Communications
90 /// <summary> 90 /// <summary>
91 /// Logs off a user on the user server 91 /// Logs off a user on the user server
92 /// </summary> 92 /// </summary>
93 /// <param name="UserID">UUID of the user</param> 93 /// <param name="userid">UUID of the user</param>
94 /// <param name="regionID">UUID of the Region</param> 94 /// <param name="regionid">UUID of the Region</param>
95 /// <param name="regionhandle">regionhandle</param> 95 /// <param name="regionhandle">regionhandle</param>
96 /// <param name="position">final position</param> 96 /// <param name="position">final position</param>
97 /// <param name="lookat">final lookat</param> 97 /// <param name="lookat">final lookat</param>
@@ -100,8 +100,8 @@ namespace OpenSim.Framework.Communications
100 /// <summary> 100 /// <summary>
101 /// Logs off a user on the user server (deprecated as of 2008-08-27) 101 /// Logs off a user on the user server (deprecated as of 2008-08-27)
102 /// </summary> 102 /// </summary>
103 /// <param name="UserID">UUID of the user</param> 103 /// <param name="userid">UUID of the user</param>
104 /// <param name="regionID">UUID of the Region</param> 104 /// <param name="regionid">UUID of the Region</param>
105 /// <param name="regionhandle">regionhandle</param> 105 /// <param name="regionhandle">regionhandle</param>
106 /// <param name="posx">final position x</param> 106 /// <param name="posx">final position x</param>
107 /// <param name="posy">final position y</param> 107 /// <param name="posy">final position y</param>
@@ -118,7 +118,8 @@ namespace OpenSim.Framework.Communications
118 /// Updates the current region the User is in 118 /// Updates the current region the User is in
119 /// </summary> 119 /// </summary>
120 /// <param name="avatarid">User Region the Avatar is IN</param> 120 /// <param name="avatarid">User Region the Avatar is IN</param>
121 /// <param name="retionuuid">User Region the Avatar is IN</param> 121 /// <param name="regionuuid">User Region the Avatar is IN</param>
122 /// <param name="regionhandle">User region handle</param>
122 void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle); 123 void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle);
123 124
124 /// <summary> 125 /// <summary>
diff --git a/OpenSim/Framework/Communications/IUserServiceAdmin.cs b/OpenSim/Framework/Communications/IUserServiceAdmin.cs
index 169385f..a120add 100644
--- a/OpenSim/Framework/Communications/IUserServiceAdmin.cs
+++ b/OpenSim/Framework/Communications/IUserServiceAdmin.cs
@@ -30,15 +30,31 @@ using OpenMetaverse;
30namespace OpenSim.Framework.Communications 30namespace OpenSim.Framework.Communications
31{ 31{
32 public interface IUserServiceAdmin 32 public interface IUserServiceAdmin
33 { 33 {
34 /// <summary> 34 /// <summary>
35 /// Add a new user profile 35 /// Add a new user profile
36 /// </summary> 36 /// </summary>
37 /// <param name="user"></param> 37 /// <param name="firstName">The first name.</param>
38 UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); 38 /// <param name="lastName">The last name.</param>
39 /// <param name="pass">password of avatar</param>
40 /// <param name="email">email of user</param>
41 /// <param name="regX">region X.</param>
42 /// <param name="regY">region Y.</param>
43 /// <returns></returns>
44 UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY);
39 45
40 // Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances! 46 /// <summary>
41 UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID setUUID); 47 /// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances!
48 /// </summary>
49 /// <param name="firstName">The first name.</param>
50 /// <param name="lastName">The last name.</param>
51 /// <param name="pass">password of avatar</param>
52 /// <param name="email">email of user</param>
53 /// <param name="regX">region X.</param>
54 /// <param name="regY">region Y.</param>
55 /// <param name="setUUID">The set UUID.</param>
56 /// <returns></returns>
57 UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID setUUID);
42 58
43 /// <summary> 59 /// <summary>
44 /// Reset a user password 60 /// Reset a user password
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 4b5d2bb..bc1a593 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Framework.Communications
54 /// Adds a new user server plugin - user servers will be requested in the order they were loaded. 54 /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
55 /// </summary> 55 /// </summary>
56 /// <param name="provider">The filename to the user server plugin DLL</param> 56 /// <param name="provider">The filename to the user server plugin DLL</param>
57 /// <param name="connect"></param>
57 public void AddPlugin(string provider, string connect) 58 public void AddPlugin(string provider, string connect)
58 { 59 {
59 PluginLoader<IUserDataPlugin> loader = 60 PluginLoader<IUserDataPlugin> loader =
@@ -580,15 +581,32 @@ namespace OpenSim.Framework.Communications
580 #endregion 581 #endregion
581 582
582 /// <summary> 583 /// <summary>
583 /// 584 /// Add a new user profile
584 /// </summary> 585 /// </summary>
585 /// <param name="user"></param> 586 /// <param name="firstName">first name.</param>
586 public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) 587 /// <param name="lastName">last name.</param>
588 /// <param name="pass">password</param>
589 /// <param name="email">email.</param>
590 /// <param name="regX">location X.</param>
591 /// <param name="regY">location Y.</param>
592 /// <returns></returns>
593 public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY)
587 { 594 {
588 return AddUserProfile(firstName, lastName, pass, regX, regY, UUID.Random()); 595 return AddUserProfile(firstName, lastName, pass, email, regX, regY, UUID.Random());
589 } 596 }
590 597
591 public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID SetUUID) 598 /// <summary>
599 /// Adds the user profile.
600 /// </summary>
601 /// <param name="firstName">first name.</param>
602 /// <param name="lastName">last name.</param>
603 /// <param name="pass">password</param>
604 /// <param name="email">email.</param>
605 /// <param name="regX">location X.</param>
606 /// <param name="regY">location Y.</param>
607 /// <param name="SetUUID">UUID of avatar.</param>
608 /// <returns></returns>
609 public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID SetUUID)
592 { 610 {
593 UserProfileData user = new UserProfileData(); 611 UserProfileData user = new UserProfileData();
594 user.HomeLocation = new Vector3(128, 128, 100); 612 user.HomeLocation = new Vector3(128, 128, 100);
@@ -601,6 +619,7 @@ namespace OpenSim.Framework.Communications
601 user.HomeLookAt = new Vector3(100, 100, 100); 619 user.HomeLookAt = new Vector3(100, 100, 100);
602 user.HomeRegionX = regX; 620 user.HomeRegionX = regX;
603 user.HomeRegionY = regY; 621 user.HomeRegionY = regY;
622 user.Email = email;
604 623
605 foreach (IUserDataPlugin plugin in _plugins) 624 foreach (IUserDataPlugin plugin in _plugins)
606 { 625 {
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 1a37b83..eb47259 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -162,62 +162,12 @@ namespace OpenSim.Grid.UserServer
162 m_httpServer.AddXmlRPCHandler("update_user_profile", m_userManager.XmlRpcResponseXmlRPCUpdateUserProfile); 162 m_httpServer.AddXmlRPCHandler("update_user_profile", m_userManager.XmlRpcResponseXmlRPCUpdateUserProfile);
163 } 163 }
164 164
165 public void do_create(string what) 165 public void do_create(string[] args)
166 { 166 {
167 switch (what) 167 switch (args[0])
168 { 168 {
169 case "user": 169 case "user":
170 string tempfirstname = m_console.CmdPrompt("First name"); 170 CreateUser(args);
171 string templastname = m_console.CmdPrompt("Last name");
172 //tempMD5Passwd = m_console.PasswdPrompt("Password");
173 string tempMD5Passwd = m_console.CmdPrompt("Password");
174 uint regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
175 uint regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
176
177 if (null != m_userManager.GetUserProfile(tempfirstname, templastname))
178 {
179 m_log.ErrorFormat(
180 "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
181
182 break;
183 }
184
185 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
186
187 UUID userID = new UUID();
188
189 try
190 {
191 userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
192 }
193 catch (Exception ex)
194 {
195 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
196 }
197
198 try
199 {
200 if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
201 {
202 throw new Exception(
203 String.Format(
204 "The inventory creation request for user {0} did not succeed."
205 + " Please contact your inventory service provider for more information.",
206 userID));
207 }
208 }
209 catch (WebException)
210 {
211 m_log.ErrorFormat(
212 "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
213 Cfg.InventoryUrl + "CreateInventory/", userID);
214 }
215 catch (Exception e)
216 {
217 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
218 }
219
220 m_lastCreatedUser = userID;
221 break; 171 break;
222 } 172 }
223 } 173 }
@@ -244,8 +194,87 @@ namespace OpenSim.Grid.UserServer
244 194
245 break; 195 break;
246 } 196 }
247 } 197 }
248 198
199 /// <summary>
200 /// Create a new user
201 /// </summary>
202 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
203 protected void CreateUser(string[] cmdparams)
204 {
205 string firstName;
206 string lastName;
207 string password;
208 string email;
209 uint regX = 1000;
210 uint regY = 1000;
211
212 if (cmdparams.Length < 2)
213 firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
214 else firstName = cmdparams[1];
215
216 if (cmdparams.Length < 3)
217 lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
218 else lastName = cmdparams[2];
219
220 if (cmdparams.Length < 4)
221 password = MainConsole.Instance.PasswdPrompt("Password");
222 else password = cmdparams[3];
223
224 if (cmdparams.Length < 5)
225 regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
226 else regX = Convert.ToUInt32(cmdparams[4]);
227
228 if (cmdparams.Length < 6)
229 regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
230 else regY = Convert.ToUInt32(cmdparams[5]);
231
232 if (cmdparams.Length < 7)
233 email = MainConsole.Instance.CmdPrompt("Email", "");
234 else email = cmdparams[6];
235
236 if (null == m_userManager.GetUserProfile(firstName, lastName))
237 {
238 password = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
239
240 UUID userID = new UUID();
241
242 try
243 {
244 userID = m_userManager.AddUserProfile(firstName, lastName, password, email, regX, regY);
245 }
246 catch (Exception ex)
247 {
248 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
249 }
250
251 try
252 {
253 if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
254 {
255 throw new Exception(
256 String.Format("The inventory creation request for user {0} did not succeed."
257 + " Please contact your inventory service provider for more information.", userID));
258 }
259 }
260 catch (WebException)
261 {
262 m_log.ErrorFormat("[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
263 Cfg.InventoryUrl + "CreateInventory/", userID);
264 }
265 catch (Exception e)
266 {
267 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
268 }
269
270 m_lastCreatedUser = userID;
271 }
272 else
273 {
274 m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
275 }
276 }
277
249 /// <summary> 278 /// <summary>
250 /// Reset a user password. 279 /// Reset a user password.
251 /// </summary> 280 /// </summary>
@@ -277,7 +306,7 @@ namespace OpenSim.Grid.UserServer
277 switch (cmd) 306 switch (cmd)
278 { 307 {
279 case "create": 308 case "create":
280 do_create(cmdparams[0]); 309 do_create(cmdparams);
281 break; 310 break;
282 311
283 case "reset": 312 case "reset":
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index e3aee9d..765c471 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -516,7 +516,14 @@ namespace OpenSim
516 switch (args[0]) 516 switch (args[0])
517 { 517 {
518 case "user": 518 case "user":
519 CreateUser(args); 519 if (ConfigurationSettings.Standalone)
520 {
521 CreateUser(args);
522 }
523 else
524 {
525 m_console.Notice("Create user is not available in grid mode, use the user-server.");
526 }
520 break; 527 break;
521 } 528 }
522 } 529 }
@@ -537,7 +544,14 @@ namespace OpenSim
537 switch (args[1]) 544 switch (args[1])
538 { 545 {
539 case "password": 546 case "password":
540 ResetUserPassword(args); 547 if (ConfigurationSettings.Standalone)
548 {
549 ResetUserPassword(args);
550 }
551 else
552 {
553 m_console.Notice("Reset user password is not available in grid mode, use the user-server.");
554 }
541 break; 555 break;
542 } 556 }
543 557
@@ -734,12 +748,13 @@ namespace OpenSim
734 /// <summary> 748 /// <summary>
735 /// Create a new user 749 /// Create a new user
736 /// </summary> 750 /// </summary>
737 /// <param name="cmdparams"></param> 751 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
738 protected void CreateUser(string[] cmdparams) 752 protected void CreateUser(string[] cmdparams)
739 { 753 {
740 string firstName; 754 string firstName;
741 string lastName; 755 string lastName;
742 string password; 756 string password;
757 string email;
743 uint regX = 1000; 758 uint regX = 1000;
744 uint regY = 1000; 759 uint regY = 1000;
745 760
@@ -751,7 +766,7 @@ namespace OpenSim
751 lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); 766 lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
752 else lastName = cmdparams[2]; 767 else lastName = cmdparams[2];
753 768
754 if ( cmdparams.Length < 4 ) 769 if (cmdparams.Length < 4)
755 password = MainConsole.Instance.PasswdPrompt("Password"); 770 password = MainConsole.Instance.PasswdPrompt("Password");
756 else password = cmdparams[3]; 771 else password = cmdparams[3];
757 772
@@ -763,9 +778,13 @@ namespace OpenSim
763 regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString())); 778 regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
764 else regY = Convert.ToUInt32(cmdparams[5]); 779 else regY = Convert.ToUInt32(cmdparams[5]);
765 780
781 if (cmdparams.Length < 7)
782 email = MainConsole.Instance.CmdPrompt("Email", "");
783 else email = cmdparams[6];
784
766 if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName)) 785 if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName))
767 { 786 {
768 CreateUser(firstName, lastName, password, regX, regY); 787 CreateUser(firstName, lastName, password, email, regX, regY);
769 } 788 }
770 else 789 else
771 { 790 {
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index fc531f5..608de06 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -298,9 +298,9 @@ namespace OpenSim
298 m_assetCache = new AssetCache(assetServer); 298 m_assetCache = new AssetCache(assetServer);
299 } 299 }
300 300
301 public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, uint regX, uint regY) 301 public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, string email, uint regX, uint regY)
302 { 302 {
303 return m_commsManager.AddUser(tempfirstname, templastname, tempPasswd, regX, regY); 303 return m_commsManager.AddUser(tempfirstname, templastname, tempPasswd, email, regX, regY);
304 } 304 }
305 305
306 /// <summary> 306 /// <summary>
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 9caeda4..81cbbb4 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.Local
94 //no current user account so make one 94 //no current user account so make one
95 m_log.Info("[LOGIN]: No user account found so creating a new one."); 95 m_log.Info("[LOGIN]: No user account found so creating a new one.");
96 96
97 m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); 97 m_userManager.AddUserProfile(firstname, lastname, "test", "", defaultHomeX, defaultHomeY);
98 98
99 profile = m_userManager.GetUserProfile(firstname, lastname); 99 profile = m_userManager.GetUserProfile(firstname, lastname);
100 if (profile != null) 100 if (profile != null)
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index c0887df..8649d61 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.Communications.Local
72 } 72 }
73 73
74 Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); 74 Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
75 AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY); 75 AddUserProfile(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY);
76 76
77 profile = GetUserProfile(firstName, lastName); 77 profile = GetUserProfile(firstName, lastName);
78 78
diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
index 1c86c2f..e3e69b0 100644
--- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
@@ -530,7 +530,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
530 // get seed capagentData.firstname = FirstName;agentData.lastname = LastName; 530 // get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
531 if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode) 531 if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
532 { 532 {
533 homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID); 533 homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), "", homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID);
534 UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID); 534 UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID);
535 if (userProfile2 != null) 535 if (userProfile2 != null)
536 { 536 {