TOS module. WARNING: migration in GridUser table.
parent
495a3e7daf
commit
ae58cf4224
|
@ -17,3 +17,11 @@ CREATE TABLE `GridUser` (
|
|||
) ENGINE=InnoDB;
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 2 # --------------------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE `GridUser` ADD COLUMN TOS CHAR(36);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -68,8 +68,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
// 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_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)
|
||||
|
@ -83,8 +86,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
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_GridUserService.LoggedOut(
|
||||
client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID,
|
||||
userId, client.SessionId, client.Scene.RegionInfo.RegionID,
|
||||
client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -917,6 +917,34 @@
|
|||
;# {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
|
||||
;# {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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue