aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-01-10 04:16:06 +0000
committerMelanie2010-01-10 04:16:06 +0000
commit1676e70dfe322381495b08ac1187ae9685f94e69 (patch)
treeb0b949af491811972dd866bff09f037e335c2b2b /OpenSim/Region
parentMerge branch 'master' into careminster (diff)
parentFix a small bug in login disable code (diff)
downloadopensim-SC_OLD-1676e70dfe322381495b08ac1187ae9685f94e69.zip
opensim-SC_OLD-1676e70dfe322381495b08ac1187ae9685f94e69.tar.gz
opensim-SC_OLD-1676e70dfe322381495b08ac1187ae9685f94e69.tar.bz2
opensim-SC_OLD-1676e70dfe322381495b08ac1187ae9685f94e69.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs48
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs31
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs158
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs7
8 files changed, 168 insertions, 108 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 82b2fd4..c9f2cfa 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -287,18 +287,6 @@ namespace OpenSim
287 "create region", 287 "create region",
288 "Create a new region", HandleCreateRegion); 288 "Create a new region", HandleCreateRegion);
289 289
290 m_console.Commands.AddCommand("region", false, "login enable",
291 "login enable",
292 "Enable logins to the simulator", HandleLoginEnable);
293
294 m_console.Commands.AddCommand("region", false, "login disable",
295 "login disable",
296 "Disable logins to the simulator", HandleLoginDisable);
297
298 m_console.Commands.AddCommand("region", false, "login status",
299 "login status",
300 "Display status of logins", HandleLoginStatus);
301
302 m_console.Commands.AddCommand("region", false, "restart", 290 m_console.Commands.AddCommand("region", false, "restart",
303 "restart", 291 "restart",
304 "Restart all sims in this instance", RunCommand); 292 "Restart all sims in this instance", RunCommand);
@@ -559,42 +547,6 @@ namespace OpenSim
559 } 547 }
560 548
561 /// <summary> 549 /// <summary>
562 /// Enable logins
563 /// </summary>
564 /// <param name="module"></param>
565 /// <param name="cmd"></param>
566 private void HandleLoginEnable(string module, string[] cmd)
567 {
568 ProcessLogin(true);
569 }
570
571
572 /// <summary>
573 /// Disable logins
574 /// </summary>
575 /// <param name="module"></param>
576 /// <param name="cmd"></param>
577 private void HandleLoginDisable(string module, string[] cmd)
578 {
579 ProcessLogin(false);
580 }
581
582 /// <summary>
583 /// Log login status to the console
584 /// </summary>
585 /// <param name="module"></param>
586 /// <param name="cmd"></param>
587 private void HandleLoginStatus(string module, string[] cmd)
588 {
589 if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false)
590
591 m_log.Info("[ Login ] Login are disabled ");
592 else
593 m_log.Info("[ Login ] Login are enabled");
594 }
595
596
597 /// <summary>
598 /// Change and load configuration file data. 550 /// Change and load configuration file data.
599 /// </summary> 551 /// </summary>
600 /// <param name="module"></param> 552 /// <param name="module"></param>
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 391856b..cf2ab65 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -203,12 +203,6 @@ namespace OpenSim
203 plugin.PostInitialise(); 203 plugin.PostInitialise();
204 } 204 }
205 205
206 // Only enable logins to the regions once we have completely finished starting up (apart from scripts)
207 if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null))
208 {
209 SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
210 }
211
212 AddPluginCommands(); 206 AddPluginCommands();
213 } 207 }
214 208
@@ -279,31 +273,6 @@ namespace OpenSim
279 } 273 }
280 274
281 /// <summary> 275 /// <summary>
282 /// Initialises the asset cache. This supports legacy configuration values
283 /// to ensure consistent operation, but values outside of that namespace
284 /// are handled by the more generic resolution mechanism provided by
285 /// the ResolveAssetServer virtual method. If extended resolution fails,
286 /// then the normal default action is taken.
287 /// Creation of the AssetCache is handled by ResolveAssetCache. This
288 /// function accepts a reference to the instantiated AssetServer and
289 /// returns an IAssetCache implementation, if possible. This is a virtual
290 /// method.
291 /// </summary>
292 public void ProcessLogin(bool LoginEnabled)
293 {
294 if (LoginEnabled)
295 {
296 m_log.Info("[LOGIN]: Login is now enabled.");
297 SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
298 }
299 else
300 {
301 m_log.Info("[LOGIN]: Login is now disabled.");
302 SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false;
303 }
304 }
305
306 /// <summary>
307 /// Execute the region creation process. This includes setting up scene infrastructure. 276 /// Execute the region creation process. This includes setting up scene infrastructure.
308 /// </summary> 277 /// </summary>
309 /// <param name="regionInfo"></param> 278 /// <param name="regionInfo"></param>
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
index 46ee3c0..0b54746 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
@@ -55,21 +55,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid
55 55
56 protected bool m_enabled = false; // Module is only enabled if running in standalone mode 56 protected bool m_enabled = false; // Module is only enabled if running in standalone mode
57 57
58 public bool RegionLoginsEnabled
59 {
60 get
61 {
62 if (m_firstScene != null)
63 {
64 return m_firstScene.SceneGridService.RegionLoginsEnabled;
65 }
66 else
67 {
68 return false;
69 }
70 }
71 }
72
73 protected HGLoginAuthService m_loginService; 58 protected HGLoginAuthService m_loginService;
74 59
75 #region IRegionModule Members 60 #region IRegionModule Members
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index beb2307..ebc7f59 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -47,6 +47,7 @@
47 <RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" /> 47 <RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" />
48 <RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \ 48 <RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \
49 <RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.HypergridServiceInConnectorModule" /> \ 49 <RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.HypergridServiceInConnectorModule" /> \
50 <RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \
50 51
51 </Extension> 52 </Extension>
52 53
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index 93cb60c..f9cd90f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -696,8 +696,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
696 public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome) 696 public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
697 { 697 {
698 comingHome = false; 698 comingHome = false;
699 if (!m_aScene.SceneGridService.RegionLoginsEnabled)
700 return false;
701 699
702 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID); 700 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
703 if (uinfo != null) 701 if (uinfo != null)
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
new file mode 100644
index 0000000..dfa8df6
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -0,0 +1,158 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces;
40
41namespace OpenSim.Region.CoreModules.World
42{
43 public class AccessModule : ISharedRegionModule
44 {
45 private static readonly ILog m_log =
46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType);
48
49 private List<Scene> m_SceneList = new List<Scene>();
50
51 public void Initialise(IConfigSource config)
52 {
53 MainConsole.Instance.Commands.AddCommand("access", true,
54 "login enable",
55 "login enable",
56 "Enable simulator logins",
57 String.Empty,
58 HandleLoginCommand);
59
60 MainConsole.Instance.Commands.AddCommand("access", true,
61 "login disable",
62 "login disable",
63 "Disable simulator logins",
64 String.Empty,
65 HandleLoginCommand);
66
67 MainConsole.Instance.Commands.AddCommand("access", true,
68 "login status",
69 "login status",
70 "Show login status",
71 String.Empty,
72 HandleLoginCommand);
73 }
74
75 public void PostInitialise()
76 {
77 }
78
79 public void Close()
80 {
81 }
82
83 public string Name
84 {
85 get { return "AccessModule"; }
86 }
87
88 public Type ReplaceableInterface
89 {
90 get { return null; }
91 }
92
93 public void AddRegion(Scene scene)
94 {
95 if (!m_SceneList.Contains(scene))
96 m_SceneList.Add(scene);
97 }
98
99 public void RemoveRegion(Scene scene)
100 {
101 m_SceneList.Remove(scene);
102 }
103
104 public void RegionLoaded(Scene scene)
105 {
106 }
107
108 public void HandleLoginCommand(string module, string[] cmd)
109 {
110 if ((Scene)MainConsole.Instance.ConsoleScene == null)
111 {
112 foreach (Scene s in m_SceneList)
113 {
114 if(!ProcessCommand(s, cmd))
115 break;
116 }
117 }
118 else
119 {
120 ProcessCommand((Scene)MainConsole.Instance.ConsoleScene, cmd);
121 }
122 }
123
124 bool ProcessCommand(Scene scene, string[] cmd)
125 {
126 if (cmd.Length < 2)
127 {
128 MainConsole.Instance.Output("Syntax: login enable|disable|status");
129 return false;
130 }
131
132 switch (cmd[1])
133 {
134 case "enable":
135 if (scene.LoginsDisabled)
136 MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName));
137 scene.LoginsDisabled = false;
138 break;
139 case "disable":
140 if (!scene.LoginsDisabled)
141 MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName));
142 scene.LoginsDisabled = true;
143 break;
144 case "status":
145 if (scene.LoginsDisabled)
146 MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
147 else
148 MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName));
149 break;
150 default:
151 MainConsole.Instance.Output("Syntax: login enable|disable|status");
152 return false;
153 }
154
155 return true;
156 }
157 }
158}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 62d4aee..8ac4bc4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
144 public CommunicationsManager CommsManager; 144 public CommunicationsManager CommsManager;
145 145
146 protected SceneCommunicationService m_sceneGridService; 146 protected SceneCommunicationService m_sceneGridService;
147 public bool loginsdisabled = true; 147 public bool LoginsDisabled = true;
148 148
149 public new float TimeDilation 149 public new float TimeDilation
150 { 150 {
@@ -1289,15 +1289,19 @@ namespace OpenSim.Region.Framework.Scenes
1289 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); 1289 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1290 } 1290 }
1291 1291
1292 if (loginsdisabled && m_frame > 20) 1292 if (LoginsDisabled && m_frame == 20)
1293 { 1293 {
1294 // In 99.9% of cases it is a bad idea to manually force garbage collection. However, 1294 // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
1295 // this is a rare case where we know we have just went through a long cycle of heap 1295 // this is a rare case where we know we have just went through a long cycle of heap
1296 // allocations, and there is no more work to be done until someone logs in 1296 // allocations, and there is no more work to be done until someone logs in
1297 GC.Collect(); 1297 GC.Collect();
1298 1298
1299 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); 1299 IConfig startupConfig = m_config.Configs["Startup"];
1300 loginsdisabled = false; 1300 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
1301 {
1302 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1303 LoginsDisabled = false;
1304 }
1301 } 1305 }
1302 } 1306 }
1303 catch (NotImplementedException) 1307 catch (NotImplementedException)
@@ -3375,7 +3379,7 @@ namespace OpenSim.Region.Framework.Scenes
3375 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport 3379 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
3376 3380
3377 3381
3378 if (loginsdisabled) 3382 if (LoginsDisabled)
3379 { 3383 {
3380 reason = "Logins Disabled"; 3384 reason = "Logins Disabled";
3381 return false; 3385 return false;
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 8c808ab..6a3c386 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -65,13 +65,6 @@ namespace OpenSim.Region.Framework.Scenes
65 65
66 protected List<UUID> m_agentsInTransit; 66 protected List<UUID> m_agentsInTransit;
67 67
68 public bool RegionLoginsEnabled
69 {
70 get { return m_regionLoginsEnabled; }
71 set { m_regionLoginsEnabled = value; }
72 }
73 private bool m_regionLoginsEnabled = false;
74
75 /// <summary> 68 /// <summary>
76 /// An agent is crossing into this region 69 /// An agent is crossing into this region
77 /// </summary> 70 /// </summary>