Merge commit '3c77b8f463a852aecf3cb29fe4e5f4614f474dbf' into careminster

avinationmerge
Melanie 2012-09-27 15:46:35 +01:00
commit 637f5440fe
12 changed files with 147 additions and 19 deletions

View File

@ -17,3 +17,11 @@ CREATE TABLE `GridUser` (
) ENGINE=InnoDB;
COMMIT;
:VERSION 2 # --------------------------
BEGIN;
ALTER TABLE `GridUser` ADD COLUMN TOS CHAR(36);
COMMIT;

View File

@ -106,7 +106,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return m_ExportedAppearances;
}
}
#region ISharedRegionModule
@ -149,9 +148,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
base.AddRegion(scene);
if (m_Enabled)
{
scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
}
}
void OnIncomingSceneObject(SceneObjectGroup so)
@ -245,6 +245,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
// Log them out of this grid
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

@ -137,6 +137,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
ud.FirstName = words[0];
ud.LastName = "@" + words[1];
users.Add(ud);
// WARNING! that uriStr is not quite right... it may be missing the / at the end,
// which will cause trouble (duplicate entries on some tables). We should
// get the UUI instead from the UAS. TO BE FIXED.
AddUser(userID, names[0], names[1], uriStr);
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
}

View File

@ -429,8 +429,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public void AddUser(UUID uuid, string first, string last, string homeURL)
{
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
//m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
AddUser(uuid, homeURL + ";" + first + " " + last);
}
@ -553,8 +552,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
MainConsole.Instance.Output("-----------------------------------------------------------------------------");
foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
{
MainConsole.Instance.Output(String.Format("{0} {1} {2}",
kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
MainConsole.Instance.Output(String.Format("{0} {1} {2} ({3})",
kvp.Key, kvp.Value.FirstName, kvp.Value.LastName, kvp.Value.HomeURL));
}
return;

View File

@ -65,11 +65,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
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)
{
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(
sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
}
}
public void OnNewClient(IClientAPI client)
@ -82,9 +84,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
if (client.SceneAgent.IsChildAgent)
return;
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
string userId = client.AgentId.ToString();
if (client.Scene is Scene)
{
Scene s = (Scene)client.Scene;
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(
client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID,
userId, client.SessionId, client.Scene.RegionInfo.RegionID,
client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
}
}

View File

@ -44,6 +44,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const int KEEPTIME = 30; // 30 secs
private ExpiringCache<string, GridUserInfo> m_Infos = new ExpiringCache<string, GridUserInfo>();
#region ISharedRegionModule
private bool m_Enabled = false;
@ -128,23 +131,60 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat)
{
if (m_Infos.Contains(userID))
m_Infos.Remove(userID);
return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat);
}
public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
{
return m_RemoteConnector.SetHome(userID, regionID, position, lookAt);
if (m_RemoteConnector.SetHome(userID, regionID, position, lookAt))
{
// Update the cache too
GridUserInfo info = null;
if (m_Infos.TryGetValue(userID, out info))
{
info.HomeRegionID = regionID;
info.HomePosition = position;
info.HomeLookAt = lookAt;
}
return true;
}
return false;
}
public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
{
return m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt);
if (m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt))
{
// Update the cache too
GridUserInfo info = null;
if (m_Infos.TryGetValue(userID, out info))
{
info.LastRegionID = regionID;
info.LastPosition = position;
info.LastLookAt = lookAt;
}
return true;
}
return false;
}
public GridUserInfo GetGridUserInfo(string userID)
{
return m_RemoteConnector.GetGridUserInfo(userID);
GridUserInfo info = null;
if (m_Infos.TryGetValue(userID, out info))
return info;
info = m_RemoteConnector.GetGridUserInfo(userID);
m_Infos.AddOrUpdate(userID, info, KEEPTIME);
return info;
}
public GridUserInfo[] GetGridUserInfo(string[] userID)

View File

@ -57,6 +57,7 @@ namespace OpenSim.Services.HypergridService
private static IUserAccountService m_UserAccountService;
private static IUserAgentService m_UserAgentService;
private static ISimulationService m_SimulationService;
private static IGridUserService m_GridUserService;
private static string m_AllowedClients = 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 presenceService = serverConfig.GetString("PresenceService", 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)
throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
@ -105,6 +107,8 @@ namespace OpenSim.Services.HypergridService
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
if (homeUsersService != string.Empty)
m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
if (gridUserService != string.Empty)
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
if (simService != null)
m_SimulationService = simService;
@ -295,8 +299,6 @@ namespace OpenSim.Services.HypergridService
}
}
// May want to authorize
bool isFirstLogin = false;
//
// Login the presence, if it's not there yet (by the login service)
@ -305,7 +307,8 @@ namespace OpenSim.Services.HypergridService
if (presence != null) // it has been placed there by the login service
isFirstLogin = true;
else
else
{
if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
{
reason = "Unable to login presence";
@ -315,6 +318,26 @@ namespace OpenSim.Services.HypergridService
}
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
//

View File

@ -50,6 +50,8 @@ namespace OpenSim.Services.Interfaces
public DateTime Login;
public DateTime Logout;
public string TOS = string.Empty;
public GridUserInfo() {}
public GridUserInfo(Dictionary<string, object> kvp)
@ -78,6 +80,11 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("Online"))
Boolean.TryParse(kvp["Online"].ToString(), out Online);
if (kvp.ContainsKey("TOS"))
TOS = kvp["TOS"].ToString();
else
TOS = string.Empty;
}
public Dictionary<string, object> ToKeyValuePairs()
@ -97,6 +104,7 @@ namespace OpenSim.Services.Interfaces
result["Login"] = Login.ToString();
result["Logout"] = Logout.ToString();
result["TOS"] = TOS;
return result;
}

View File

@ -70,6 +70,8 @@ namespace OpenSim.Services.UserAccountService
info.Login = Util.ToDateTime(Convert.ToInt32(d.Data["Login"]));
info.Logout = Util.ToDateTime(Convert.ToInt32(d.Data["Logout"]));
info.TOS = d.Data["TOS"];
return info;
}

View File

@ -947,6 +947,35 @@
;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island
; InitialTerrain = "pinhead-island"
[TOSModule]
;; Terms of Service module. It requires an external web script. Unless you
;; have that in place, don't enable this module.
;# {Enabled} {} {Enable TOS facilities} {true false} false
; Enabled = false
;; Should local users be shown the TOS on first login?
;# {ShowToLocalUsers} {} {Show TOS to local users} {true false} false
; ShowToLocalUsers = false
;; Should foreign users be shown the TOS on first HG login?
;# {ShowToForeignUsers} {} {Show TOS to foreign users} {true false} true
; ShowToForeignUsers = true
;; Tell the users what this is about
; Message = "Please read and agree to the Terms of Service"
;; How much time do the users have to accept the TOS before they get kicked out?
;; (in minutes)
; Timeout = 5
;; This page should have Accept/Decline links somewhere
;; that affect the GridUsers table. If you don't have such
;; 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 = "http://mygrid.com/tos"
[Architecture]
;# {Include-Architecture} {} {Choose one of the following architectures} {config-include/Standalone.ini config-include/StandaloneHypergrid.ini config-include/Grid.ini config-include/GridHypergrid.ini config-include/SimianGrid.ini config-include/HyperSimianGrid.ini} config-include/Standalone.ini
;; Uncomment one of the following includes as required. For instance, to create a standalone OpenSim,

View File

@ -1624,6 +1624,10 @@
[Terrain]
InitialTerrain = "pinhead-island"
[TOSModule]
;; Enable TOS facilities
Enabled = false
;;
;; If you are using a simian grid frontend you can enable
;; this module to upload tile images for the mapping fn

View File

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