Remove CreateUserAccount. Rename SetUserAccount to StoreUserAccount.

Implement the fetch operations fully. Rename one last UserService file to
UserAccountService
This commit is contained in:
Melanie
2009-12-31 01:16:16 +00:00
parent 96f387ce49
commit 3507005d9d
6 changed files with 79 additions and 66 deletions

View File

@@ -62,33 +62,85 @@ namespace OpenSim.Services.UserAccountService
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 MakeUserAccount(d[0]);
}
return null;
private UserAccount MakeUserAccount(UserAccountData d)
{
UserAccount u = new UserAccount();
u.FirstName = d.FirstName;
u.LastName = d.LastName;
u.PrincipalID = d.PrincipalID;
u.ScopeID = d.ScopeID;
u.Email = d.Data["Email"].ToString();
u.Created = Convert.ToInt32(d.Data["Created"].ToString());
string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] {' '});
u.ServiceURLs = new Dictionary<string, object>();
foreach(string url in URLs)
{
string[] parts = url.Split(new char[] {'='});
if (parts.Length != 2)
continue;
string name = System.Web.HttpUtility.UrlDecode(parts[0]);
string val = System.Web.HttpUtility.UrlDecode(parts[1]);
u.ServiceURLs[name] = val;
}
return u;
}
public UserAccount GetUserAccount(UUID scopeID, string email)
{
return null;
UserAccountData[] d;
if (scopeID != UUID.Zero)
{
d = m_Database.Get(
new string[] {"ScopeID", "Email"},
new string[] {scopeID.ToString(), email});
}
else
{
d = m_Database.Get(
new string[] {"Email"},
new string[] {email});
}
if (d.Length < 1)
return null;
return MakeUserAccount(d[0]);
}
public UserAccount GetUserAccount(UUID scopeID, UUID userID)
public UserAccount GetUserAccount(UUID scopeID, UUID principalID)
{
return null;
UserAccountData[] d;
if (scopeID != UUID.Zero)
{
d = m_Database.Get(
new string[] {"ScopeID", "PrincipalID"},
new string[] {scopeID.ToString(), principalID.ToString()});
}
else
{
d = m_Database.Get(
new string[] {"PrincipalID"},
new string[] {principalID.ToString()});
}
if (d.Length < 1)
return null;
return MakeUserAccount(d[0]);
}
public bool SetUserAccount(UserAccount data)
{
return false;
}
public bool CreateUserAccount(UserAccount data)
public bool StoreUserAccount(UserAccount data)
{
return false;
}