aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenGridServices.UserServer/Main.cs30
-rw-r--r--OpenSim.Framework/UserProfileManagerBase.cs20
2 files changed, 46 insertions, 4 deletions
diff --git a/OpenGridServices.UserServer/Main.cs b/OpenGridServices.UserServer/Main.cs
index 53d3fb1..d7d6102 100644
--- a/OpenGridServices.UserServer/Main.cs
+++ b/OpenGridServices.UserServer/Main.cs
@@ -107,9 +107,35 @@ namespace OpenGridServices.UserServer
107 m_console.WriteLine("shutdown - shutdown the grid (USE CAUTION!)"); 107 m_console.WriteLine("shutdown - shutdown the grid (USE CAUTION!)");
108 break; 108 break;
109 109
110 case "shutdown": 110 case "create user":
111 m_console.WriteLine("Creating new user profile");
112 string tempfirstname;
113 string templastname;
114 string tempMD5Passwd;
115
116 tempfirstname=m_console.CmdPrompt("First name: ");
117 templastname=m_console.CmdPrompt("Last name: ");
118 tempMD5Passwd=m_console.PasswdPrompt("Password: ");
119
120 System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
121 byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
122 bs = x.ComputeHash(bs);
123 System.Text.StringBuilder s = new System.Text.StringBuilder();
124 foreach (byte b in bs)
125 {
126 s.Append(b.ToString("x2").ToLower());
127 }
128 tempMD5Passwd = "$1$" + s.ToString();
129
130 UserProfile newuser=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd);
131 newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
132 newuser.homepos = new LLVector3(128f,128f,23f);
133 _profilemanager.SaveUserProfiles();
134 break;
135
136 case "shutdown":
111 m_console.Close(); 137 m_console.Close();
112 Environment.Exit(0); 138 Environment.Exit(0);
113 break; 139 break;
114 } 140 }
115 } 141 }
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs
index 73f325d..c022feb 100644
--- a/OpenSim.Framework/UserProfileManagerBase.cs
+++ b/OpenSim.Framework/UserProfileManagerBase.cs
@@ -28,6 +28,22 @@ namespace OpenSim.Framework.User
28 db.Close(); 28 db.Close();
29 } 29 }
30 30
31 public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT!
32 {
33 IObjectContainer db;
34 db = Db4oFactory.OpenFile("userprofiles.yap");
35 IObjectSet result = db.Get(typeof(UserProfile));
36 foreach (UserProfile userprof in result) {
37 db.Delete(userprof);
38 db.Commit();
39 }
40 foreach (UserProfile userprof in UserProfiles.Values) {
41 db.Set(userprof);
42 db.Commit();
43 }
44 db.Close();
45 }
46
31 public UserProfile GetProfileByName(string firstname, string lastname) 47 public UserProfile GetProfileByName(string firstname, string lastname)
32 { 48 {
33 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) 49 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
@@ -86,8 +102,8 @@ namespace OpenSim.Framework.User
86 newprofile.UUID = LLUUID.Random(); 102 newprofile.UUID = LLUUID.Random();
87 newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); 103 newprofile.Inventory.CreateRootFolder(newprofile.UUID, true);
88 this.UserProfiles.Add(newprofile.UUID, newprofile); 104 this.UserProfiles.Add(newprofile.UUID, newprofile);
89 return newprofile; 105 return newprofile;
90 } 106 }
91 107
92 public virtual AgentInventory GetUsersInventory(LLUUID agentID) 108 public virtual AgentInventory GetUsersInventory(LLUUID agentID)
93 { 109 {