diff options
author | Diva Canto | 2012-09-25 20:03:49 -0700 |
---|---|---|
committer | Diva Canto | 2012-09-25 20:03:49 -0700 |
commit | ae58cf42242433c786162b53a2724962f4a8380b (patch) | |
tree | b6011d3ea34e838138a63279ec5bf270c464d04d | |
parent | Oops, that should be inside the curly bracket. (diff) | |
download | opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.zip opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.gz opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.bz2 opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.xz |
TOS module. WARNING: migration in GridUser table.
Diffstat (limited to '')
7 files changed, 104 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/Resources/GridUserStore.migrations b/OpenSim/Data/MySQL/Resources/GridUserStore.migrations index 32b85ee..440d076 100644 --- a/OpenSim/Data/MySQL/Resources/GridUserStore.migrations +++ b/OpenSim/Data/MySQL/Resources/GridUserStore.migrations | |||
@@ -17,3 +17,11 @@ CREATE TABLE `GridUser` ( | |||
17 | ) ENGINE=InnoDB; | 17 | ) ENGINE=InnoDB; |
18 | 18 | ||
19 | COMMIT; | 19 | COMMIT; |
20 | |||
21 | :VERSION 2 # -------------------------- | ||
22 | |||
23 | BEGIN; | ||
24 | |||
25 | ALTER TABLE `GridUser` ADD COLUMN TOS CHAR(36); | ||
26 | |||
27 | COMMIT; | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs index b0edce7..dd8a8ef 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs | |||
@@ -68,8 +68,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
68 | // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); | 68 | // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); |
69 | 69 | ||
70 | if (sp.PresenceType != PresenceType.Npc) | 70 | if (sp.PresenceType != PresenceType.Npc) |
71 | { | ||
72 | string userid = sp.Scene.UserManagementModule.GetUserUUI(sp.UUID); | ||
71 | m_GridUserService.SetLastPosition( | 73 | m_GridUserService.SetLastPosition( |
72 | sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | 74 | userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); |
75 | } | ||
73 | } | 76 | } |
74 | 77 | ||
75 | public void OnNewClient(IClientAPI client) | 78 | public void OnNewClient(IClientAPI client) |
@@ -83,8 +86,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
83 | return; | 86 | return; |
84 | 87 | ||
85 | // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | 88 | // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); |
89 | string userId = client.AgentId.ToString(); | ||
90 | if (client.Scene is Scene) | ||
91 | { | ||
92 | Scene s = (Scene)client.Scene; | ||
93 | userId = s.UserManagementModule.GetUserUUI(client.AgentId); | ||
94 | } | ||
86 | m_GridUserService.LoggedOut( | 95 | m_GridUserService.LoggedOut( |
87 | client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, | 96 | userId, client.SessionId, client.Scene.RegionInfo.RegionID, |
88 | client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); | 97 | client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); |
89 | } | 98 | } |
90 | } | 99 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs index badb552..04acf67 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs | |||
@@ -44,6 +44,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | private const int KEEPTIME = 30; // 30 secs | ||
48 | private ExpiringCache<string, GridUserInfo> m_Infos = new ExpiringCache<string, GridUserInfo>(); | ||
49 | |||
47 | #region ISharedRegionModule | 50 | #region ISharedRegionModule |
48 | 51 | ||
49 | private bool m_Enabled = false; | 52 | private bool m_Enabled = false; |
@@ -128,23 +131,60 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
128 | 131 | ||
129 | public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat) | 132 | public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat) |
130 | { | 133 | { |
134 | if (m_Infos.Contains(userID)) | ||
135 | m_Infos.Remove(userID); | ||
136 | |||
131 | return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat); | 137 | return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat); |
132 | } | 138 | } |
133 | 139 | ||
134 | 140 | ||
135 | public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | 141 | public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) |
136 | { | 142 | { |
137 | return m_RemoteConnector.SetHome(userID, regionID, position, lookAt); | 143 | if (m_RemoteConnector.SetHome(userID, regionID, position, lookAt)) |
144 | { | ||
145 | // Update the cache too | ||
146 | GridUserInfo info = null; | ||
147 | if (m_Infos.TryGetValue(userID, out info)) | ||
148 | { | ||
149 | info.HomeRegionID = regionID; | ||
150 | info.HomePosition = position; | ||
151 | info.HomeLookAt = lookAt; | ||
152 | } | ||
153 | return true; | ||
154 | } | ||
155 | |||
156 | return false; | ||
138 | } | 157 | } |
139 | 158 | ||
140 | public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) | 159 | public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) |
141 | { | 160 | { |
142 | return m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt); | 161 | if (m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt)) |
162 | { | ||
163 | // Update the cache too | ||
164 | GridUserInfo info = null; | ||
165 | if (m_Infos.TryGetValue(userID, out info)) | ||
166 | { | ||
167 | info.LastRegionID = regionID; | ||
168 | info.LastPosition = position; | ||
169 | info.LastLookAt = lookAt; | ||
170 | } | ||
171 | return true; | ||
172 | } | ||
173 | |||
174 | return false; | ||
143 | } | 175 | } |
144 | 176 | ||
145 | public GridUserInfo GetGridUserInfo(string userID) | 177 | public GridUserInfo GetGridUserInfo(string userID) |
146 | { | 178 | { |
147 | return m_RemoteConnector.GetGridUserInfo(userID); | 179 | GridUserInfo info = null; |
180 | if (m_Infos.TryGetValue(userID, out info)) | ||
181 | return info; | ||
182 | |||
183 | info = m_RemoteConnector.GetGridUserInfo(userID); | ||
184 | |||
185 | m_Infos.AddOrUpdate(userID, info, KEEPTIME); | ||
186 | |||
187 | return info; | ||
148 | } | 188 | } |
149 | 189 | ||
150 | public GridUserInfo[] GetGridUserInfo(string[] userID) | 190 | public GridUserInfo[] GetGridUserInfo(string[] userID) |
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs index 0a52bfa..620ed3a 100644 --- a/OpenSim/Services/Interfaces/IGridUserService.cs +++ b/OpenSim/Services/Interfaces/IGridUserService.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Services.Interfaces | |||
50 | public DateTime Login; | 50 | public DateTime Login; |
51 | public DateTime Logout; | 51 | public DateTime Logout; |
52 | 52 | ||
53 | public string TOS = string.Empty; | ||
54 | |||
53 | public GridUserInfo() {} | 55 | public GridUserInfo() {} |
54 | 56 | ||
55 | public GridUserInfo(Dictionary<string, object> kvp) | 57 | public GridUserInfo(Dictionary<string, object> kvp) |
@@ -78,6 +80,11 @@ namespace OpenSim.Services.Interfaces | |||
78 | if (kvp.ContainsKey("Online")) | 80 | if (kvp.ContainsKey("Online")) |
79 | Boolean.TryParse(kvp["Online"].ToString(), out Online); | 81 | Boolean.TryParse(kvp["Online"].ToString(), out Online); |
80 | 82 | ||
83 | if (kvp.ContainsKey("TOS")) | ||
84 | TOS = kvp["TOS"].ToString(); | ||
85 | else | ||
86 | TOS = string.Empty; | ||
87 | |||
81 | } | 88 | } |
82 | 89 | ||
83 | public Dictionary<string, object> ToKeyValuePairs() | 90 | public Dictionary<string, object> ToKeyValuePairs() |
@@ -97,6 +104,7 @@ namespace OpenSim.Services.Interfaces | |||
97 | result["Login"] = Login.ToString(); | 104 | result["Login"] = Login.ToString(); |
98 | result["Logout"] = Logout.ToString(); | 105 | result["Logout"] = Logout.ToString(); |
99 | 106 | ||
107 | result["TOS"] = TOS; | ||
100 | 108 | ||
101 | return result; | 109 | return result; |
102 | } | 110 | } |
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index ac3d8fd..8eae859 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs | |||
@@ -70,6 +70,8 @@ namespace OpenSim.Services.UserAccountService | |||
70 | info.Login = Util.ToDateTime(Convert.ToInt32(d.Data["Login"])); | 70 | info.Login = Util.ToDateTime(Convert.ToInt32(d.Data["Login"])); |
71 | info.Logout = Util.ToDateTime(Convert.ToInt32(d.Data["Logout"])); | 71 | info.Logout = Util.ToDateTime(Convert.ToInt32(d.Data["Logout"])); |
72 | 72 | ||
73 | info.TOS = d.Data["TOS"]; | ||
74 | |||
73 | return info; | 75 | return info; |
74 | } | 76 | } |
75 | 77 | ||
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 3ec4bab..a602dcc 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -917,6 +917,34 @@ | |||
917 | ;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island | 917 | ;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island |
918 | ; InitialTerrain = "pinhead-island" | 918 | ; InitialTerrain = "pinhead-island" |
919 | 919 | ||
920 | [TOSModule] | ||
921 | ;; Terms of Service module. It requires an external web script. Unless you | ||
922 | ;; have that in place, don't enable this module. | ||
923 | |||
924 | ;# {Enabled} {} {Enable TOS facilities} {true false} false | ||
925 | ; Enabled = false | ||
926 | |||
927 | ;; Should local users be shown the TOS on first login? | ||
928 | ;# {ShowToLocalUsers} {} {Show TOS to local users} {true false} false | ||
929 | ; ShowToLocalUsers = false | ||
930 | ;; Should foreign users be shown the TOS on first HG login? | ||
931 | ;# {ShowToForeignUsers} {} {Show TOS to foreign users} {true false} true | ||
932 | ; ShowToForeignUsers = true | ||
933 | |||
934 | ;; Tell the users what this is about | ||
935 | ; Message = "Please read and agree to the Terms of Service" | ||
936 | |||
937 | ;; How much time do the users have to accept the TOS before they get kicked out? | ||
938 | ;; (in minutes) | ||
939 | ; Timeout = 5 | ||
940 | |||
941 | ;; This page should have Accept/Decline links somewhere | ||
942 | ;; that affect the GridUsers table. If you don't have such | ||
943 | ;; script in place, don't use the TOSModule | ||
944 | ;# {TOS_URL} {} {The URL for the TOS page} {} | ||
945 | TOS_URL = "http://mygrid.com/tos" | ||
946 | |||
947 | |||
920 | [Architecture] | 948 | [Architecture] |
921 | ;# {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 | 949 | ;# {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 |
922 | ;; Uncomment one of the following includes as required. For instance, to create a standalone OpenSim, | 950 | ;; Uncomment one of the following includes as required. For instance, to create a standalone OpenSim, |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 315ffbe..744187b 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -1624,6 +1624,10 @@ | |||
1624 | [Terrain] | 1624 | [Terrain] |
1625 | InitialTerrain = "pinhead-island" | 1625 | InitialTerrain = "pinhead-island" |
1626 | 1626 | ||
1627 | [TOSModule] | ||
1628 | ;; Enable TOS facilities | ||
1629 | Enabled = false | ||
1630 | |||
1627 | ;; | 1631 | ;; |
1628 | ;; If you are using a simian grid frontend you can enable | 1632 | ;; If you are using a simian grid frontend you can enable |
1629 | ;; this module to upload tile images for the mapping fn | 1633 | ;; this module to upload tile images for the mapping fn |