aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-14 19:59:32 +0000
committerMelanie Thielker2008-08-14 19:59:32 +0000
commit7161689a97edcdeceee3d3eeeaee7eadc4e06a89 (patch)
treea6b77bb4cb8598ce3075f8b5e58895fe0f7a0363 /OpenSim
parentMake the estate owner work. Changes permissions checks to allow the (diff)
downloadopensim-SC_OLD-7161689a97edcdeceee3d3eeeaee7eadc4e06a89.zip
opensim-SC_OLD-7161689a97edcdeceee3d3eeeaee7eadc4e06a89.tar.gz
opensim-SC_OLD-7161689a97edcdeceee3d3eeeaee7eadc4e06a89.tar.bz2
opensim-SC_OLD-7161689a97edcdeceee3d3eeeaee7eadc4e06a89.tar.xz
Adds UserFlags and GodLevel to the user data store and plumbs then in.
This will have no effect unless both the UGAI and the region are this revision or later
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLManager.cs15
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs2
-rw-r--r--OpenSim/Data/MySQL/Resources/003_UserStore.sql6
-rw-r--r--OpenSim/Data/SQLite/Resources/003_UserStore.sql6
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs6
-rw-r--r--OpenSim/Framework/UserProfileData.cs20
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs25
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs7
8 files changed, 82 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs
index 297b1a7..5e9e259 100644
--- a/OpenSim/Data/MySQL/MySQLManager.cs
+++ b/OpenSim/Data/MySQL/MySQLManager.cs
@@ -587,6 +587,9 @@ namespace OpenSim.Data.MySQL
587 LLUUID.TryParse((string)reader["webLoginKey"], out tmp); 587 LLUUID.TryParse((string)reader["webLoginKey"], out tmp);
588 retval.WebLoginKey = tmp; 588 retval.WebLoginKey = tmp;
589 } 589 }
590
591 retval.UserFlags = Convert.ToInt32(reader["userFlags"].ToString());
592 retval.GodLevel = Convert.ToInt32(reader["godLevel"].ToString());
590 593
591 } 594 }
592 else 595 else
@@ -728,14 +731,14 @@ namespace OpenSim.Data.MySQL
728 "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; 731 "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
729 sql += 732 sql +=
730 "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; 733 "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
731 sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`) VALUES "; 734 sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`) VALUES ";
732 735
733 sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; 736 sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
734 sql += 737 sql +=
735 "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; 738 "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
736 sql += 739 sql +=
737 "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; 740 "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
738 sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey)"; 741 sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel)";
739 742
740 Dictionary<string, string> parameters = new Dictionary<string, string>(); 743 Dictionary<string, string> parameters = new Dictionary<string, string>();
741 parameters["?UUID"] = uuid.ToString(); 744 parameters["?UUID"] = uuid.ToString();
@@ -761,6 +764,9 @@ namespace OpenSim.Data.MySQL
761 parameters["?profileImage"] = profileImage.ToString(); 764 parameters["?profileImage"] = profileImage.ToString();
762 parameters["?profileFirstImage"] = firstImage.ToString(); 765 parameters["?profileFirstImage"] = firstImage.ToString();
763 parameters["?webLoginKey"] = string.Empty; 766 parameters["?webLoginKey"] = string.Empty;
767 parameters["?userFlags"] = "0";
768 parameters["?godLevel"] = "0";
769
764 770
765 bool returnval = false; 771 bool returnval = false;
766 772
@@ -815,7 +821,7 @@ namespace OpenSim.Data.MySQL
815 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, 821 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
816 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, 822 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
817 string aboutText, string firstText, 823 string aboutText, string firstText,
818 LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey) 824 LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey, int userFlags, int godLevel)
819 { 825 {
820 string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname "; 826 string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname ";
821 sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , "; 827 sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
@@ -827,6 +833,7 @@ namespace OpenSim.Data.MySQL
827 sql += "`profileCanDoMask` = ?profileCanDoMask , `profileWantDoMask` = ?profileWantDoMask , "; 833 sql += "`profileCanDoMask` = ?profileCanDoMask , `profileWantDoMask` = ?profileWantDoMask , ";
828 sql += "`profileAboutText` = ?profileAboutText , `profileFirstText` = ?profileFirstText, "; 834 sql += "`profileAboutText` = ?profileAboutText , `profileFirstText` = ?profileFirstText, ";
829 sql += "`profileImage` = ?profileImage , `profileFirstImage` = ?profileFirstImage , "; 835 sql += "`profileImage` = ?profileImage , `profileFirstImage` = ?profileFirstImage , ";
836 sql += "`userFlags` = ?userFlags , `godLevel` = ?godLevel , ";
830 sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID"; 837 sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID";
831 838
832 Dictionary<string, string> parameters = new Dictionary<string, string>(); 839 Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -854,6 +861,8 @@ namespace OpenSim.Data.MySQL
854 parameters["?profileImage"] = profileImage.ToString(); 861 parameters["?profileImage"] = profileImage.ToString();
855 parameters["?profileFirstImage"] = firstImage.ToString(); 862 parameters["?profileFirstImage"] = firstImage.ToString();
856 parameters["?webLoginKey"] = webLoginKey.ToString(); 863 parameters["?webLoginKey"] = webLoginKey.ToString();
864 parameters["?userFlags"] = userFlags.ToString();
865 parameters["?godLevel"] = userFlags.ToString();
857 866
858 bool returnval = false; 867 bool returnval = false;
859 try 868 try
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index d7bf2a8..b7f4cbd 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -685,7 +685,7 @@ namespace OpenSim.Data.MySQL
685 user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, user.HomeLocation.Z, user.HomeLookAt.X, 685 user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, user.HomeLocation.Z, user.HomeLookAt.X,
686 user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, user.UserInventoryURI, 686 user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, user.UserInventoryURI,
687 user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText, 687 user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText,
688 user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey); 688 user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel);
689 } 689 }
690 690
691 return true; 691 return true;
diff --git a/OpenSim/Data/MySQL/Resources/003_UserStore.sql b/OpenSim/Data/MySQL/Resources/003_UserStore.sql
new file mode 100644
index 0000000..6f890ee
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/003_UserStore.sql
@@ -0,0 +1,6 @@
1BEGIN;
2
3ALTER TABLE users add userFlags integer NOT NULL default 0;
4ALTER TABLE users add godLevel integer NOT NULL default 0;
5
6COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/003_UserStore.sql b/OpenSim/Data/SQLite/Resources/003_UserStore.sql
new file mode 100644
index 0000000..6f890ee
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/003_UserStore.sql
@@ -0,0 +1,6 @@
1BEGIN;
2
3ALTER TABLE users add userFlags integer NOT NULL default 0;
4ALTER TABLE users add godLevel integer NOT NULL default 0;
5
6COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 21c9dbc..c55eee8 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -681,6 +681,8 @@ namespace OpenSim.Data.SQLite
681 SQLiteUtil.createCol(users, "profileImage", typeof (String)); 681 SQLiteUtil.createCol(users, "profileImage", typeof (String));
682 SQLiteUtil.createCol(users, "profileFirstImage", typeof (String)); 682 SQLiteUtil.createCol(users, "profileFirstImage", typeof (String));
683 SQLiteUtil.createCol(users, "webLoginKey", typeof(String)); 683 SQLiteUtil.createCol(users, "webLoginKey", typeof(String));
684 SQLiteUtil.createCol(users, "userFlags", typeof (Int32));
685 SQLiteUtil.createCol(users, "godLevel", typeof (Int32));
684 // Add in contraints 686 // Add in contraints
685 users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]}; 687 users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
686 return users; 688 return users;
@@ -789,6 +791,8 @@ namespace OpenSim.Data.SQLite
789 LLUUID.TryParse((String)row["profileFirstImage"], out tmp); 791 LLUUID.TryParse((String)row["profileFirstImage"], out tmp);
790 user.FirstLifeImage = tmp; 792 user.FirstLifeImage = tmp;
791 user.WebLoginKey = new LLUUID((String) row["webLoginKey"]); 793 user.WebLoginKey = new LLUUID((String) row["webLoginKey"]);
794 user.UserFlags = Convert.ToInt32(row["userFlags"]);
795 user.GodLevel = Convert.ToInt32(row["godLevel"]);
792 796
793 return user; 797 return user;
794 } 798 }
@@ -829,6 +833,8 @@ namespace OpenSim.Data.SQLite
829 row["profileImage"] = user.Image; 833 row["profileImage"] = user.Image;
830 row["profileFirstImage"] = user.FirstLifeImage; 834 row["profileFirstImage"] = user.FirstLifeImage;
831 row["webLoginKey"] = user.WebLoginKey; 835 row["webLoginKey"] = user.WebLoginKey;
836 row["userFlags"] = user.UserFlags;
837 row["godLevel"] = user.GodLevel;
832 838
833 // ADO.NET doesn't handle NULL very well 839 // ADO.NET doesn't handle NULL very well
834 foreach (DataColumn col in ds.Tables["users"].Columns) 840 foreach (DataColumn col in ds.Tables["users"].Columns)
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index 2b0e15f..ec9c473 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -136,6 +136,12 @@ namespace OpenSim.Framework
136 /// </summary> 136 /// </summary>
137 private LLUUID _webLoginKey; 137 private LLUUID _webLoginKey;
138 138
139 // Data for estates and other goodies
140 // to get away from per-machine configs a little
141 //
142 private int _userFlags;
143 private int _godLevel;
144
139 /// <summary> 145 /// <summary>
140 /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into 146 /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into
141 /// </summary> 147 /// </summary>
@@ -330,5 +336,17 @@ namespace OpenSim.Framework
330 get { return _currentAgent; } 336 get { return _currentAgent; }
331 set { _currentAgent = value; } 337 set { _currentAgent = value; }
332 } 338 }
339
340 public virtual int UserFlags
341 {
342 get { return _userFlags; }
343 set { _userFlags = value; }
344 }
345
346 public virtual int GodLevel
347 {
348 get { return _godLevel; }
349 set { _godLevel = value; }
350 }
333 } 351 }
334} \ No newline at end of file 352}
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 36f2a0d..5506631 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -156,6 +156,9 @@ namespace OpenSim.Grid.UserServer
156 responseData["home_look_x"] = profile.HomeLookAt.X.ToString(); 156 responseData["home_look_x"] = profile.HomeLookAt.X.ToString();
157 responseData["home_look_y"] = profile.HomeLookAt.Y.ToString(); 157 responseData["home_look_y"] = profile.HomeLookAt.Y.ToString();
158 responseData["home_look_z"] = profile.HomeLookAt.Z.ToString(); 158 responseData["home_look_z"] = profile.HomeLookAt.Z.ToString();
159
160 responseData["user_flags"] = profile.UserFlags.ToString();
161 responseData["god_level"] = profile.GodLevel.ToString();
159 response.Value = responseData; 162 response.Value = responseData;
160 163
161 return response; 164 return response;
@@ -638,6 +641,28 @@ namespace OpenSim.Grid.UserServer
638 m_log.Error("[PROFILE]:Failed to set home lookat z"); 641 m_log.Error("[PROFILE]:Failed to set home lookat z");
639 } 642 }
640 } 643 }
644 if (requestData.Contains("user_flags"))
645 {
646 try
647 {
648 userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]);
649 }
650 catch (InvalidCastException)
651 {
652 m_log.Error("[PROFILE]:Failed to set user flags");
653 }
654 }
655 if (requestData.Contains("god_level"))
656 {
657 try
658 {
659 userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]);
660 }
661 catch (InvalidCastException)
662 {
663 m_log.Error("[PROFILE]:Failed to set god level");
664 }
665 }
641 // call plugin! 666 // call plugin!
642 bool ret = UpdateUserProfileProperties(userProfile); 667 bool ret = UpdateUserProfileProperties(userProfile);
643 responseData["returnString"] = ret.ToString(); 668 responseData["returnString"] = ret.ToString();
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 2d37e2f..ee5c7bb 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -85,6 +85,11 @@ namespace OpenSim.Region.Communications.OGS1
85 new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]), 85 new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
86 (float) Convert.ToDecimal((string) data["home_look_y"]), 86 (float) Convert.ToDecimal((string) data["home_look_y"]),
87 (float) Convert.ToDecimal((string) data["home_look_z"])); 87 (float) Convert.ToDecimal((string) data["home_look_z"]));
88 if(data.Contains("user_flags"))
89 userData.UserFlags = Convert.ToInt32((string) data["user_flags"]);
90 if(data.Contains("god_level"))
91 userData.GodLevel = Convert.ToInt32((string) data["god_level"]);
92
88 return userData; 93 return userData;
89 } 94 }
90 95
@@ -462,6 +467,8 @@ namespace OpenSim.Region.Communications.OGS1
462 param["home_look_x"] = UserProfile.HomeLookAtX.ToString(); 467 param["home_look_x"] = UserProfile.HomeLookAtX.ToString();
463 param["home_look_y"] = UserProfile.HomeLookAtY.ToString(); 468 param["home_look_y"] = UserProfile.HomeLookAtY.ToString();
464 param["home_look_z"] = UserProfile.HomeLookAtZ.ToString(); 469 param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
470 param["user_flags"] = UserProfile.UserFlags.ToString();
471 param["god_level"] = UserProfile.GodLevel.ToString();
465 472
466 IList parameters = new ArrayList(); 473 IList parameters = new ArrayList();
467 parameters.Add(param); 474 parameters.Add(param);