* Moved insertUserRow into MSSQLUserData so 'create user' works again
[Provided by openlifegrid.com]ThreadPoolClientBranch
parent
15c6788dc7
commit
b705ba21f3
|
@ -439,101 +439,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
|
||||
return returnval;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new user and inserts it into the database
|
||||
/// </summary>
|
||||
/// <param name="uuid">User ID</param>
|
||||
/// <param name="username">First part of the login</param>
|
||||
/// <param name="lastname">Second part of the login</param>
|
||||
/// <param name="passwordHash">A salted hash of the users password</param>
|
||||
/// <param name="passwordSalt">The salt used for the password hash</param>
|
||||
/// <param name="homeRegion">A regionHandle of the users home region</param>
|
||||
/// <param name="homeLocX">Home region position vector</param>
|
||||
/// <param name="homeLocY">Home region position vector</param>
|
||||
/// <param name="homeLocZ">Home region position vector</param>
|
||||
/// <param name="homeLookAtX">Home region 'look at' vector</param>
|
||||
/// <param name="homeLookAtY">Home region 'look at' vector</param>
|
||||
/// <param name="homeLookAtZ">Home region 'look at' vector</param>
|
||||
/// <param name="created">Account created (unix timestamp)</param>
|
||||
/// <param name="lastlogin">Last login (unix timestamp)</param>
|
||||
/// <param name="inventoryURI">Users inventory URI</param>
|
||||
/// <param name="assetURI">Users asset URI</param>
|
||||
/// <param name="canDoMask">I can do mask</param>
|
||||
/// <param name="wantDoMask">I want to do mask</param>
|
||||
/// <param name="aboutText">Profile text</param>
|
||||
/// <param name="firstText">Firstlife text</param>
|
||||
/// <param name="profileImage">UUID for profile image</param>
|
||||
/// <param name="firstImage">UUID for firstlife image</param>
|
||||
/// <returns>Success?</returns>
|
||||
public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
|
||||
string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
|
||||
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
||||
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
||||
string aboutText, string firstText,
|
||||
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
|
||||
{
|
||||
string sql = "INSERT INTO users ";
|
||||
sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], ";
|
||||
sql +=
|
||||
"[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], ";
|
||||
sql +=
|
||||
"[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], ";
|
||||
sql += "[profileFirstText], [profileImage], [profileFirstImage], [webLoginKey]) VALUES ";
|
||||
|
||||
sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, ";
|
||||
sql +=
|
||||
"@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, ";
|
||||
sql +=
|
||||
"@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, ";
|
||||
sql += "@profileFirstText, @profileImage, @profileFirstImage, @webLoginKey);";
|
||||
|
||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||
parameters["UUID"] = uuid.ToString();
|
||||
parameters["username"] = username.ToString();
|
||||
parameters["lastname"] = lastname.ToString();
|
||||
parameters["passwordHash"] = passwordHash.ToString();
|
||||
parameters["passwordSalt"] = passwordSalt.ToString();
|
||||
parameters["homeRegion"] = homeRegion.ToString();
|
||||
parameters["homeLocationX"] = homeLocX.ToString();
|
||||
parameters["homeLocationY"] = homeLocY.ToString();
|
||||
parameters["homeLocationZ"] = homeLocZ.ToString();
|
||||
parameters["homeLookAtX"] = homeLookAtX.ToString();
|
||||
parameters["homeLookAtY"] = homeLookAtY.ToString();
|
||||
parameters["homeLookAtZ"] = homeLookAtZ.ToString();
|
||||
parameters["created"] = created.ToString();
|
||||
parameters["lastLogin"] = lastlogin.ToString();
|
||||
parameters["userInventoryURI"] = String.Empty;
|
||||
parameters["userAssetURI"] = String.Empty;
|
||||
parameters["profileCanDoMask"] = "0";
|
||||
parameters["profileWantDoMask"] = "0";
|
||||
parameters["profileAboutText"] = String.Empty;
|
||||
parameters["profileFirstText"] = String.Empty;
|
||||
parameters["profileImage"] = LLUUID.Zero.ToString();
|
||||
parameters["profileFirstImage"] = LLUUID.Zero.ToString();
|
||||
parameters["webLoginKey"] = LLUUID.Random().ToString();
|
||||
|
||||
bool returnval = false;
|
||||
|
||||
try
|
||||
{
|
||||
IDbCommand result = Query(sql, parameters);
|
||||
|
||||
if (result.ExecuteNonQuery() == 1)
|
||||
returnval = true;
|
||||
|
||||
result.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return returnval;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Execute a SQL statement stored in a resource, as a string
|
||||
/// </summary>
|
||||
|
|
|
@ -505,7 +505,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
{
|
||||
lock (database)
|
||||
{
|
||||
database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
|
||||
InsertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
|
||||
user.homeRegion, user.homeLocation.X, user.homeLocation.Y,
|
||||
user.homeLocation.Z,
|
||||
user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created,
|
||||
|
@ -522,6 +522,99 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new user and inserts it into the database
|
||||
/// </summary>
|
||||
/// <param name="uuid">User ID</param>
|
||||
/// <param name="username">First part of the login</param>
|
||||
/// <param name="lastname">Second part of the login</param>
|
||||
/// <param name="passwordHash">A salted hash of the users password</param>
|
||||
/// <param name="passwordSalt">The salt used for the password hash</param>
|
||||
/// <param name="homeRegion">A regionHandle of the users home region</param>
|
||||
/// <param name="homeLocX">Home region position vector</param>
|
||||
/// <param name="homeLocY">Home region position vector</param>
|
||||
/// <param name="homeLocZ">Home region position vector</param>
|
||||
/// <param name="homeLookAtX">Home region 'look at' vector</param>
|
||||
/// <param name="homeLookAtY">Home region 'look at' vector</param>
|
||||
/// <param name="homeLookAtZ">Home region 'look at' vector</param>
|
||||
/// <param name="created">Account created (unix timestamp)</param>
|
||||
/// <param name="lastlogin">Last login (unix timestamp)</param>
|
||||
/// <param name="inventoryURI">Users inventory URI</param>
|
||||
/// <param name="assetURI">Users asset URI</param>
|
||||
/// <param name="canDoMask">I can do mask</param>
|
||||
/// <param name="wantDoMask">I want to do mask</param>
|
||||
/// <param name="aboutText">Profile text</param>
|
||||
/// <param name="firstText">Firstlife text</param>
|
||||
/// <param name="profileImage">UUID for profile image</param>
|
||||
/// <param name="firstImage">UUID for firstlife image</param>
|
||||
/// <returns>Success?</returns>
|
||||
private bool InsertUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
|
||||
string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
|
||||
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
||||
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
||||
string aboutText, string firstText,
|
||||
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
|
||||
{
|
||||
string sql = "INSERT INTO "+m_usersTableName;
|
||||
sql += " ([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], ";
|
||||
sql +=
|
||||
"[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], ";
|
||||
sql +=
|
||||
"[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], ";
|
||||
sql += "[profileFirstText], [profileImage], [profileFirstImage], [webLoginKey]) VALUES ";
|
||||
|
||||
sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, ";
|
||||
sql +=
|
||||
"@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, ";
|
||||
sql +=
|
||||
"@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, ";
|
||||
sql += "@profileFirstText, @profileImage, @profileFirstImage, @webLoginKey);";
|
||||
|
||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||
parameters["UUID"] = uuid.ToString();
|
||||
parameters["username"] = username.ToString();
|
||||
parameters["lastname"] = lastname.ToString();
|
||||
parameters["passwordHash"] = passwordHash.ToString();
|
||||
parameters["passwordSalt"] = passwordSalt.ToString();
|
||||
parameters["homeRegion"] = homeRegion.ToString();
|
||||
parameters["homeLocationX"] = homeLocX.ToString();
|
||||
parameters["homeLocationY"] = homeLocY.ToString();
|
||||
parameters["homeLocationZ"] = homeLocZ.ToString();
|
||||
parameters["homeLookAtX"] = homeLookAtX.ToString();
|
||||
parameters["homeLookAtY"] = homeLookAtY.ToString();
|
||||
parameters["homeLookAtZ"] = homeLookAtZ.ToString();
|
||||
parameters["created"] = created.ToString();
|
||||
parameters["lastLogin"] = lastlogin.ToString();
|
||||
parameters["userInventoryURI"] = String.Empty;
|
||||
parameters["userAssetURI"] = String.Empty;
|
||||
parameters["profileCanDoMask"] = "0";
|
||||
parameters["profileWantDoMask"] = "0";
|
||||
parameters["profileAboutText"] = String.Empty;
|
||||
parameters["profileFirstText"] = String.Empty;
|
||||
parameters["profileImage"] = LLUUID.Zero.ToString();
|
||||
parameters["profileFirstImage"] = LLUUID.Zero.ToString();
|
||||
parameters["webLoginKey"] = LLUUID.Random().ToString();
|
||||
|
||||
bool returnval = false;
|
||||
|
||||
try
|
||||
{
|
||||
IDbCommand result = database.Query(sql, parameters);
|
||||
|
||||
if (result.ExecuteNonQuery() == 1)
|
||||
returnval = true;
|
||||
|
||||
result.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return returnval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new agent
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue