From b6097ae9a8a4566330d882213179feba6d05da62 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Dec 2009 22:23:17 +0000 Subject: Some modifications to user service. Query by name is implemented now --- OpenSim/Data/IUserAccountData.cs | 1 + OpenSim/Data/MSSQL/MSSQLUserAccountData.cs | 5 +++++ OpenSim/Data/MySQL/MySQLUserAccountData.cs | 1 + OpenSim/Services/Interfaces/IUserService.cs | 16 ++++++++-------- .../Services/UserAccountService/UserAccountService.cs | 15 +++++++++++++++ 5 files changed, 30 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs index 3d0dde4..5ebe7d3 100644 --- a/OpenSim/Data/IUserAccountData.cs +++ b/OpenSim/Data/IUserAccountData.cs @@ -46,6 +46,7 @@ namespace OpenSim.Data /// public interface IUserAccountData { + UserAccountData[] Get(string[] fields, string[] values); bool Store(UserAccountData data, UUID principalID, string token); } } diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs index 4db2777..01750d8 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs @@ -189,5 +189,10 @@ namespace OpenSim.Data.MSSQL } return false; } + + public UserAccountData[] Get(string[] keys, string[] vals) + { + return null; + } } } diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index c6eb44d..e2ce6d1 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs @@ -41,6 +41,7 @@ namespace OpenSim.Data.MySQL : base(connectionString, realm, "UserAccount") { } + public bool Store(UserAccountData data, UUID principalID, string token) { return Store(data); diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserService.cs index e4e4bec..1bdaaab 100644 --- a/OpenSim/Services/Interfaces/IUserService.cs +++ b/OpenSim/Services/Interfaces/IUserService.cs @@ -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 ServiceURLs; - public DateTime Created; + public int Created; public UserAccount(Dictionary 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)) ServiceURLs = (Dictionary)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; diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 2e6f7dc..ee9ea94 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -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; } -- cgit v1.1