aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs106
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs7
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs11
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs6
4 files changed, 125 insertions, 5 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 2239001..e3a0321 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -86,6 +86,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
86 m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); 86 m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
87 m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod); 87 m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod);
88 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod); 88 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod);
89 m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod);
89 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod); 90 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod);
90 } 91 }
91 } 92 }
@@ -564,6 +565,111 @@ namespace OpenSim.ApplicationPlugins.RemoteController
564 return response; 565 return response;
565 } 566 }
566 567
568 /// <summary>
569 /// Update the password of a user account.
570 /// <summary>
571 /// <param name="request">incoming XML RPC request</param>
572 /// <remarks>
573 /// XmlRpcUpdateUserAccountMethod takes the following XMLRPC
574 /// parameters
575 /// <list type="table">
576 /// <listheader><term>parameter name</term><description>description</description></listheader>
577 /// <item><term>password</term>
578 /// <description>admin password as set in OpenSim.ini</description></item>
579 /// <item><term>user_firstname</term>
580 /// <description>avatar's first name (cannot be changed)</description></item>
581 /// <item><term>user_lastname</term>
582 /// <description>avatar's last name (cannot be changed)</description></item>
583 /// <item><term>user_password</term>
584 /// <description>avatar's password (changeable)</description></item>
585 /// <item><term>start_region_x</term>
586 /// <description>avatar's start region coordinates, X
587 /// value (changeable)</description></item>
588 /// <item><term>start_region_y</term>
589 /// <description>avatar's start region coordinates, Y
590 /// value (changeable)</description></item>
591 /// </list>
592 ///
593 /// XmlRpcCreateUserMethod returns
594 /// <list type="table">
595 /// <listheader><term>name</term><description>description</description></listheader>
596 /// <item><term>success</term>
597 /// <description>true or false</description></item>
598 /// <item><term>error</term>
599 /// <description>error message if success is false</description></item>
600 /// </list>
601 /// </remarks>
602 public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request)
603 {
604 m_log.Info("[RADMIN]: UpdateUserAccount: new request");
605 XmlRpcResponse response = new XmlRpcResponse();
606 Hashtable responseData = new Hashtable();
607
608 try
609 {
610 Hashtable requestData = (Hashtable) request.Params[0];
611
612 // check completeness
613 checkStringParameters(request, new string[] { "password", "user_firstname",
614 "user_lastname" });
615
616 // check password
617 if (!String.IsNullOrEmpty(requiredPassword) &&
618 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
619
620 // do the job
621 string firstname = (string) requestData["user_firstname"];
622 string lastname = (string) requestData["user_lastname"];
623
624
625 string passwd = String.Empty;
626 uint? regX = null;
627 uint? regY = null;
628
629 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
630 if (requestData.ContainsKey("start_region_x")) regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
631 if (requestData.ContainsKey("start_region_y")) regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
632
633 if (String.Empty == passwd && null == regX && null == regY)
634 throw new Exception("neither user_password nor start_region_x nor start_region_y provided");
635
636 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
637 if (null == userProfile)
638 throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
639
640 if (null != passwd)
641 {
642 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
643 userProfile.PasswordHash = md5PasswdHash;
644 }
645
646 if (null != regX) userProfile.HomeRegionX = (uint)regX;
647 if (null != regY) userProfile.HomeRegionY = (uint)regY;
648
649 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
650 throw new Exception("did not manage to update user profile");
651
652 responseData["success"] = "true";
653
654 response.Value = responseData;
655
656 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", firstname, lastname,
657 userProfile.ID);
658 }
659 catch (Exception e)
660 {
661 m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
662 m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
663
664 responseData["success"] = "false";
665 responseData["error"] = e.Message;
666
667 response.Value = responseData;
668 }
669
670 return response;
671 }
672
567 public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request) 673 public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request)
568 { 674 {
569 m_log.Info("[RADMIN]: Received Load XML Administrator Request"); 675 m_log.Info("[RADMIN]: Received Load XML Administrator Request");
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index 6ad72c0..c1ae0e2 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -64,6 +64,13 @@ namespace OpenSim.Framework.Communications
64 /// <param name="user"></param> 64 /// <param name="user"></param>
65 LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); 65 LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
66 66
67 /// <summary>
68 /// Update the user's profile.
69 /// </summary>
70 /// <param name="data">UserProfileData object with updated data. Should be obtained
71 /// via a call to GetUserProfile().</param>
72 /// <returns>true if the update could be applied, false if it could not be applied.</returns>
73 bool UpdateUserProfile(UserProfileData data);
67 74
68 /// <summary> 75 /// <summary>
69 /// Adds a new friend to the database for XUser 76 /// Adds a new friend to the database for XUser
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index d5b1e74..1b73152 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -153,11 +153,11 @@ namespace OpenSim.Framework.Communications
153 } 153 }
154 154
155 /// <summary> 155 /// <summary>
156 /// Set's user profile from data object 156 /// Updates a user profile from data object
157 /// </summary> 157 /// </summary>
158 /// <param name="data"></param> 158 /// <param name="data"></param>
159 /// <returns></returns> 159 /// <returns></returns>
160 public bool SetUserProfile(UserProfileData data) 160 public bool UpdateUserProfile(UserProfileData data)
161 { 161 {
162 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 162 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
163 { 163 {
@@ -168,7 +168,8 @@ namespace OpenSim.Framework.Communications
168 } 168 }
169 catch (Exception e) 169 catch (Exception e)
170 { 170 {
171 m_log.Info("[USERSTORAGE]: Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); 171 m_log.InfoFormat("[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", data.FirstName, data.SurName,
172 plugin.Key, e.ToString());
172 } 173 }
173 } 174 }
174 return false; 175 return false;
@@ -352,7 +353,7 @@ namespace OpenSim.Framework.Communications
352 UserProfileData profile = GetUserProfile(agentID); 353 UserProfileData profile = GetUserProfile(agentID);
353 profile.CurrentAgent = null; 354 profile.CurrentAgent = null;
354 355
355 SetUserProfile(profile); 356 UpdateUserProfile(profile);
356 } 357 }
357 358
358 359
@@ -539,7 +540,7 @@ namespace OpenSim.Framework.Communications
539 // TODO: what is the logic should be? 540 // TODO: what is the logic should be?
540 bool ret = false; 541 bool ret = false;
541 ret = AddUserAgent(profile.CurrentAgent); 542 ret = AddUserAgent(profile.CurrentAgent);
542 ret = ret & SetUserProfile(profile); 543 ret = ret & UpdateUserProfile(profile);
543 return ret; 544 return ret;
544 } 545 }
545 546
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 307751e..852fe5b 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -437,6 +437,12 @@ namespace OpenSim.Region.Communications.OGS1
437 throw new Exception("The method or operation is not implemented."); 437 throw new Exception("The method or operation is not implemented.");
438 } 438 }
439 439
440 // TODO
441 public bool UpdateUserProfile(UserProfileData data)
442 {
443 return false;
444 }
445
440 public bool UpdateUserProfileProperties(UserProfileData UserProfile) 446 public bool UpdateUserProfileProperties(UserProfileData UserProfile)
441 { 447 {
442 m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile."); 448 m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile.");