Implement saving user account data

slimupdates
Melanie 2009-12-31 01:34:03 +00:00
parent 3507005d9d
commit 99ad7aac7f
4 changed files with 26 additions and 5 deletions

View File

@ -38,7 +38,7 @@ namespace OpenSim.Data
public UUID ScopeID;
public string FirstName;
public string LastName;
public Dictionary<string, object> Data;
public Dictionary<string, string> Data;
}
/// <summary>
@ -47,6 +47,6 @@ namespace OpenSim.Data
public interface IUserAccountData
{
UserAccountData[] Get(string[] fields, string[] values);
bool Store(UserAccountData data, UUID principalID, string token);
bool Store(UserAccountData data);
}
}

View File

@ -65,7 +65,7 @@ namespace OpenSim.Data.MSSQL
public UserAccountData Get(UUID principalID, UUID scopeID)
{
UserAccountData ret = new UserAccountData();
ret.Data = new Dictionary<string, object>();
ret.Data = new Dictionary<string, string>();
string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm);
if (scopeID != UUID.Zero)

View File

@ -42,7 +42,7 @@ namespace OpenSim.Data.MySQL
{
}
public bool Store(UserAccountData data, UUID principalID, string token)
public bool Store(UserAccountData data)
{
return Store(data);
}

View File

@ -142,7 +142,28 @@ namespace OpenSim.Services.UserAccountService
public bool StoreUserAccount(UserAccount data)
{
return false;
UserAccountData d = new UserAccountData();
d.FirstName = data.FirstName;
d.LastName = data.LastName;
d.PrincipalID = data.PrincipalID;
d.ScopeID = data.ScopeID;
d.Data = new Dictionary<string,string>();
d.Data["Email"] = data.Email;
d.Data["Created"] = data.Created.ToString();
List<string> parts = new List<string>();
foreach (KeyValuePair<string,object> kvp in data.ServiceURLs)
{
string key = System.Web.HttpUtility.UrlEncode(kvp.Key);
string val = System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
parts.Add(key + "=" + val);
}
d.Data["ServiceURLs"] = string.Join(" ", parts.ToArray());
return m_Database.Store(d);
}
public List<UserAccount> GetUserAccounts(UUID scopeID, string query)