* Add user data plugin to store temporary profiles (which are distinct from cached)
* Plugin not yet used * Existing functionality should not be affected in any way0.6.5-rc1
parent
ae30776003
commit
ef9d140022
|
@ -57,7 +57,6 @@ namespace OpenSim.Client.Linden
|
|||
/// </summary>
|
||||
protected ILoginServiceToRegionsConnector m_regionsConnector;
|
||||
|
||||
|
||||
public LLStandaloneLoginService(
|
||||
UserManagerBase userManager, string welcomeMess,
|
||||
IInterServiceInventoryServices interServiceInventoryService,
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace OpenSim.Framework.Communications.Services
|
|||
// Reject the login
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[LOGIN END]: XMLRPC Notifying user {0} {1} that they are already logged in",
|
||||
"[LOGIN END]: XMLRPC Notifying user {0} {1} that they are already logged in",
|
||||
firstname, lastname);
|
||||
|
||||
return logResponse.CreateAlreadyLoggedInResponse();
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
/// <summary>
|
||||
/// Plugin for managing temporary user profiles.
|
||||
/// </summary>
|
||||
public class TemporaryUserProfilePlugin : IUserDataPlugin
|
||||
{
|
||||
protected Dictionary<UUID, UserProfileData> m_profiles = new Dictionary<UUID, UserProfileData>();
|
||||
|
||||
public string Name { get { return "TemporaryUserProfilePlugin"; } }
|
||||
public string Version { get { return "0.1"; } }
|
||||
public void Initialise() {}
|
||||
public void Initialise(string connect) {}
|
||||
public void Dispose() {}
|
||||
|
||||
public UserProfileData GetUserByUUID(UUID user)
|
||||
{
|
||||
lock (m_profiles)
|
||||
{
|
||||
if (m_profiles.ContainsKey(user))
|
||||
return m_profiles[user];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public UserProfileData GetUserByName(string fname, string lname)
|
||||
{
|
||||
// We deliberately don't look up a temporary profile by name so that we don't obscure non-temporary
|
||||
// profiles.
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public UserProfileData GetUserByUri(Uri uri) { return null; }
|
||||
public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; }
|
||||
public UserAgentData GetAgentByUUID(UUID user) { return null; }
|
||||
public UserAgentData GetAgentByName(string name) { return null; }
|
||||
public UserAgentData GetAgentByName(string fname, string lname) { return null; }
|
||||
public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {}
|
||||
public void AddNewUserProfile(UserProfileData user) {}
|
||||
public bool UpdateUserProfile(UserProfileData user) { return false; }
|
||||
public void AddNewUserAgent(UserAgentData agent) {}
|
||||
public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) {}
|
||||
public void RemoveUserFriend(UUID friendlistowner, UUID friend) {}
|
||||
public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {}
|
||||
public List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return null; }
|
||||
public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; }
|
||||
public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; }
|
||||
public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; }
|
||||
public AvatarAppearance GetUserAppearance(UUID user) { return null; }
|
||||
public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {}
|
||||
public void ResetAttachments(UUID userID) {}
|
||||
public void LogoutUsers(UUID regionID) {}
|
||||
}
|
||||
}
|
|
@ -280,6 +280,9 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
[Test]
|
||||
public void T023_TestAuthenticatedLoginAlreadyLoggedIn()
|
||||
{
|
||||
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. " +
|
||||
"If this takes longer than a few minutes please contact the grid owner. " +
|
||||
|
@ -303,7 +306,6 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
|
||||
// Then we try again, this time expecting failure.
|
||||
request = new XmlRpcRequest("login_to_simulator", sendParams);
|
||||
|
||||
response = m_loginService.XmlRpcLoginMethod(request);
|
||||
responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo(error_already_logged));
|
||||
|
@ -314,11 +316,12 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
response = m_loginService.XmlRpcLoginMethod(request);
|
||||
responseData = (Hashtable)response.Value;
|
||||
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
|
||||
|
||||
Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()");
|
||||
}
|
||||
|
||||
public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector
|
||||
{
|
||||
|
||||
private List<RegionInfo> m_regionsList = new List<RegionInfo>();
|
||||
|
||||
public void AddRegion(RegionInfo regionInfo)
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
m_log.ErrorFormat(
|
||||
"[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}",
|
||||
data.FirstName, data.SurName, plugin.Name, e.ToString());
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to Store WebLoginKey via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to Store WebLoginKey via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to RemoveUserFriend via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to RemoveUserFriend via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to UpdateUserFriendPerms via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to UpdateUserFriendPerms via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -707,24 +707,30 @@ namespace OpenSim.Framework.Communications
|
|||
public abstract UserProfileData SetupMasterUser(UUID uuid);
|
||||
|
||||
/// <summary>
|
||||
/// Add agent to DB
|
||||
/// Add an agent using data plugins.
|
||||
/// </summary>
|
||||
/// <param name="agentdata">The agent data to be added</param>
|
||||
/// <returns>
|
||||
/// true if at least one plugin added the user agent. false if no plugin successfully added the agent
|
||||
/// </returns>
|
||||
public virtual bool AddUserAgent(UserAgentData agentdata)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
foreach (IUserDataPlugin plugin in m_plugins)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.AddNewUserAgent(agentdata);
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to add agent via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to add agent via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -745,7 +751,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString());
|
||||
m_log.ErrorFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -762,7 +768,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[USERSTORAGE]: Unable to update user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString());
|
||||
m_log.ErrorFormat("[USERSTORAGE]: Unable to update user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -811,10 +817,10 @@ namespace OpenSim.Framework.Communications
|
|||
m_log.InfoFormat("[USERAUTH]: Successfully generated new auth key for user {0}", userID);
|
||||
}
|
||||
else
|
||||
m_log.Info("[USERAUTH]: Unauthorized key generation request. Denying new key.");
|
||||
m_log.Warn("[USERAUTH]: Unauthorized key generation request. Denying new key.");
|
||||
}
|
||||
else
|
||||
m_log.Info("[USERAUTH]: User not found.");
|
||||
m_log.Warn("[USERAUTH]: User not found.");
|
||||
|
||||
return url + newKey;
|
||||
}
|
||||
|
|
|
@ -70,14 +70,12 @@ namespace OpenSim.Region.Communications.Hypergrid
|
|||
|
||||
HGUserServices userServices = new HGUserServices(this);
|
||||
// This plugin arrangement could eventually be configurable rather than hardcoded here.
|
||||
OGS1UserDataPlugin userDataPlugin = new OGS1UserDataPlugin(this);
|
||||
userServices.AddPlugin(userDataPlugin);
|
||||
userServices.AddPlugin(new TemporaryUserProfilePlugin());
|
||||
userServices.AddPlugin(new OGS1UserDataPlugin(this));
|
||||
|
||||
m_userService = userServices;
|
||||
m_messageService = userServices;
|
||||
m_avatarService = (IAvatarService)m_userService;
|
||||
|
||||
m_avatarService = userServices;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ namespace OpenSim.Region.Communications.Hypergrid
|
|||
|
||||
HGUserServices hgUserService = new HGUserServices(this, localUserService);
|
||||
// This plugin arrangement could eventually be configurable rather than hardcoded here.
|
||||
hgUserService.AddPlugin(new TemporaryUserProfilePlugin());
|
||||
hgUserService.AddPlugin(new OGS1UserDataPlugin(this));
|
||||
|
||||
m_userService = hgUserService;
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
LocalUserServices lus
|
||||
= new LocalUserServices(
|
||||
serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
|
||||
lus.AddPlugin(new TemporaryUserProfilePlugin());
|
||||
lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
|
||||
m_userService = lus;
|
||||
m_userAdminService = lus;
|
||||
|
|
|
@ -57,8 +57,8 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
|
||||
// This plugin arrangement could eventually be configurable rather than hardcoded here.
|
||||
OGS1UserServices userServices = new OGS1UserServices(this);
|
||||
OGS1UserDataPlugin userDataPlugin = new OGS1UserDataPlugin(this);
|
||||
userServices.AddPlugin(userDataPlugin);
|
||||
userServices.AddPlugin(new TemporaryUserProfilePlugin());
|
||||
userServices.AddPlugin(new OGS1UserDataPlugin(this));
|
||||
|
||||
m_userService = userServices;
|
||||
m_messageService = userServices;
|
||||
|
|
|
@ -56,18 +56,18 @@ namespace OpenSim.Tests.Common.Mock
|
|||
public TestCommunicationsManager(NetworkServersInfo serversInfo)
|
||||
: base(serversInfo, new BaseHttpServer(666), null, false, null)
|
||||
{
|
||||
m_userDataPlugin = new TestUserDataPlugin();
|
||||
m_inventoryDataPlugin = new TestInventoryDataPlugin();
|
||||
|
||||
SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin());
|
||||
m_assetCache = new AssetCache(assetService);
|
||||
|
||||
LocalInventoryService lis = new LocalInventoryService();
|
||||
m_inventoryDataPlugin = new TestInventoryDataPlugin();
|
||||
lis.AddPlugin(m_inventoryDataPlugin);
|
||||
m_interServiceInventoryService = lis;
|
||||
AddInventoryService(lis);
|
||||
|
||||
LocalUserServices lus = new LocalUserServices(991, 992, this);
|
||||
lus.AddPlugin(new TemporaryUserProfilePlugin());
|
||||
m_userDataPlugin = new TestUserDataPlugin();
|
||||
lus.AddPlugin(m_userDataPlugin);
|
||||
m_userService = lus;
|
||||
m_userAdminService = lus;
|
||||
|
|
Loading…
Reference in New Issue