From 0d51c22620315f125ddbd3fe501eb93f318038d8 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 23 Apr 2009 18:57:39 +0000
Subject: * Allow interested user data plugins to store temporary user profiles
* Database and the OGS1 plugins are not interested and hence ignore these
calls
---
OpenSim/Framework/Communications/IUserService.cs | 7 +++++++
.../Framework/Communications/TemporaryUserProfilePlugin.cs | 8 ++++++++
.../Framework/Communications/Tests/Cache/AssetCacheTests.cs | 5 +++++
OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 6 +++---
OpenSim/Framework/Communications/UserManagerBase.cs | 13 ++++++++++---
5 files changed, 33 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index fb24c15..9a3e211 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -34,6 +34,13 @@ namespace OpenSim.Framework.Communications
public interface IUserService
{
///
+ /// Add a temporary user profile.
+ ///
+ /// A temporary user profile is one that should exist only for the lifetime of the process.
+ ///
+ void AddTemporaryUserProfile(UserProfileData userProfile);
+
+ ///
/// Loads a user profile by name
///
/// First name
diff --git a/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs
index 1cfeaf1..3b78c99 100644
--- a/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs
+++ b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs
@@ -64,6 +64,14 @@ namespace OpenSim.Framework.Communications
return null;
}
+ public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
+ {
+ lock (m_profiles)
+ {
+ m_profiles[userProfile.ID] = userProfile;
+ }
+ }
+
public UserProfileData GetUserByUri(Uri uri) { return null; }
public List GeneratePickerResults(UUID queryID, string query) { return null; }
public UserAgentData GetAgentByUUID(UUID user) { return null; }
diff --git a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs
index 178c356..a5ee549 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs
@@ -90,6 +90,11 @@ namespace OpenSim.Framework.Communications.Tests
private class FakeUserService : IUserService
{
+ public void AddTemporaryUserProfile(UserProfileData userProfile)
+ {
+ throw new NotImplementedException();
+ }
+
public UserProfileData GetUserProfile(string firstName, string lastName)
{
throw new NotImplementedException();
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 42fdea5..d0c1b3b 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -280,8 +280,8 @@ namespace OpenSim.Framework.Communications.Tests
[Test]
public void T023_TestAuthenticatedLoginAlreadyLoggedIn()
{
- Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()");
- log4net.Config.XmlConfigurator.Configure();
+ //Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()");
+ //log4net.Config.XmlConfigurator.Configure();
string error_already_logged = "You appear to be already logged in. " +
"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;
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
- Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()");
+ //Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()");
}
public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index b6a7362..133f810 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -88,9 +88,16 @@ namespace OpenSim.Framework.Communications
m_plugins.AddRange(DataPluginFactory.LoadDataPlugins(provider, connect));
}
- #region Get UserProfile
-
- // see IUserService
+ #region UserProfile
+
+ public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
+ {
+ foreach (IUserDataPlugin plugin in m_plugins)
+ {
+ plugin.AddTemporaryUserProfile(userProfile);
+ }
+ }
+
public virtual UserProfileData GetUserProfile(string fname, string lname)
{
foreach (IUserDataPlugin plugin in m_plugins)
--
cgit v1.1