* DB4o usermanager replacement coded for read-only attributes.

* IUserData interface needs expansion to cover all user/user-server related interactions.
0.1-prestable
Adam Frisby 2007-05-07 04:26:22 +00:00
parent 4a155b08d7
commit 40eb8bc8b6
3 changed files with 48 additions and 24 deletions

View File

@ -57,12 +57,12 @@ namespace OpenGrid.Framework.Data.DB4o
} }
class DB4oGridManager class DB4oUserManager
{ {
public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
string dbfl; string dbfl;
public DB4oGridManager(string db4odb) public DB4oUserManager(string db4odb)
{ {
dbfl = db4odb; dbfl = db4odb;
IObjectContainer database; IObjectContainer database;

View File

@ -8,34 +8,57 @@ namespace OpenGrid.Framework.Data.DB4o
{ {
public class DB4oUserData : IUserData public class DB4oUserData : IUserData
{ {
DB4oUserManager manager = new DB4oUserManager("userprofiles.yap");
public UserProfileData getUserByUUID(LLUUID uuid) public UserProfileData getUserByUUID(LLUUID uuid)
{ {
return new UserProfileData(); if(manager.userProfiles.ContainsKey(uuid))
return manager.userProfiles[uuid];
return null;
} }
public UserProfileData getUserByName(string name) public UserProfileData getUserByName(string name)
{ {
return getUserByName(name.Split(',')[0], name.Split(',')[1]); return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
} }
public UserProfileData getUserByName(string fname, string lname) public UserProfileData getUserByName(string fname, string lname)
{ {
return new UserProfileData(); foreach (UserProfileData profile in manager.userProfiles.Values)
{
if (profile.username == fname && profile.surname == lname)
return profile;
}
return null;
} }
public UserAgentData getAgentByUUID(LLUUID uuid) public UserAgentData getAgentByUUID(LLUUID uuid)
{ {
return new UserAgentData(); try
{
return getUserByUUID(uuid).currentAgent;
}
catch (Exception e)
{
return null;
}
} }
public UserAgentData getAgentByName(string name) public UserAgentData getAgentByName(string name)
{ {
return getAgentByName(name.Split(',')[0], name.Split(',')[1]); return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
} }
public UserAgentData getAgentByName(string fname, string lname) public UserAgentData getAgentByName(string fname, string lname)
{ {
return new UserAgentData(); try
{
return getUserByName(fname,lname).currentAgent;
}
catch (Exception e)
{
return null;
}
} }
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)

View File

@ -7,29 +7,30 @@ namespace OpenGrid.Framework.Data
{ {
public class UserProfileData public class UserProfileData
{ {
string username; // The configurable part of the users username public LLUUID UUID;
string surname; // The users surname (can be used to indicate user class - eg 'Test User' or 'Test Admin') public string username; // The configurable part of the users username
public string surname; // The users surname (can be used to indicate user class - eg 'Test User' or 'Test Admin')
string passwordHash; // Hash of the users password public string passwordHash; // Hash of the users password
ulong homeRegion; // RegionHandle of home public ulong homeRegion; // RegionHandle of home
LLVector3 homeLocation; // Home Location inside the sim public LLVector3 homeLocation; // Home Location inside the sim
int created; // UNIX Epoch Timestamp (User Creation) public int created; // UNIX Epoch Timestamp (User Creation)
int lastLogin; // UNIX Epoch Timestamp (Last Login Time) public int lastLogin; // UNIX Epoch Timestamp (Last Login Time)
string userInventoryURI; // URI to inventory server for this user public string userInventoryURI; // URI to inventory server for this user
string userAssetURI; // URI to asset server for this user public string userAssetURI; // URI to asset server for this user
uint profileCanDoMask; // Profile window "I can do" mask public uint profileCanDoMask; // Profile window "I can do" mask
uint profileWantDoMask; // Profile window "I want to" mask public uint profileWantDoMask; // Profile window "I want to" mask
string profileAboutText; // My about window text public string profileAboutText; // My about window text
string profileFirstText; // First Life Text public string profileFirstText; // First Life Text
LLUUID profileImage; // My avatars profile image public LLUUID profileImage; // My avatars profile image
LLUUID profileFirstImage; // First-life image public LLUUID profileFirstImage; // First-life image
UserAgentData currentAgent; // The users last agent public UserAgentData currentAgent; // The users last agent
} }
public class UserAgentData public class UserAgentData