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/Data/IUserData.cs | 11 +++++++++--
OpenSim/Data/UserDataBase.cs | 6 ++++++
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 ++++++++++---
OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs | 5 +++++
OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs | 5 +++++
9 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Data/IUserData.cs b/OpenSim/Data/IUserData.cs
index d3631d5..79ba27b 100644
--- a/OpenSim/Data/IUserData.cs
+++ b/OpenSim/Data/IUserData.cs
@@ -101,8 +101,15 @@ namespace OpenSim.Data
/// UserProfile to add
void AddNewUserProfile(UserProfileData user);
- ///
- /// 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.
+ ///
+ ///
+ void AddTemporaryUserProfile(UserProfileData userProfile);
+
+ ///
+ /// Updates an existing user profile
///
/// UserProfile to update
bool UpdateUserProfile(UserProfileData user);
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs
index 167a837..5ee5096 100644
--- a/OpenSim/Data/UserDataBase.cs
+++ b/OpenSim/Data/UserDataBase.cs
@@ -46,6 +46,12 @@ namespace OpenSim.Data
public UserProfileData GetUserByUri(Uri uri) { return null; }
public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
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 void AddNewUserAgent(UserAgentData agent);
public abstract void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
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)
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
index f543451..941f815 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
@@ -74,6 +74,11 @@ namespace OpenSim.Region.Communications.OGS1
public void ResetAttachments(UUID userID) {}
public void LogoutUsers(UUID regionID) {}
+ public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
+ {
+ // Not interested
+ }
+
public UserProfileData GetUserByUri(Uri uri)
{
WebRequest request = WebRequest.Create(uri);
diff --git a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs
index 58996e2..f376bf0 100644
--- a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs
@@ -65,6 +65,11 @@ namespace OpenSim.Tests.Common.Mock
public void Initialise() {}
public void Dispose() {}
+
+ public void AddTemporaryUserProfile(UserProfileData userProfile)
+ {
+ // Not interested
+ }
public void AddNewUserProfile(UserProfileData user)
{
--
cgit v1.1