Some modifications to user service. Query by name is implemented now

slimupdates
Melanie 2009-12-30 22:23:17 +00:00
parent 170a04ce41
commit b6097ae9a8
5 changed files with 30 additions and 8 deletions

View File

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

View File

@ -189,5 +189,10 @@ namespace OpenSim.Data.MSSQL
}
return false;
}
public UserAccountData[] Get(string[] keys, string[] vals)
{
return null;
}
}
}

View File

@ -41,6 +41,7 @@ namespace OpenSim.Data.MySQL
: base(connectionString, realm, "UserAccount")
{
}
public bool Store(UserAccountData data, UUID principalID, string token)
{
return Store(data);

View File

@ -37,20 +37,20 @@ namespace OpenSim.Services.Interfaces
{
}
public UserAccount(UUID userID)
public UserAccount(UUID principalID)
{
UserID = userID;
PrincipalID = principalID;
}
public string FirstName;
public string LastName;
public string Email;
public UUID UserID;
public UUID PrincipalID;
public UUID ScopeID;
public Dictionary<string, object> ServiceURLs;
public DateTime Created;
public int Created;
public UserAccount(Dictionary<string, object> kvp)
{
@ -60,12 +60,12 @@ namespace OpenSim.Services.Interfaces
LastName = kvp["LastName"].ToString();
if (kvp.ContainsKey("Email"))
Email = kvp["Email"].ToString();
if (kvp.ContainsKey("UserID"))
UUID.TryParse(kvp["UserID"].ToString(), out UserID);
if (kvp.ContainsKey("PrincipalID"))
UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID);
if (kvp.ContainsKey("ScopeID"))
UUID.TryParse(kvp["ScopeID"].ToString(), out ScopeID);
if (kvp.ContainsKey("Created"))
DateTime.TryParse(kvp["Created"].ToString(), out Created);
Convert.ToInt32(kvp["Created"].ToString());
if (kvp.ContainsKey("ServiceURLs") && kvp["ServiceURLs"] != null && (kvp["ServiceURLs"] is Dictionary<string, string>))
ServiceURLs = (Dictionary<string, object>)kvp["ServiceURLs"];
}
@ -76,7 +76,7 @@ namespace OpenSim.Services.Interfaces
result["FirstName"] = FirstName;
result["LastName"] = LastName;
result["Email"] = Email;
result["UserID"] = UserID.ToString();
result["PrincipalID"] = PrincipalID.ToString();
result["ScopeID"] = ScopeID.ToString();
result["Created"] = Created.ToString();
result["ServiceURLs"] = ServiceURLs;

View File

@ -44,6 +44,21 @@ namespace OpenSim.Services.UserAccountService
public UserAccount GetUserAccount(UUID scopeID, string firstName,
string lastName)
{
UserAccountData[] d = m_Database.Get(
new string[] {"ScopeID", "FirstName", "LastName"},
new string[] {scopeID.ToString(), firstName, lastName});
if (d.Length < 1)
return null;
UserAccount u = new UserAccount();
u.FirstName = d[0].FirstName;
u.LastName = d[0].LastName;
u.PrincipalID = d[0].PrincipalID;
u.ScopeID = d[0].ScopeID;
u.Email = d[0].Data["Email"].ToString();
u.Created = Convert.ToInt32(d[0].Data["Created"].ToString());
return null;
}