Use GridUser properly for foreign users.

connector_plugin
Diva Canto 2012-09-26 12:40:41 -07:00
parent 80133f9ebe
commit 3c77b8f463
5 changed files with 35 additions and 8 deletions

View File

@ -245,6 +245,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
// Log them out of this grid // Log them out of this grid
Scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); Scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
string userId = Scene.UserManagementModule.GetUserUUI(sp.UUID);
Scene.GridUserService.LoggedOut(userId, UUID.Zero, Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
} }
} }

View File

@ -65,11 +65,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
public void OnMakeRootAgent(ScenePresence sp) public void OnMakeRootAgent(ScenePresence sp)
{ {
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
if (sp.PresenceType != PresenceType.Npc) if (sp.PresenceType != PresenceType.Npc)
{ {
string userid = sp.Scene.UserManagementModule.GetUserUUI(sp.UUID); string userid = sp.Scene.UserManagementModule.GetUserUUI(sp.UUID);
//m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName);
m_GridUserService.SetLastPosition( m_GridUserService.SetLastPosition(
userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
} }
@ -85,13 +84,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
if (client.SceneAgent.IsChildAgent) if (client.SceneAgent.IsChildAgent)
return; return;
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
string userId = client.AgentId.ToString(); string userId = client.AgentId.ToString();
if (client.Scene is Scene) if (client.Scene is Scene)
{ {
Scene s = (Scene)client.Scene; Scene s = (Scene)client.Scene;
userId = s.UserManagementModule.GetUserUUI(client.AgentId); userId = s.UserManagementModule.GetUserUUI(client.AgentId);
} }
//m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", userId, client.Scene.RegionInfo.RegionName);
m_GridUserService.LoggedOut( m_GridUserService.LoggedOut(
userId, client.SessionId, client.Scene.RegionInfo.RegionID, userId, client.SessionId, client.Scene.RegionInfo.RegionID,
client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);

View File

@ -57,6 +57,7 @@ namespace OpenSim.Services.HypergridService
private static IUserAccountService m_UserAccountService; private static IUserAccountService m_UserAccountService;
private static IUserAgentService m_UserAgentService; private static IUserAgentService m_UserAgentService;
private static ISimulationService m_SimulationService; private static ISimulationService m_SimulationService;
private static IGridUserService m_GridUserService;
private static string m_AllowedClients = string.Empty; private static string m_AllowedClients = string.Empty;
private static string m_DeniedClients = string.Empty; private static string m_DeniedClients = string.Empty;
@ -84,8 +85,9 @@ namespace OpenSim.Services.HypergridService
string gridService = serverConfig.GetString("GridService", String.Empty); string gridService = serverConfig.GetString("GridService", String.Empty);
string presenceService = serverConfig.GetString("PresenceService", String.Empty); string presenceService = serverConfig.GetString("PresenceService", String.Empty);
string simulationService = serverConfig.GetString("SimulationService", String.Empty); string simulationService = serverConfig.GetString("SimulationService", String.Empty);
string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
// These 3 are mandatory, the others aren't // These are mandatory, the others aren't
if (gridService == string.Empty || presenceService == string.Empty) if (gridService == string.Empty || presenceService == string.Empty)
throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
@ -105,6 +107,8 @@ namespace OpenSim.Services.HypergridService
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
if (homeUsersService != string.Empty) if (homeUsersService != string.Empty)
m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
if (gridUserService != string.Empty)
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
if (simService != null) if (simService != null)
m_SimulationService = simService; m_SimulationService = simService;
@ -295,8 +299,6 @@ namespace OpenSim.Services.HypergridService
} }
} }
// May want to authorize
bool isFirstLogin = false; bool isFirstLogin = false;
// //
// Login the presence, if it's not there yet (by the login service) // Login the presence, if it's not there yet (by the login service)
@ -306,6 +308,7 @@ namespace OpenSim.Services.HypergridService
isFirstLogin = true; isFirstLogin = true;
else else
{
if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
{ {
reason = "Unable to login presence"; reason = "Unable to login presence";
@ -315,6 +318,26 @@ namespace OpenSim.Services.HypergridService
} }
m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok");
// Also login foreigners with GridUser service
if (m_GridUserService != null && account == null)
{
string userId = aCircuit.AgentID.ToString();
string first = aCircuit.firstname, last = aCircuit.lastname;
if (last.StartsWith("@"))
{
string[] parts = aCircuit.firstname.Split('.');
if (parts.Length >= 2)
{
first = parts[0];
last = parts[1];
}
}
userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
m_GridUserService.LoggedIn(userId);
}
}
// //
// Get the region // Get the region
// //

View File

@ -970,7 +970,8 @@
;; This page should have Accept/Decline links somewhere ;; This page should have Accept/Decline links somewhere
;; that affect the GridUsers table. If you don't have such ;; that affect the GridUsers table. If you don't have such
;; script in place, don't use the TOSModule ;; script in place, don't use the TOSModule. The TOSModule appends this URL
;; with a query ?user={userid}&sid={sessionid}
;# {TOS_URL} {} {The URL for the TOS page} {} ;# {TOS_URL} {} {The URL for the TOS page} {}
TOS_URL = "http://mygrid.com/tos" TOS_URL = "http://mygrid.com/tos"

View File

@ -130,6 +130,7 @@
LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService"
;; for the service ;; for the service
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService" UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"