* Allow interested user data plugins to store temporary user profiles

* Database and the OGS1 plugins are not interested and hence ignore these calls
0.6.5-rc1
Justin Clarke Casey 2009-04-23 18:57:39 +00:00
parent ef9d140022
commit 0d51c22620
9 changed files with 58 additions and 8 deletions

View File

@ -101,8 +101,15 @@ namespace OpenSim.Data
/// <param name="user">UserProfile to add</param> /// <param name="user">UserProfile to add</param>
void AddNewUserProfile(UserProfileData user); void AddNewUserProfile(UserProfileData user);
/// <summary></summary> /// <summary>
/// Updates an existing user profile /// Adds a temporary user profile. A temporary userprofile is one that should exist only for the lifetime of
/// the process.
/// </summary>
/// <param name="userProfile"></param>
void AddTemporaryUserProfile(UserProfileData userProfile);
/// <summary>
/// Updates an existing user profile
/// </summary> /// </summary>
/// <param name="user">UserProfile to update</param> /// <param name="user">UserProfile to update</param>
bool UpdateUserProfile(UserProfileData user); bool UpdateUserProfile(UserProfileData user);

View File

@ -46,6 +46,12 @@ namespace OpenSim.Data
public UserProfileData GetUserByUri(Uri uri) { return null; } public UserProfileData GetUserByUri(Uri uri) { return null; }
public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey); public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
public abstract void AddNewUserProfile(UserProfileData user); public abstract void AddNewUserProfile(UserProfileData user);
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
// Deliberately blank - database plugins shouldn't store temporary profiles.
}
public abstract bool UpdateUserProfile(UserProfileData user); public abstract bool UpdateUserProfile(UserProfileData user);
public abstract void AddNewUserAgent(UserAgentData agent); public abstract void AddNewUserAgent(UserAgentData agent);
public abstract void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms); public abstract void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);

View File

@ -33,6 +33,13 @@ namespace OpenSim.Framework.Communications
{ {
public interface IUserService public interface IUserService
{ {
/// <summary>
/// Add a temporary user profile.
/// </summary>
/// A temporary user profile is one that should exist only for the lifetime of the process.
/// <param name="userProfile"></param>
void AddTemporaryUserProfile(UserProfileData userProfile);
/// <summary> /// <summary>
/// Loads a user profile by name /// Loads a user profile by name
/// </summary> /// </summary>

View File

@ -64,6 +64,14 @@ namespace OpenSim.Framework.Communications
return null; return null;
} }
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
lock (m_profiles)
{
m_profiles[userProfile.ID] = userProfile;
}
}
public UserProfileData GetUserByUri(Uri uri) { return null; } public UserProfileData GetUserByUri(Uri uri) { return null; }
public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; } public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; }
public UserAgentData GetAgentByUUID(UUID user) { return null; } public UserAgentData GetAgentByUUID(UUID user) { return null; }

View File

@ -90,6 +90,11 @@ namespace OpenSim.Framework.Communications.Tests
private class FakeUserService : IUserService private class FakeUserService : IUserService
{ {
public void AddTemporaryUserProfile(UserProfileData userProfile)
{
throw new NotImplementedException();
}
public UserProfileData GetUserProfile(string firstName, string lastName) public UserProfileData GetUserProfile(string firstName, string lastName)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -280,8 +280,8 @@ namespace OpenSim.Framework.Communications.Tests
[Test] [Test]
public void T023_TestAuthenticatedLoginAlreadyLoggedIn() public void T023_TestAuthenticatedLoginAlreadyLoggedIn()
{ {
Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()"); //Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()");
log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
string error_already_logged = "You appear to be already logged in. " + string error_already_logged = "You appear to be already logged in. " +
"If this is not the case please wait for your session to timeout. " + "If this is not the case please wait for your session to timeout. " +
@ -317,7 +317,7 @@ namespace OpenSim.Framework.Communications.Tests
responseData = (Hashtable)response.Value; responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo("Hello folks")); Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()"); //Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()");
} }
public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector

View File

@ -88,9 +88,16 @@ namespace OpenSim.Framework.Communications
m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IUserDataPlugin>(provider, connect)); m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IUserDataPlugin>(provider, connect));
} }
#region Get UserProfile #region UserProfile
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
foreach (IUserDataPlugin plugin in m_plugins)
{
plugin.AddTemporaryUserProfile(userProfile);
}
}
// see IUserService
public virtual UserProfileData GetUserProfile(string fname, string lname) public virtual UserProfileData GetUserProfile(string fname, string lname)
{ {
foreach (IUserDataPlugin plugin in m_plugins) foreach (IUserDataPlugin plugin in m_plugins)

View File

@ -74,6 +74,11 @@ namespace OpenSim.Region.Communications.OGS1
public void ResetAttachments(UUID userID) {} public void ResetAttachments(UUID userID) {}
public void LogoutUsers(UUID regionID) {} public void LogoutUsers(UUID regionID) {}
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
// Not interested
}
public UserProfileData GetUserByUri(Uri uri) public UserProfileData GetUserByUri(Uri uri)
{ {
WebRequest request = WebRequest.Create(uri); WebRequest request = WebRequest.Create(uri);

View File

@ -66,6 +66,11 @@ namespace OpenSim.Tests.Common.Mock
public void Initialise() {} public void Initialise() {}
public void Dispose() {} public void Dispose() {}
public void AddTemporaryUserProfile(UserProfileData userProfile)
{
// Not interested
}
public void AddNewUserProfile(UserProfileData user) public void AddNewUserProfile(UserProfileData user)
{ {
UpdateUserProfile(user); UpdateUserProfile(user);