* Fix hypergrid standalone login by overriding AddNewUserAgent in HGUserServices

0.6.5-rc1
Justin Clarke Casey 2009-04-22 23:04:32 +00:00
parent 342126b7b9
commit bd8e4a8892
5 changed files with 38 additions and 26 deletions

View File

@ -206,8 +206,11 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
{ {
// Standalone mode // Standalone mode
HGInventoryServiceClient inventoryService = new HGInventoryServiceClient(m_openSim.NetServersInfo.InventoryURL, null, false); HGInventoryServiceClient inventoryService
inventoryService.AddPlugin(m_openSim.ConfigurationSettings.StandaloneInventoryPlugin, m_openSim.ConfigurationSettings.StandaloneInventorySource); = new HGInventoryServiceClient(m_openSim.NetServersInfo.InventoryURL, null, false);
inventoryService.AddPlugin(
m_openSim.ConfigurationSettings.StandaloneInventoryPlugin,
m_openSim.ConfigurationSettings.StandaloneInventorySource);
HGGridServicesStandalone gridService HGGridServicesStandalone gridService
= new HGGridServicesStandalone( = new HGGridServicesStandalone(
@ -227,7 +230,10 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
protected virtual void InitialiseHGGridServices(LibraryRootFolder libraryRootFolder) 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; HGServices = ((HGCommunicationsGridMode) m_commsManager).HGServices;
@ -240,7 +246,8 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
// provide grid info // provide grid info
m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source); m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source);
m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); 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));
} }
} }
} }

View File

@ -61,7 +61,6 @@ namespace OpenSim.Framework.Communications.Services
/// </summary> /// </summary>
protected ILoginServiceToRegionsConnector m_regionsConnector; protected ILoginServiceToRegionsConnector m_regionsConnector;
public HGLoginAuthService( public HGLoginAuthService(
UserManagerBase userManager, string welcomeMess, UserManagerBase userManager, string welcomeMess,
IInterServiceInventoryServices interServiceInventoryService, IInterServiceInventoryServices interServiceInventoryService,
@ -89,7 +88,7 @@ namespace OpenSim.Framework.Communications.Services
public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 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); XmlRpcResponse response = base.XmlRpcLoginMethod(request);
Hashtable responseData = (Hashtable)response.Value; Hashtable responseData = (Hashtable)response.Value;
@ -135,7 +134,6 @@ namespace OpenSim.Framework.Communications.Services
public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request)
{ {
// Verify the key of who's calling // Verify the key of who's calling
UUID userID = UUID.Zero; UUID userID = UUID.Zero;
UUID authKey = UUID.Zero; UUID authKey = UUID.Zero;
@ -254,7 +252,6 @@ namespace OpenSim.Framework.Communications.Services
return m_regionsConnector.RequestNeighbourInfo(homeRegionId); return m_regionsConnector.RequestNeighbourInfo(homeRegionId);
} }
/// <summary> /// <summary>
/// Not really informing the region. Just filling out the response fields related to the region. /// Not really informing the region. Just filling out the response fields related to the region.
/// </summary> /// </summary>

View File

@ -430,6 +430,8 @@ namespace OpenSim.Framework.Communications
/// <param name="request">The users loginrequest</param> /// <param name="request">The users loginrequest</param>
public void CreateAgent(UserProfileData profile, XmlRpcRequest request) public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
{ {
//m_log.DebugFormat("[USER MANAGER]: Creating agent {0} {1}", profile.Name, profile.ID);
UserAgentData agent = new UserAgentData(); UserAgentData agent = new UserAgentData();
// User connection // User connection
@ -483,6 +485,8 @@ namespace OpenSim.Framework.Communications
public void CreateAgent(UserProfileData profile, OSD request) public void CreateAgent(UserProfileData profile, OSD request)
{ {
//m_log.DebugFormat("[USER MANAGER]: Creating agent {0} {1}", profile.Name, profile.ID);
UserAgentData agent = new UserAgentData(); UserAgentData agent = new UserAgentData();
// User connection // User connection
@ -538,6 +542,8 @@ namespace OpenSim.Framework.Communications
/// <returns>Successful?</returns> /// <returns>Successful?</returns>
public bool CommitAgent(ref UserProfileData profile) 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: how is this function different from setUserProfile? -> Add AddUserAgent() here and commit both tables "users" and "agents"
// TODO: what is the logic should be? // TODO: what is the logic should be?
bool ret = false; bool ret = false;
@ -704,7 +710,7 @@ namespace OpenSim.Framework.Communications
/// Add agent to DB /// Add agent to DB
/// </summary> /// </summary>
/// <param name="agentdata">The agent data to be added</param> /// <param name="agentdata">The agent data to be added</param>
public bool AddUserAgent(UserAgentData agentdata) public virtual bool AddUserAgent(UserAgentData agentdata)
{ {
foreach (IUserDataPlugin plugin in m_plugins) foreach (IUserDataPlugin plugin in m_plugins)
{ {

View File

@ -63,11 +63,14 @@ namespace OpenSim.Region.Communications.Hypergrid
m_localUserServices = local; m_localUserServices = local;
} }
/// <summary> public override bool AddUserAgent(UserAgentData agentdata)
/// Get a user agent from the user server {
/// </summary> if (m_localUserServices != null)
/// <param name="avatarID"></param> return m_localUserServices.AddUserAgent(agentdata);
/// <returns>null if the request fails</returns>
return base.AddUserAgent(agentdata);
}
public override UserAgentData GetAgentByUUID(UUID userId) public override UserAgentData GetAgentByUUID(UUID userId)
{ {
string url = string.Empty; string url = string.Empty;
@ -77,14 +80,6 @@ namespace OpenSim.Region.Communications.Hypergrid
return base.GetAgentByUUID(userId); return base.GetAgentByUUID(userId);
} }
/// <summary>
/// Logs off a user on the user server
/// </summary>
/// <param name="UserID">UUID of the user</param>
/// <param name="regionID">UUID of the Region</param>
/// <param name="regionhandle">regionhandle</param>
/// <param name="position">final position</param>
/// <param name="lookat">final lookat</param>
public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
{ {
string url = string.Empty; string url = string.Empty;

View File

@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid
protected bool m_enabled = false; // Module is only enabled if running in standalone mode protected bool m_enabled = false; // Module is only enabled if running in standalone mode
public bool RegionLoginsEnabled public bool RegionLoginsEnabled
{ {
get get
@ -88,7 +87,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
if (m_enabled) if (m_enabled)
{ {
m_log.Debug("[HGLogin] HGlogin module enabled"); m_log.Debug("[HGLogin]: HGlogin module enabled");
bool authenticate = true; bool authenticate = true;
string welcomeMessage = "Welcome to OpenSim"; string welcomeMessage = "Welcome to OpenSim";
IConfig standaloneConfig = source.Configs["StandAlone"]; IConfig standaloneConfig = source.Configs["StandAlone"];
@ -104,7 +103,15 @@ namespace OpenSim.Region.CoreModules.Hypergrid
IHttpServer httpServer = m_firstScene.CommsManager.HttpServer; 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 //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_login", m_loginService.XmlRpcLoginMethod);
httpServer.AddXmlRPCHandler("hg_new_auth_key", m_loginService.XmlRpcGenerateKeyMethod); httpServer.AddXmlRPCHandler("hg_new_auth_key", m_loginService.XmlRpcGenerateKeyMethod);