From bd8e4a8892e204e2d9e7e24087f7200c16be57f0 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 22 Apr 2009 23:04:32 +0000
Subject: * Fix hypergrid standalone login by overriding AddNewUserAgent in
HGUserServices
---
.../CreateCommsManager/CreateCommsManagerPlugin.cs | 15 +++++++++++----
.../Communications/Services/HGLoginAuthService.cs | 5 +----
OpenSim/Framework/Communications/UserManagerBase.cs | 10 ++++++++--
.../Communications/Hypergrid/HGUserServices.cs | 21 ++++++++-------------
.../Hypergrid/HGStandaloneLoginModule.cs | 13 ++++++++++---
5 files changed, 38 insertions(+), 26 deletions(-)
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
index c5aabc6..3b98038 100644
--- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
+++ b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
@@ -206,8 +206,11 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
{
// Standalone mode
- HGInventoryServiceClient inventoryService = new HGInventoryServiceClient(m_openSim.NetServersInfo.InventoryURL, null, false);
- inventoryService.AddPlugin(m_openSim.ConfigurationSettings.StandaloneInventoryPlugin, m_openSim.ConfigurationSettings.StandaloneInventorySource);
+ HGInventoryServiceClient inventoryService
+ = new HGInventoryServiceClient(m_openSim.NetServersInfo.InventoryURL, null, false);
+ inventoryService.AddPlugin(
+ m_openSim.ConfigurationSettings.StandaloneInventoryPlugin,
+ m_openSim.ConfigurationSettings.StandaloneInventorySource);
HGGridServicesStandalone gridService
= new HGGridServicesStandalone(
@@ -227,7 +230,10 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
protected virtual void InitialiseHGGridServices(LibraryRootFolder libraryRootFolder)
{
- m_commsManager = new HGCommunicationsGridMode(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager, libraryRootFolder);
+ m_commsManager
+ = new HGCommunicationsGridMode(
+ m_openSim.NetServersInfo, m_httpServer,
+ m_openSim.AssetCache, m_openSim.SceneManager, libraryRootFolder);
HGServices = ((HGCommunicationsGridMode) m_commsManager).HGServices;
@@ -240,7 +246,8 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
// provide grid info
m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source);
m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
- m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
+ m_httpServer.AddStreamHandler(
+ new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
}
}
}
diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
index 5e357d5..b62e4a2 100644
--- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
+++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
@@ -61,7 +61,6 @@ namespace OpenSim.Framework.Communications.Services
///
protected ILoginServiceToRegionsConnector m_regionsConnector;
-
public HGLoginAuthService(
UserManagerBase userManager, string welcomeMess,
IInterServiceInventoryServices interServiceInventoryService,
@@ -89,7 +88,7 @@ namespace OpenSim.Framework.Communications.Services
public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{
- m_log.Info("[HGLOGIN] HGLogin called " + request.MethodName);
+ m_log.Info("[HGLOGIN]: HGLogin called " + request.MethodName);
XmlRpcResponse response = base.XmlRpcLoginMethod(request);
Hashtable responseData = (Hashtable)response.Value;
@@ -135,7 +134,6 @@ namespace OpenSim.Framework.Communications.Services
public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request)
{
-
// Verify the key of who's calling
UUID userID = UUID.Zero;
UUID authKey = UUID.Zero;
@@ -254,7 +252,6 @@ namespace OpenSim.Framework.Communications.Services
return m_regionsConnector.RequestNeighbourInfo(homeRegionId);
}
-
///
/// Not really informing the region. Just filling out the response fields related to the region.
///
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 2d0bf63..9cd7658 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -430,6 +430,8 @@ namespace OpenSim.Framework.Communications
/// The users loginrequest
public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
{
+ //m_log.DebugFormat("[USER MANAGER]: Creating agent {0} {1}", profile.Name, profile.ID);
+
UserAgentData agent = new UserAgentData();
// User connection
@@ -483,6 +485,8 @@ namespace OpenSim.Framework.Communications
public void CreateAgent(UserProfileData profile, OSD request)
{
+ //m_log.DebugFormat("[USER MANAGER]: Creating agent {0} {1}", profile.Name, profile.ID);
+
UserAgentData agent = new UserAgentData();
// User connection
@@ -538,6 +542,8 @@ namespace OpenSim.Framework.Communications
/// Successful?
public bool CommitAgent(ref UserProfileData profile)
{
+ //m_log.DebugFormat("[USER MANAGER]: Committing agent {0} {1}", profile.Name, profile.ID);
+
// TODO: how is this function different from setUserProfile? -> Add AddUserAgent() here and commit both tables "users" and "agents"
// TODO: what is the logic should be?
bool ret = false;
@@ -704,7 +710,7 @@ namespace OpenSim.Framework.Communications
/// Add agent to DB
///
/// The agent data to be added
- public bool AddUserAgent(UserAgentData agentdata)
+ public virtual bool AddUserAgent(UserAgentData agentdata)
{
foreach (IUserDataPlugin plugin in m_plugins)
{
@@ -845,7 +851,7 @@ namespace OpenSim.Framework.Communications
if (userProfile != null && userProfile.CurrentAgent != null)
{
- m_log.DebugFormat("[USERAUTH]: Verifying session {0} for {1}; current session {2}", sessionID, userID, userProfile.CurrentAgent.SessionID);
+ m_log.DebugFormat("[USER AUTH]: Verifying session {0} for {1}; current session {2}", sessionID, userID, userProfile.CurrentAgent.SessionID);
if (userProfile.CurrentAgent.SessionID == sessionID)
{
return true;
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
index 93d5434..8d9ca34 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
@@ -62,12 +62,15 @@ namespace OpenSim.Region.Communications.Hypergrid
{
m_localUserServices = local;
}
+
+ public override bool AddUserAgent(UserAgentData agentdata)
+ {
+ if (m_localUserServices != null)
+ return m_localUserServices.AddUserAgent(agentdata);
+
+ return base.AddUserAgent(agentdata);
+ }
- ///
- /// Get a user agent from the user server
- ///
- ///
- /// null if the request fails
public override UserAgentData GetAgentByUUID(UUID userId)
{
string url = string.Empty;
@@ -77,14 +80,6 @@ namespace OpenSim.Region.Communications.Hypergrid
return base.GetAgentByUUID(userId);
}
- ///
- /// Logs off a user on the user server
- ///
- /// UUID of the user
- /// UUID of the Region
- /// regionhandle
- /// final position
- /// final lookat
public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
{
string url = string.Empty;
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
index c458b89..2c7ba93 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
@@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid
protected bool m_enabled = false; // Module is only enabled if running in standalone mode
-
public bool RegionLoginsEnabled
{
get
@@ -88,7 +87,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
if (m_enabled)
{
- m_log.Debug("[HGLogin] HGlogin module enabled");
+ m_log.Debug("[HGLogin]: HGlogin module enabled");
bool authenticate = true;
string welcomeMessage = "Welcome to OpenSim";
IConfig standaloneConfig = source.Configs["StandAlone"];
@@ -104,7 +103,15 @@ namespace OpenSim.Region.CoreModules.Hypergrid
IHttpServer httpServer = m_firstScene.CommsManager.HttpServer;
//TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
- m_loginService = new HGLoginAuthService((UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage, m_firstScene.CommsManager.InterServiceInventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate, rootFolder, this);
+ m_loginService
+ = new HGLoginAuthService(
+ (UserManagerBase)m_firstScene.CommsManager.UserAdminService,
+ welcomeMessage,
+ m_firstScene.CommsManager.InterServiceInventoryService,
+ m_firstScene.CommsManager.NetworkServersInfo,
+ authenticate,
+ rootFolder,
+ this);
httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod);
httpServer.AddXmlRPCHandler("hg_new_auth_key", m_loginService.XmlRpcGenerateKeyMethod);
--
cgit v1.1