aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2008-11-04 14:54:42 +0000
committerSean Dague2008-11-04 14:54:42 +0000
commit702249358badda5413e67ee0267063c2e2a61498 (patch)
tree42775e792f77d391e5ad730b2bb15f65da3e96d1 /OpenSim
parentPrefix LSL variables which are C# keywords with @ instead of _ when translati... (diff)
downloadopensim-SC_OLD-702249358badda5413e67ee0267063c2e2a61498.zip
opensim-SC_OLD-702249358badda5413e67ee0267063c2e2a61498.tar.gz
opensim-SC_OLD-702249358badda5413e67ee0267063c2e2a61498.tar.bz2
opensim-SC_OLD-702249358badda5413e67ee0267063c2e2a61498.tar.xz
implement email field for MySQL and SQLite
From: Sean Dague <sdague@gmail.com>
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLManager.cs29
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs4
-rw-r--r--OpenSim/Data/MySQL/Resources/007_UserStore.sql5
-rw-r--r--OpenSim/Data/SQLite/Resources/008_UserStore.sql5
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs3
-rw-r--r--OpenSim/Data/Tests/BasicUserTest.cs6
-rw-r--r--OpenSim/Framework/UserProfileData.cs2
7 files changed, 37 insertions, 17 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs
index 5f830bb..7096efa 100644
--- a/OpenSim/Data/MySQL/MySQLManager.cs
+++ b/OpenSim/Data/MySQL/MySQLManager.cs
@@ -540,6 +540,7 @@ namespace OpenSim.Data.MySQL
540 retval.ID = id; 540 retval.ID = id;
541 retval.FirstName = (string) reader["username"]; 541 retval.FirstName = (string) reader["username"];
542 retval.SurName = (string) reader["lastname"]; 542 retval.SurName = (string) reader["lastname"];
543 retval.Email = (string) reader["email"];
543 544
544 retval.PasswordHash = (string) reader["passwordHash"]; 545 retval.PasswordHash = (string) reader["passwordHash"];
545 retval.PasswordSalt = (string) reader["passwordSalt"]; 546 retval.PasswordSalt = (string) reader["passwordSalt"];
@@ -768,7 +769,7 @@ namespace OpenSim.Data.MySQL
768 /// <param name="firstImage">UUID for firstlife image</param> 769 /// <param name="firstImage">UUID for firstlife image</param>
769 /// <param name="webLoginKey">Ignored</param> 770 /// <param name="webLoginKey">Ignored</param>
770 /// <returns>Success?</returns> 771 /// <returns>Success?</returns>
771 public bool insertUserRow(UUID uuid, string username, string lastname, string passwordHash, 772 public bool insertUserRow(UUID uuid, string username, string lastname, string email, string passwordHash,
772 string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, 773 string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
773 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, 774 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
774 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, 775 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
@@ -777,14 +778,14 @@ namespace OpenSim.Data.MySQL
777 { 778 {
778 m_log.Debug("[MySQLManager]: Fetching profile for " + uuid.ToString()); 779 m_log.Debug("[MySQLManager]: Fetching profile for " + uuid.ToString());
779 string sql = 780 string sql =
780 "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, "; 781 "INSERT INTO users (`UUID`, `username`, `lastname`, `email`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
781 sql += 782 sql +=
782 "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; 783 "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
783 sql += 784 sql +=
784 "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; 785 "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
785 sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`, `customType`, `partner`) VALUES "; 786 sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`, `customType`, `partner`) VALUES ";
786 787
787 sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; 788 sql += "(?UUID, ?username, ?lastname, ?email, ?passwordHash, ?passwordSalt, ?homeRegion, ";
788 sql += 789 sql +=
789 "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; 790 "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
790 sql += 791 sql +=
@@ -793,10 +794,11 @@ namespace OpenSim.Data.MySQL
793 794
794 Dictionary<string, string> parameters = new Dictionary<string, string>(); 795 Dictionary<string, string> parameters = new Dictionary<string, string>();
795 parameters["?UUID"] = uuid.ToString(); 796 parameters["?UUID"] = uuid.ToString();
796 parameters["?username"] = username.ToString(); 797 parameters["?username"] = username;
797 parameters["?lastname"] = lastname.ToString(); 798 parameters["?lastname"] = lastname;
798 parameters["?passwordHash"] = passwordHash.ToString(); 799 parameters["?email"] = email;
799 parameters["?passwordSalt"] = passwordSalt.ToString(); 800 parameters["?passwordHash"] = passwordHash;
801 parameters["?passwordSalt"] = passwordSalt;
800 parameters["?homeRegion"] = homeRegion.ToString(); 802 parameters["?homeRegion"] = homeRegion.ToString();
801 parameters["?homeLocationX"] = homeLocX.ToString(); 803 parameters["?homeLocationX"] = homeLocX.ToString();
802 parameters["?homeLocationY"] = homeLocY.ToString(); 804 parameters["?homeLocationY"] = homeLocY.ToString();
@@ -869,14 +871,14 @@ namespace OpenSim.Data.MySQL
869 /// <param name="firstImage">UUID for firstlife image</param> 871 /// <param name="firstImage">UUID for firstlife image</param>
870 /// <param name="webLoginKey">UUID for weblogin Key</param> 872 /// <param name="webLoginKey">UUID for weblogin Key</param>
871 /// <returns>Success?</returns> 873 /// <returns>Success?</returns>
872 public bool updateUserRow(UUID uuid, string username, string lastname, string passwordHash, 874 public bool updateUserRow(UUID uuid, string username, string lastname, string email, string passwordHash,
873 string passwordSalt, UInt64 homeRegion, UUID homeRegionID, float homeLocX, float homeLocY, float homeLocZ, 875 string passwordSalt, UInt64 homeRegion, UUID homeRegionID, float homeLocX, float homeLocY, float homeLocZ,
874 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, 876 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
875 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, 877 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
876 string aboutText, string firstText, 878 string aboutText, string firstText,
877 UUID profileImage, UUID firstImage, UUID webLoginKey, int userFlags, int godLevel, string customType, UUID partner) 879 UUID profileImage, UUID firstImage, UUID webLoginKey, int userFlags, int godLevel, string customType, UUID partner)
878 { 880 {
879 string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname "; 881 string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname, `email` = ?email ";
880 sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , "; 882 sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
881 sql += "`homeRegion` = ?homeRegion , `homeRegionID` = ?homeRegionID, `homeLocationX` = ?homeLocationX , "; 883 sql += "`homeRegion` = ?homeRegion , `homeRegionID` = ?homeRegionID, `homeLocationX` = ?homeLocationX , ";
882 sql += "`homeLocationY` = ?homeLocationY , `homeLocationZ` = ?homeLocationZ , "; 884 sql += "`homeLocationY` = ?homeLocationY , `homeLocationZ` = ?homeLocationZ , ";
@@ -892,10 +894,11 @@ namespace OpenSim.Data.MySQL
892 894
893 Dictionary<string, string> parameters = new Dictionary<string, string>(); 895 Dictionary<string, string> parameters = new Dictionary<string, string>();
894 parameters["?UUID"] = uuid.ToString(); 896 parameters["?UUID"] = uuid.ToString();
895 parameters["?username"] = username.ToString(); 897 parameters["?username"] = username;
896 parameters["?lastname"] = lastname.ToString(); 898 parameters["?lastname"] = lastname;
897 parameters["?passwordHash"] = passwordHash.ToString(); 899 parameters["?email"] = email;
898 parameters["?passwordSalt"] = passwordSalt.ToString(); 900 parameters["?passwordHash"] = passwordHash;
901 parameters["?passwordSalt"] = passwordSalt;
899 parameters["?homeRegion"] = homeRegion.ToString(); 902 parameters["?homeRegion"] = homeRegion.ToString();
900 parameters["?homeRegionID"] = homeRegionID.ToString(); 903 parameters["?homeRegionID"] = homeRegionID.ToString();
901 parameters["?homeLocationX"] = homeLocX.ToString(); 904 parameters["?homeLocationX"] = homeLocX.ToString();
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 6baf4b6..47670d2 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -642,7 +642,7 @@ namespace OpenSim.Data.MySQL
642 642
643 try 643 try
644 { 644 {
645 dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, 645 dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
646 user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y, 646 user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y,
647 user.HomeLocation.Z, 647 user.HomeLocation.Z,
648 user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, 648 user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created,
@@ -697,7 +697,7 @@ namespace OpenSim.Data.MySQL
697 MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile"); 697 MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile");
698 try 698 try
699 { 699 {
700 dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, 700 dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
701 user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, 701 user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
702 user.HomeLocation.Z, user.HomeLookAt.X, 702 user.HomeLocation.Z, user.HomeLookAt.X,
703 user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, 703 user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin,
diff --git a/OpenSim/Data/MySQL/Resources/007_UserStore.sql b/OpenSim/Data/MySQL/Resources/007_UserStore.sql
new file mode 100644
index 0000000..3ab5261
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/007_UserStore.sql
@@ -0,0 +1,5 @@
1BEGIN;
2
3ALTER TABLE users add email varchar(250);
4
5COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/008_UserStore.sql b/OpenSim/Data/SQLite/Resources/008_UserStore.sql
new file mode 100644
index 0000000..97da818
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/008_UserStore.sql
@@ -0,0 +1,5 @@
1BEGIN TRANSACTION;
2
3ALTER TABLE users add email varchar(250);
4
5COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 2f0863e..50a1d73 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -710,6 +710,7 @@ namespace OpenSim.Data.SQLite
710 SQLiteUtil.createCol(users, "UUID", typeof (String)); 710 SQLiteUtil.createCol(users, "UUID", typeof (String));
711 SQLiteUtil.createCol(users, "username", typeof (String)); 711 SQLiteUtil.createCol(users, "username", typeof (String));
712 SQLiteUtil.createCol(users, "surname", typeof (String)); 712 SQLiteUtil.createCol(users, "surname", typeof (String));
713 SQLiteUtil.createCol(users, "email", typeof (String));
713 SQLiteUtil.createCol(users, "passwordHash", typeof (String)); 714 SQLiteUtil.createCol(users, "passwordHash", typeof (String));
714 SQLiteUtil.createCol(users, "passwordSalt", typeof (String)); 715 SQLiteUtil.createCol(users, "passwordSalt", typeof (String));
715 716
@@ -812,6 +813,7 @@ namespace OpenSim.Data.SQLite
812 user.ID = tmp; 813 user.ID = tmp;
813 user.FirstName = (String) row["username"]; 814 user.FirstName = (String) row["username"];
814 user.SurName = (String) row["surname"]; 815 user.SurName = (String) row["surname"];
816 user.Email = (String) row["email"];
815 user.PasswordHash = (String) row["passwordHash"]; 817 user.PasswordHash = (String) row["passwordHash"];
816 user.PasswordSalt = (String) row["passwordSalt"]; 818 user.PasswordSalt = (String) row["passwordSalt"];
817 819
@@ -864,6 +866,7 @@ namespace OpenSim.Data.SQLite
864 row["UUID"] = Util.ToRawUuidString(user.ID); 866 row["UUID"] = Util.ToRawUuidString(user.ID);
865 row["username"] = user.FirstName; 867 row["username"] = user.FirstName;
866 row["surname"] = user.SurName; 868 row["surname"] = user.SurName;
869 row["email"] = user.Email;
867 row["passwordHash"] = user.PasswordHash; 870 row["passwordHash"] = user.PasswordHash;
868 row["passwordSalt"] = user.PasswordSalt; 871 row["passwordSalt"] = user.PasswordSalt;
869 872
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs
index 4ca7290..5e6e4da 100644
--- a/OpenSim/Data/Tests/BasicUserTest.cs
+++ b/OpenSim/Data/Tests/BasicUserTest.cs
@@ -135,6 +135,9 @@ namespace OpenSim.Data.Tests
135 Assert.That(user1,Is.EqualTo(u1a.ID)); 135 Assert.That(user1,Is.EqualTo(u1a.ID));
136 Assert.That(user2,Is.EqualTo(u2a.ID)); 136 Assert.That(user2,Is.EqualTo(u2a.ID));
137 Assert.That(user3,Is.EqualTo(u3a.ID)); 137 Assert.That(user3,Is.EqualTo(u3a.ID));
138
139 // and one email test
140 Assert.That(u1.Email, Is.EqualTo(u1a.Email));
138 } 141 }
139 142
140 [Test] 143 [Test]
@@ -296,7 +299,8 @@ namespace OpenSim.Data.Tests
296 u.FirstName = fname; 299 u.FirstName = fname;
297 u.SurName = lname; 300 u.SurName = lname;
298 u.PasswordHash = "NOTAHASH"; 301 u.PasswordHash = "NOTAHASH";
299 u.PasswordSalt = "NOTSALT"; 302 u.PasswordSalt = "NOTSALT";
303 u.Email = "nobody@nodomain.nocc";
300 // MUST specify at least these 5 parameters or an exception is raised 304 // MUST specify at least these 5 parameters or an exception is raised
301 305
302 return u; 306 return u;
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index 6e92b7a..d12ad40 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -124,7 +124,7 @@ namespace OpenSim.Framework
124 /// <summary> 124 /// <summary>
125 /// A valid email address for the account. Useful for password reset requests. 125 /// A valid email address for the account. Useful for password reset requests.
126 /// </summary> 126 /// </summary>
127 private string _email; 127 private string _email = String.Empty;
128 128
129 /// <summary> 129 /// <summary>
130 /// A URI to the users asset server, used for foreigners and large grids. 130 /// A URI to the users asset server, used for foreigners and large grids.