diff options
author | Justin Clarke Casey | 2009-04-23 18:57:39 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-23 18:57:39 +0000 |
commit | 0d51c22620315f125ddbd3fe501eb93f318038d8 (patch) | |
tree | 31cf4ba3cc962497c0589dc12eb5642240670d13 | |
parent | * Add user data plugin to store temporary profiles (which are distinct from c... (diff) | |
download | opensim-SC-0d51c22620315f125ddbd3fe501eb93f318038d8.zip opensim-SC-0d51c22620315f125ddbd3fe501eb93f318038d8.tar.gz opensim-SC-0d51c22620315f125ddbd3fe501eb93f318038d8.tar.bz2 opensim-SC-0d51c22620315f125ddbd3fe501eb93f318038d8.tar.xz |
* Allow interested user data plugins to store temporary user profiles
* Database and the OGS1 plugins are not interested and hence ignore these calls
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 | |||
101 | /// <param name="user">UserProfile to add</param> | 101 | /// <param name="user">UserProfile to add</param> |
102 | void AddNewUserProfile(UserProfileData user); | 102 | void AddNewUserProfile(UserProfileData user); |
103 | 103 | ||
104 | /// <summary></summary> | 104 | /// <summary> |
105 | /// Updates an existing user profile | 105 | /// Adds a temporary user profile. A temporary userprofile is one that should exist only for the lifetime of |
106 | /// the process. | ||
107 | /// </summary> | ||
108 | /// <param name="userProfile"></param> | ||
109 | void AddTemporaryUserProfile(UserProfileData userProfile); | ||
110 | |||
111 | /// <summary> | ||
112 | /// Updates an existing user profile | ||
106 | /// </summary> | 113 | /// </summary> |
107 | /// <param name="user">UserProfile to update</param> | 114 | /// <param name="user">UserProfile to update</param> |
108 | bool UpdateUserProfile(UserProfileData user); | 115 | 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 | |||
46 | public UserProfileData GetUserByUri(Uri uri) { return null; } | 46 | public UserProfileData GetUserByUri(Uri uri) { return null; } |
47 | public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey); | 47 | public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey); |
48 | public abstract void AddNewUserProfile(UserProfileData user); | 48 | public abstract void AddNewUserProfile(UserProfileData user); |
49 | |||
50 | public virtual void AddTemporaryUserProfile(UserProfileData userProfile) | ||
51 | { | ||
52 | // Deliberately blank - database plugins shouldn't store temporary profiles. | ||
53 | } | ||
54 | |||
49 | public abstract bool UpdateUserProfile(UserProfileData user); | 55 | public abstract bool UpdateUserProfile(UserProfileData user); |
50 | public abstract void AddNewUserAgent(UserAgentData agent); | 56 | public abstract void AddNewUserAgent(UserAgentData agent); |
51 | public abstract void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms); | 57 | 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 | |||
34 | public interface IUserService | 34 | public interface IUserService |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Add a temporary user profile. | ||
38 | /// </summary> | ||
39 | /// A temporary user profile is one that should exist only for the lifetime of the process. | ||
40 | /// <param name="userProfile"></param> | ||
41 | void AddTemporaryUserProfile(UserProfileData userProfile); | ||
42 | |||
43 | /// <summary> | ||
37 | /// Loads a user profile by name | 44 | /// Loads a user profile by name |
38 | /// </summary> | 45 | /// </summary> |
39 | /// <param name="firstName">First name</param> | 46 | /// <param name="firstName">First name</param> |
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 | |||
64 | return null; | 64 | return null; |
65 | } | 65 | } |
66 | 66 | ||
67 | public virtual void AddTemporaryUserProfile(UserProfileData userProfile) | ||
68 | { | ||
69 | lock (m_profiles) | ||
70 | { | ||
71 | m_profiles[userProfile.ID] = userProfile; | ||
72 | } | ||
73 | } | ||
74 | |||
67 | public UserProfileData GetUserByUri(Uri uri) { return null; } | 75 | public UserProfileData GetUserByUri(Uri uri) { return null; } |
68 | public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; } | 76 | public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; } |
69 | public UserAgentData GetAgentByUUID(UUID user) { return null; } | 77 | 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 | |||
90 | 90 | ||
91 | private class FakeUserService : IUserService | 91 | private class FakeUserService : IUserService |
92 | { | 92 | { |
93 | public void AddTemporaryUserProfile(UserProfileData userProfile) | ||
94 | { | ||
95 | throw new NotImplementedException(); | ||
96 | } | ||
97 | |||
93 | public UserProfileData GetUserProfile(string firstName, string lastName) | 98 | public UserProfileData GetUserProfile(string firstName, string lastName) |
94 | { | 99 | { |
95 | throw new NotImplementedException(); | 100 | 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 | |||
280 | [Test] | 280 | [Test] |
281 | public void T023_TestAuthenticatedLoginAlreadyLoggedIn() | 281 | public void T023_TestAuthenticatedLoginAlreadyLoggedIn() |
282 | { | 282 | { |
283 | Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()"); | 283 | //Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()"); |
284 | log4net.Config.XmlConfigurator.Configure(); | 284 | //log4net.Config.XmlConfigurator.Configure(); |
285 | 285 | ||
286 | string error_already_logged = "You appear to be already logged in. " + | 286 | string error_already_logged = "You appear to be already logged in. " + |
287 | "If this is not the case please wait for your session to timeout. " + | 287 | "If this is not the case please wait for your session to timeout. " + |
@@ -317,7 +317,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
317 | responseData = (Hashtable)response.Value; | 317 | responseData = (Hashtable)response.Value; |
318 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); | 318 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); |
319 | 319 | ||
320 | Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()"); | 320 | //Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()"); |
321 | } | 321 | } |
322 | 322 | ||
323 | public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector | 323 | 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 | |||
88 | m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IUserDataPlugin>(provider, connect)); | 88 | m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IUserDataPlugin>(provider, connect)); |
89 | } | 89 | } |
90 | 90 | ||
91 | #region Get UserProfile | 91 | #region UserProfile |
92 | 92 | ||
93 | // see IUserService | 93 | public virtual void AddTemporaryUserProfile(UserProfileData userProfile) |
94 | { | ||
95 | foreach (IUserDataPlugin plugin in m_plugins) | ||
96 | { | ||
97 | plugin.AddTemporaryUserProfile(userProfile); | ||
98 | } | ||
99 | } | ||
100 | |||
94 | public virtual UserProfileData GetUserProfile(string fname, string lname) | 101 | public virtual UserProfileData GetUserProfile(string fname, string lname) |
95 | { | 102 | { |
96 | foreach (IUserDataPlugin plugin in m_plugins) | 103 | 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 | |||
74 | public void ResetAttachments(UUID userID) {} | 74 | public void ResetAttachments(UUID userID) {} |
75 | public void LogoutUsers(UUID regionID) {} | 75 | public void LogoutUsers(UUID regionID) {} |
76 | 76 | ||
77 | public virtual void AddTemporaryUserProfile(UserProfileData userProfile) | ||
78 | { | ||
79 | // Not interested | ||
80 | } | ||
81 | |||
77 | public UserProfileData GetUserByUri(Uri uri) | 82 | public UserProfileData GetUserByUri(Uri uri) |
78 | { | 83 | { |
79 | WebRequest request = WebRequest.Create(uri); | 84 | 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 | |||
65 | 65 | ||
66 | public void Initialise() {} | 66 | public void Initialise() {} |
67 | public void Dispose() {} | 67 | public void Dispose() {} |
68 | |||
69 | public void AddTemporaryUserProfile(UserProfileData userProfile) | ||
70 | { | ||
71 | // Not interested | ||
72 | } | ||
68 | 73 | ||
69 | public void AddNewUserProfile(UserProfileData user) | 74 | public void AddNewUserProfile(UserProfileData user) |
70 | { | 75 | { |