mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
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
This commit is contained in:
@@ -587,6 +587,9 @@ namespace OpenSim.Data.MySQL
|
|||||||
LLUUID.TryParse((string)reader["webLoginKey"], out tmp);
|
LLUUID.TryParse((string)reader["webLoginKey"], out tmp);
|
||||||
retval.WebLoginKey = tmp;
|
retval.WebLoginKey = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retval.UserFlags = Convert.ToInt32(reader["userFlags"].ToString());
|
||||||
|
retval.GodLevel = Convert.ToInt32(reader["godLevel"].ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -728,14 +731,14 @@ namespace OpenSim.Data.MySQL
|
|||||||
"`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
|
"`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
|
||||||
sql +=
|
sql +=
|
||||||
"`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
|
"`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
|
||||||
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`) VALUES ";
|
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`) VALUES ";
|
||||||
|
|
||||||
sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
|
sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
|
||||||
sql +=
|
sql +=
|
||||||
"?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
|
"?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
|
||||||
sql +=
|
sql +=
|
||||||
"?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
|
"?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
|
||||||
sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey)";
|
sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel)";
|
||||||
|
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
parameters["?UUID"] = uuid.ToString();
|
parameters["?UUID"] = uuid.ToString();
|
||||||
@@ -761,6 +764,9 @@ namespace OpenSim.Data.MySQL
|
|||||||
parameters["?profileImage"] = profileImage.ToString();
|
parameters["?profileImage"] = profileImage.ToString();
|
||||||
parameters["?profileFirstImage"] = firstImage.ToString();
|
parameters["?profileFirstImage"] = firstImage.ToString();
|
||||||
parameters["?webLoginKey"] = string.Empty;
|
parameters["?webLoginKey"] = string.Empty;
|
||||||
|
parameters["?userFlags"] = "0";
|
||||||
|
parameters["?godLevel"] = "0";
|
||||||
|
|
||||||
|
|
||||||
bool returnval = false;
|
bool returnval = false;
|
||||||
|
|
||||||
@@ -815,7 +821,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
||||||
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
||||||
string aboutText, string firstText,
|
string aboutText, string firstText,
|
||||||
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
|
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey, int userFlags, int godLevel)
|
||||||
{
|
{
|
||||||
string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname ";
|
string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname ";
|
||||||
sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
|
sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
|
||||||
@@ -827,6 +833,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
sql += "`profileCanDoMask` = ?profileCanDoMask , `profileWantDoMask` = ?profileWantDoMask , ";
|
sql += "`profileCanDoMask` = ?profileCanDoMask , `profileWantDoMask` = ?profileWantDoMask , ";
|
||||||
sql += "`profileAboutText` = ?profileAboutText , `profileFirstText` = ?profileFirstText, ";
|
sql += "`profileAboutText` = ?profileAboutText , `profileFirstText` = ?profileFirstText, ";
|
||||||
sql += "`profileImage` = ?profileImage , `profileFirstImage` = ?profileFirstImage , ";
|
sql += "`profileImage` = ?profileImage , `profileFirstImage` = ?profileFirstImage , ";
|
||||||
|
sql += "`userFlags` = ?userFlags , `godLevel` = ?godLevel , ";
|
||||||
sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID";
|
sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID";
|
||||||
|
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
@@ -854,6 +861,8 @@ namespace OpenSim.Data.MySQL
|
|||||||
parameters["?profileImage"] = profileImage.ToString();
|
parameters["?profileImage"] = profileImage.ToString();
|
||||||
parameters["?profileFirstImage"] = firstImage.ToString();
|
parameters["?profileFirstImage"] = firstImage.ToString();
|
||||||
parameters["?webLoginKey"] = webLoginKey.ToString();
|
parameters["?webLoginKey"] = webLoginKey.ToString();
|
||||||
|
parameters["?userFlags"] = userFlags.ToString();
|
||||||
|
parameters["?godLevel"] = userFlags.ToString();
|
||||||
|
|
||||||
bool returnval = false;
|
bool returnval = false;
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, user.HomeLocation.Z, user.HomeLookAt.X,
|
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, user.HomeLocation.Z, user.HomeLookAt.X,
|
||||||
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, user.UserInventoryURI,
|
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, user.UserInventoryURI,
|
||||||
user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText,
|
user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText,
|
||||||
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey);
|
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
6
OpenSim/Data/MySQL/Resources/003_UserStore.sql
Normal file
6
OpenSim/Data/MySQL/Resources/003_UserStore.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE users add userFlags integer NOT NULL default 0;
|
||||||
|
ALTER TABLE users add godLevel integer NOT NULL default 0;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
6
OpenSim/Data/SQLite/Resources/003_UserStore.sql
Normal file
6
OpenSim/Data/SQLite/Resources/003_UserStore.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE users add userFlags integer NOT NULL default 0;
|
||||||
|
ALTER TABLE users add godLevel integer NOT NULL default 0;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
@@ -681,6 +681,8 @@ namespace OpenSim.Data.SQLite
|
|||||||
SQLiteUtil.createCol(users, "profileImage", typeof (String));
|
SQLiteUtil.createCol(users, "profileImage", typeof (String));
|
||||||
SQLiteUtil.createCol(users, "profileFirstImage", typeof (String));
|
SQLiteUtil.createCol(users, "profileFirstImage", typeof (String));
|
||||||
SQLiteUtil.createCol(users, "webLoginKey", typeof(String));
|
SQLiteUtil.createCol(users, "webLoginKey", typeof(String));
|
||||||
|
SQLiteUtil.createCol(users, "userFlags", typeof (Int32));
|
||||||
|
SQLiteUtil.createCol(users, "godLevel", typeof (Int32));
|
||||||
// Add in contraints
|
// Add in contraints
|
||||||
users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
|
users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
|
||||||
return users;
|
return users;
|
||||||
@@ -789,6 +791,8 @@ namespace OpenSim.Data.SQLite
|
|||||||
LLUUID.TryParse((String)row["profileFirstImage"], out tmp);
|
LLUUID.TryParse((String)row["profileFirstImage"], out tmp);
|
||||||
user.FirstLifeImage = tmp;
|
user.FirstLifeImage = tmp;
|
||||||
user.WebLoginKey = new LLUUID((String) row["webLoginKey"]);
|
user.WebLoginKey = new LLUUID((String) row["webLoginKey"]);
|
||||||
|
user.UserFlags = Convert.ToInt32(row["userFlags"]);
|
||||||
|
user.GodLevel = Convert.ToInt32(row["godLevel"]);
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
@@ -829,6 +833,8 @@ namespace OpenSim.Data.SQLite
|
|||||||
row["profileImage"] = user.Image;
|
row["profileImage"] = user.Image;
|
||||||
row["profileFirstImage"] = user.FirstLifeImage;
|
row["profileFirstImage"] = user.FirstLifeImage;
|
||||||
row["webLoginKey"] = user.WebLoginKey;
|
row["webLoginKey"] = user.WebLoginKey;
|
||||||
|
row["userFlags"] = user.UserFlags;
|
||||||
|
row["godLevel"] = user.GodLevel;
|
||||||
|
|
||||||
// ADO.NET doesn't handle NULL very well
|
// ADO.NET doesn't handle NULL very well
|
||||||
foreach (DataColumn col in ds.Tables["users"].Columns)
|
foreach (DataColumn col in ds.Tables["users"].Columns)
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ namespace OpenSim.Framework
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private LLUUID _webLoginKey;
|
private LLUUID _webLoginKey;
|
||||||
|
|
||||||
|
// Data for estates and other goodies
|
||||||
|
// to get away from per-machine configs a little
|
||||||
|
//
|
||||||
|
private int _userFlags;
|
||||||
|
private int _godLevel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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
|
/// 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
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -330,5 +336,17 @@ namespace OpenSim.Framework
|
|||||||
get { return _currentAgent; }
|
get { return _currentAgent; }
|
||||||
set { _currentAgent = value; }
|
set { _currentAgent = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual int UserFlags
|
||||||
|
{
|
||||||
|
get { return _userFlags; }
|
||||||
|
set { _userFlags = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual int GodLevel
|
||||||
|
{
|
||||||
|
get { return _godLevel; }
|
||||||
|
set { _godLevel = value; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ namespace OpenSim.Grid.UserServer
|
|||||||
responseData["home_look_x"] = profile.HomeLookAt.X.ToString();
|
responseData["home_look_x"] = profile.HomeLookAt.X.ToString();
|
||||||
responseData["home_look_y"] = profile.HomeLookAt.Y.ToString();
|
responseData["home_look_y"] = profile.HomeLookAt.Y.ToString();
|
||||||
responseData["home_look_z"] = profile.HomeLookAt.Z.ToString();
|
responseData["home_look_z"] = profile.HomeLookAt.Z.ToString();
|
||||||
|
|
||||||
|
responseData["user_flags"] = profile.UserFlags.ToString();
|
||||||
|
responseData["god_level"] = profile.GodLevel.ToString();
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -638,6 +641,28 @@ namespace OpenSim.Grid.UserServer
|
|||||||
m_log.Error("[PROFILE]:Failed to set home lookat z");
|
m_log.Error("[PROFILE]:Failed to set home lookat z");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (requestData.Contains("user_flags"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]);
|
||||||
|
}
|
||||||
|
catch (InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set user flags");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestData.Contains("god_level"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]);
|
||||||
|
}
|
||||||
|
catch (InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set god level");
|
||||||
|
}
|
||||||
|
}
|
||||||
// call plugin!
|
// call plugin!
|
||||||
bool ret = UpdateUserProfileProperties(userProfile);
|
bool ret = UpdateUserProfileProperties(userProfile);
|
||||||
responseData["returnString"] = ret.ToString();
|
responseData["returnString"] = ret.ToString();
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ namespace OpenSim.Region.Communications.OGS1
|
|||||||
new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
|
new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
|
||||||
(float) Convert.ToDecimal((string) data["home_look_y"]),
|
(float) Convert.ToDecimal((string) data["home_look_y"]),
|
||||||
(float) Convert.ToDecimal((string) data["home_look_z"]));
|
(float) Convert.ToDecimal((string) data["home_look_z"]));
|
||||||
|
if(data.Contains("user_flags"))
|
||||||
|
userData.UserFlags = Convert.ToInt32((string) data["user_flags"]);
|
||||||
|
if(data.Contains("god_level"))
|
||||||
|
userData.GodLevel = Convert.ToInt32((string) data["god_level"]);
|
||||||
|
|
||||||
return userData;
|
return userData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,6 +467,8 @@ namespace OpenSim.Region.Communications.OGS1
|
|||||||
param["home_look_x"] = UserProfile.HomeLookAtX.ToString();
|
param["home_look_x"] = UserProfile.HomeLookAtX.ToString();
|
||||||
param["home_look_y"] = UserProfile.HomeLookAtY.ToString();
|
param["home_look_y"] = UserProfile.HomeLookAtY.ToString();
|
||||||
param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
|
param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
|
||||||
|
param["user_flags"] = UserProfile.UserFlags.ToString();
|
||||||
|
param["god_level"] = UserProfile.GodLevel.ToString();
|
||||||
|
|
||||||
IList parameters = new ArrayList();
|
IList parameters = new ArrayList();
|
||||||
parameters.Add(param);
|
parameters.Add(param);
|
||||||
|
|||||||
Reference in New Issue
Block a user