aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGridServices.UserServer/Main.cs
diff options
context:
space:
mode:
authorMW2007-05-25 16:27:07 +0000
committerMW2007-05-25 16:27:07 +0000
commitb2d588ed1c9068324333ec3c5ab86efe6a36216d (patch)
tree950442d2af673e1df34e85ca5b8265ddd6c99906 /OpenGridServices/OpenGridServices.UserServer/Main.cs
parentOops (diff)
downloadopensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.zip
opensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.tar.gz
opensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.tar.bz2
opensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.tar.xz
Possible my last ever OpenSim/OGS contribution (if I continue to feel like this):
Re-added a CLI "create user" command to the userserver, only currently works if using DB4o as the database provider. Added Xml config files to both the UserServer and Gridserver (UserServerConfig.xml and GridServerConfig.xml), so that the database provider can be set in it. (both currently default to DB4o , so maybe Adam will want to change it back to defaulting to MySQL)
Diffstat (limited to '')
-rw-r--r--OpenGridServices/OpenGridServices.UserServer/Main.cs56
1 files changed, 38 insertions, 18 deletions
diff --git a/OpenGridServices/OpenGridServices.UserServer/Main.cs b/OpenGridServices/OpenGridServices.UserServer/Main.cs
index 0eb314b..aec80dc 100644
--- a/OpenGridServices/OpenGridServices.UserServer/Main.cs
+++ b/OpenGridServices/OpenGridServices.UserServer/Main.cs
@@ -40,6 +40,8 @@ using OpenSim.Framework.Inventory;
40using OpenSim.Framework.Interfaces; 40using OpenSim.Framework.Interfaces;
41using OpenSim.Framework.Console; 41using OpenSim.Framework.Console;
42using OpenSim.Servers; 42using OpenSim.Servers;
43using OpenSim.Framework.Utilities;
44using OpenSim.GenericConfig;
43 45
44namespace OpenGridServices.UserServer 46namespace OpenGridServices.UserServer
45{ 47{
@@ -48,8 +50,9 @@ namespace OpenGridServices.UserServer
48 public class OpenUser_Main : BaseServer, conscmd_callback 50 public class OpenUser_Main : BaseServer, conscmd_callback
49 { 51 {
50 private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; 52 private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll";
51 private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll"; 53 private string StorageDll = "OpenGrid.Framework.Data.DB4o.dll";
52 private UserConfig Cfg; 54 private UserConfig Cfg;
55 protected IGenericConfig localXMLConfig;
53 56
54 public UserManager m_userManager; // Replaces below. 57 public UserManager m_userManager; // Replaces below.
55 58
@@ -88,6 +91,11 @@ namespace OpenGridServices.UserServer
88 91
89 public void Startup() 92 public void Startup()
90 { 93 {
94 this.localXMLConfig = new XmlConfig("UserServerConfig.xml");
95 this.localXMLConfig.LoadData();
96 this.ConfigDB(this.localXMLConfig);
97 this.localXMLConfig.Close();
98
91 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); 99 MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration");
92 Cfg = this.LoadConfigDll(this.ConfigDll); 100 Cfg = this.LoadConfigDll(this.ConfigDll);
93 Cfg.InitConfig(); 101 Cfg.InitConfig();
@@ -112,33 +120,22 @@ namespace OpenGridServices.UserServer
112 switch (what) 120 switch (what)
113 { 121 {
114 case "user": 122 case "user":
115 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Commandline user creation is currently disabled.");
116 break;
117 /*
118 string tempfirstname; 123 string tempfirstname;
119 string templastname; 124 string templastname;
120 string tempMD5Passwd; 125 string tempMD5Passwd;
126 uint regX = 997;
127 uint regY = 996;
121 128
122 tempfirstname = m_console.CmdPrompt("First name"); 129 tempfirstname = m_console.CmdPrompt("First name");
123 templastname = m_console.CmdPrompt("Last name"); 130 templastname = m_console.CmdPrompt("Last name");
124 tempMD5Passwd = m_console.PasswdPrompt("Password"); 131 tempMD5Passwd = m_console.PasswdPrompt("Password");
132 regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
133 regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
125 134
126 System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider(); 135 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
127 byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
128 bs = x.ComputeHash(bs);
129 System.Text.StringBuilder s = new System.Text.StringBuilder();
130 foreach (byte b in bs)
131 {
132 s.Append(b.ToString("x2").ToLower());
133 }
134 tempMD5Passwd = s.ToString();
135 136
136 UserProfile newuser = m_userProfileManager.CreateNewProfile(tempfirstname, templastname, tempMD5Passwd); 137 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
137 newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
138 newuser.homepos = new LLVector3(128f, 128f, 150f);
139 m_userProfileManager.SaveUserProfiles();
140 break; 138 break;
141 */
142 } 139 }
143 } 140 }
144 141
@@ -162,6 +159,29 @@ namespace OpenGridServices.UserServer
162 } 159 }
163 } 160 }
164 161
162 private void ConfigDB(IGenericConfig configData)
163 {
164 try
165 {
166 string attri = "";
167 attri = configData.GetAttribute("DataBaseProvider");
168 if (attri == "")
169 {
170 StorageDll = "OpenGrid.Framework.Data.DB4o.dll";
171 configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll");
172 }
173 else
174 {
175 StorageDll = attri;
176 }
177 configData.Commit();
178 }
179 catch (Exception e)
180 {
181
182 }
183 }
184
165 private UserConfig LoadConfigDll(string dllName) 185 private UserConfig LoadConfigDll(string dllName)
166 { 186 {
167 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 187 Assembly pluginAssembly = Assembly.LoadFrom(dllName);