aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs145
1 files changed, 28 insertions, 117 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 4bf6712..6465db2 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -102,7 +102,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
102 availableMethods["admin_restart"] = XmlRpcRestartMethod; 102 availableMethods["admin_restart"] = XmlRpcRestartMethod;
103 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; 103 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
104 availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; 104 availableMethods["admin_create_user"] = XmlRpcCreateUserMethod;
105 availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethodEmail; 105 availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod;
106 availableMethods["admin_exists_user"] = XmlRpcUserExistsMethod; 106 availableMethods["admin_exists_user"] = XmlRpcUserExistsMethod;
107 availableMethods["admin_update_user"] = XmlRpcUpdateUserAccountMethod; 107 availableMethods["admin_update_user"] = XmlRpcUpdateUserAccountMethod;
108 availableMethods["admin_load_xml"] = XmlRpcLoadXMLMethod; 108 availableMethods["admin_load_xml"] = XmlRpcLoadXMLMethod;
@@ -692,6 +692,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
692 /// <description>avatar's last name</description></item> 692 /// <description>avatar's last name</description></item>
693 /// <item><term>user_password</term> 693 /// <item><term>user_password</term>
694 /// <description>avatar's password</description></item> 694 /// <description>avatar's password</description></item>
695 /// <item><term>user_email</term>
696 /// <description>email of the avatar's owner (optional)</description></item>
695 /// <item><term>start_region_x</term> 697 /// <item><term>start_region_x</term>
696 /// <description>avatar's start region coordinates, X value</description></item> 698 /// <description>avatar's start region coordinates, X value</description></item>
697 /// <item><term>start_region_y</term> 699 /// <item><term>start_region_y</term>
@@ -739,121 +741,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
739 string firstname = (string) requestData["user_firstname"]; 741 string firstname = (string) requestData["user_firstname"];
740 string lastname = (string) requestData["user_lastname"]; 742 string lastname = (string) requestData["user_lastname"];
741 string passwd = (string) requestData["user_password"]; 743 string passwd = (string) requestData["user_password"];
742 string email = ""; //Empty string for email
743 uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); 744 uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
744 uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); 745 uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
745 746
746 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 747 string email = ""; // empty string for email
747 if (null != userProfile) 748 if (requestData.Contains("user_email"))
748 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 749 email = (string)requestData["user_email"];
749
750 UUID userID = m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname,
751 passwd, email, regX, regY);
752
753 if (userID == UUID.Zero)
754 throw new Exception(String.Format("failed to create new user {0} {1}",
755 firstname, lastname));
756
757 responseData["success"] = "true";
758 responseData["avatar_uuid"] = userID.ToString();
759
760 response.Value = responseData;
761 750
762 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); 751 UserProfileData userProfile =
763 }
764 catch (Exception e)
765 {
766 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
767 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
768
769 responseData["success"] = "false";
770 responseData["avatar_uuid"] = UUID.Zero.ToString();
771 responseData["error"] = e.Message;
772
773 response.Value = responseData;
774 }
775 return response;
776 }
777 }
778
779 /// <summary>
780 /// Create a new user account.
781 /// <summary>
782 /// <param name="request">incoming XML RPC request</param>
783 /// <remarks>
784 /// XmlRpcCreateUserMethod takes the following XMLRPC
785 /// parameters
786 /// <list type="table">
787 /// <listheader><term>parameter name</term><description>description</description></listheader>
788 /// <item><term>password</term>
789 /// <description>admin password as set in OpenSim.ini</description></item>
790 /// <item><term>user_firstname</term>
791 /// <description>avatar's first name</description></item>
792 /// <item><term>user_lastname</term>
793 /// <description>avatar's last name</description></item>
794 /// <item><term>user_password</term>
795 /// <description>avatar's password</description></item>
796 /// <item><term>start_region_x</term>
797 /// <description>avatar's start region coordinates, X value</description></item>
798 /// <item><term>start_region_y</term>
799 /// <description>avatar's start region coordinates, Y value</description></item>
800 /// <item><term>user_email</term>
801 /// <description>email of avatar</description></item>
802 /// </list>
803 ///
804 /// XmlRpcCreateUserMethod returns
805 /// <list type="table">
806 /// <listheader><term>name</term><description>description</description></listheader>
807 /// <item><term>success</term>
808 /// <description>true or false</description></item>
809 /// <item><term>error</term>
810 /// <description>error message if success is false</description></item>
811 /// <item><term>avatar_uuid</term>
812 /// <description>UUID of the newly created avatar
813 /// account; UUID.Zero if failed.
814 /// </description></item>
815 /// </list>
816 /// </remarks>
817 public XmlRpcResponse XmlRpcCreateUserMethodEmail(XmlRpcRequest request)
818 {
819 m_log.Info("[RADMIN]: CreateUser: new request");
820 XmlRpcResponse response = new XmlRpcResponse();
821 Hashtable responseData = new Hashtable();
822
823 lock (this)
824 {
825 try
826 {
827 Hashtable requestData = (Hashtable) request.Params[0];
828
829 // check completeness
830 checkStringParameters(request, new string[]
831 {
832 "password", "user_firstname",
833 "user_lastname", "user_password", "user_email"
834 });
835 checkIntegerParams(request, new string[] {"start_region_x", "start_region_y"});
836
837 // check password
838 if (!String.IsNullOrEmpty(requiredPassword) &&
839 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
840
841 // do the job
842 string firstname = (string) requestData["user_firstname"];
843 string lastname = (string) requestData["user_lastname"];
844 string passwd = (string) requestData["user_password"];
845 string email = (string) requestData["user_email"];
846 uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
847 uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
848
849 UserProfileData userProfile =
850 m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 752 m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
851 if (null != userProfile) 753 if (null != userProfile)
852 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 754 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
853 755
854 UUID userID 756 UUID userID =
855 = m_app.CommunicationsManager.UserAdminService.AddUser( 757 m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname,
856 firstname, lastname, passwd, email, regX, regY); 758 passwd, email, regX, regY);
857 759
858 if (userID == UUID.Zero) 760 if (userID == UUID.Zero)
859 throw new Exception(String.Format("failed to create new user {0} {1}", 761 throw new Exception(String.Format("failed to create new user {0} {1}",
@@ -954,12 +856,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
954 } 856 }
955 857
956 /// <summary> 858 /// <summary>
957 /// Update the password of a user account. 859 /// Update a user account.
958 /// <summary> 860 /// <summary>
959 /// <param name="request">incoming XML RPC request</param> 861 /// <param name="request">incoming XML RPC request</param>
960 /// <remarks> 862 /// <remarks>
961 /// XmlRpcUpdateUserAccountMethod takes the following XMLRPC 863 /// XmlRpcUpdateUserAccountMethod takes the following XMLRPC
962 /// parameters 864 /// parameters (changeable ones are optional)
963 /// <list type="table"> 865 /// <list type="table">
964 /// <listheader><term>parameter name</term><description>description</description></listheader> 866 /// <listheader><term>parameter name</term><description>description</description></listheader>
965 /// <item><term>password</term> 867 /// <item><term>password</term>
@@ -976,6 +878,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
976 /// <item><term>start_region_y</term> 878 /// <item><term>start_region_y</term>
977 /// <description>avatar's start region coordinates, Y 879 /// <description>avatar's start region coordinates, Y
978 /// value (changeable)</description></item> 880 /// value (changeable)</description></item>
881 /// <item><term>about_real_world</term>
882 /// <description>"about" text of avatar owner (changeable)</description></item>
883 /// <item><term>about_virtual_world</term>
884 /// <description>"about" text of avatar (changeable)</description></item>
979 /// </list> 885 /// </list>
980 /// 886 ///
981 /// XmlRpcCreateUserMethod returns 887 /// XmlRpcCreateUserMethod returns
@@ -1000,11 +906,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1000 Hashtable requestData = (Hashtable) request.Params[0]; 906 Hashtable requestData = (Hashtable) request.Params[0];
1001 907
1002 // check completeness 908 // check completeness
1003 checkStringParameters(request, new string[] 909 checkStringParameters(request, new string[] {
1004 { 910 "password", "user_firstname",
1005 "password", "user_firstname", 911 "user_lastname"});
1006 "user_lastname"
1007 });
1008 912
1009 // check password 913 // check password
1010 if (!String.IsNullOrEmpty(requiredPassword) && 914 if (!String.IsNullOrEmpty(requiredPassword) &&
@@ -1014,7 +918,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1014 string firstname = (string) requestData["user_firstname"]; 918 string firstname = (string) requestData["user_firstname"];
1015 string lastname = (string) requestData["user_lastname"]; 919 string lastname = (string) requestData["user_lastname"];
1016 920
1017
1018 string passwd = String.Empty; 921 string passwd = String.Empty;
1019 uint? regX = null; 922 uint? regX = null;
1020 uint? regY = null; 923 uint? regY = null;
@@ -1024,7 +927,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1024 uint? usaX = null; 927 uint? usaX = null;
1025 uint? usaY = null; 928 uint? usaY = null;
1026 uint? usaZ = null; 929 uint? usaZ = null;
1027 930 string aboutFirstLive = String.Empty;
931 string aboutAvatar = String.Empty;
1028 932
1029 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; 933 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
1030 if (requestData.ContainsKey("start_region_x")) 934 if (requestData.ContainsKey("start_region_x"))
@@ -1045,6 +949,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1045 usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); 949 usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
1046 if (requestData.ContainsKey("start_standat_z")) 950 if (requestData.ContainsKey("start_standat_z"))
1047 usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); 951 usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
952 if (requestData.ContainsKey("about_real_world"))
953 aboutFirstLive = (string)requestData["about_real_world"];
954 if (requestData.ContainsKey("about_virtual_world"))
955 aboutAvatar = (string)requestData["about_virtual_world"];
1048 956
1049 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 957 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
1050 958
@@ -1068,6 +976,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1068 if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; 976 if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
1069 if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; 977 if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
1070 978
979 if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive;
980 if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar;
981
1071 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) 982 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
1072 throw new Exception("did not manage to update user profile"); 983 throw new Exception("did not manage to update user profile");
1073 984