diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs | 83 |
1 files changed, 31 insertions, 52 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index f9c594b..0b54746 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -32,7 +32,6 @@ using System.Net; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text.RegularExpressions; | 33 | using System.Text.RegularExpressions; |
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Addins; | ||
36 | using Nini.Config; | 35 | using Nini.Config; |
37 | using OpenMetaverse; | 36 | using OpenMetaverse; |
38 | using Nwc.XmlRpc; | 37 | using Nwc.XmlRpc; |
@@ -47,8 +46,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
47 | 46 | ||
48 | namespace OpenSim.Region.CoreModules.Hypergrid | 47 | namespace OpenSim.Region.CoreModules.Hypergrid |
49 | { | 48 | { |
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 49 | public class HGStandaloneLoginModule : IRegionModule, ILoginServiceToRegionsConnector |
51 | public class HGStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector | ||
52 | { | 50 | { |
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 52 | ||
@@ -58,58 +56,47 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
58 | 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 |
59 | 57 | ||
60 | protected HGLoginAuthService m_loginService; | 58 | protected HGLoginAuthService m_loginService; |
61 | private bool authenticate = true; | ||
62 | private string welcomeMessage = "Welcome to OpenSim"; | ||
63 | private IConfig startupConfig; | ||
64 | private IConfig standaloneConfig; | ||
65 | |||
66 | #region ISharedRegionModule Members | ||
67 | |||
68 | public void Initialise(IConfigSource source) | ||
69 | { | ||
70 | startupConfig = source.Configs["Startup"]; | ||
71 | standaloneConfig = source.Configs["StandAlone"]; | ||
72 | if (standaloneConfig != null) | ||
73 | { | ||
74 | authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true); | ||
75 | welcomeMessage = standaloneConfig.GetString("welcome_message"); | ||
76 | } | ||
77 | m_enabled = !startupConfig.GetBoolean("gridmode", false); | ||
78 | } | ||
79 | |||
80 | public Type ReplaceableInterface | ||
81 | { | ||
82 | get { return null; } | ||
83 | } | ||
84 | 59 | ||
85 | public void AddRegion(Scene scene) | 60 | #region IRegionModule Members |
86 | { | ||
87 | } | ||
88 | 61 | ||
89 | public void RegionLoaded(Scene scene) | 62 | public void Initialise(Scene scene, IConfigSource source) |
90 | { | 63 | { |
91 | if (m_firstScene == null) | 64 | if (m_firstScene == null) |
92 | { | 65 | { |
93 | m_firstScene = scene; | 66 | m_firstScene = scene; |
94 | 67 | ||
68 | IConfig startupConfig = source.Configs["Startup"]; | ||
69 | if (startupConfig != null) | ||
70 | { | ||
71 | m_enabled = !startupConfig.GetBoolean("gridmode", false); | ||
72 | } | ||
73 | |||
95 | if (m_enabled) | 74 | if (m_enabled) |
96 | { | 75 | { |
97 | m_log.Debug("[HGLogin]: HGlogin module enabled"); | 76 | m_log.Debug("[HGLogin]: HGlogin module enabled"); |
77 | bool authenticate = true; | ||
78 | string welcomeMessage = "Welcome to OpenSim"; | ||
79 | IConfig standaloneConfig = source.Configs["StandAlone"]; | ||
80 | if (standaloneConfig != null) | ||
81 | { | ||
82 | authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true); | ||
83 | welcomeMessage = standaloneConfig.GetString("welcome_message"); | ||
84 | } | ||
98 | 85 | ||
99 | //TODO: fix casting. | 86 | //TODO: fix casting. |
100 | LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; | 87 | LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; |
101 | 88 | ||
102 | IHttpServer httpServer = MainServer.Instance; | 89 | IHttpServer httpServer = MainServer.Instance; |
103 | 90 | ||
104 | //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference | 91 | //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference |
105 | m_loginService | 92 | m_loginService |
106 | = new HGLoginAuthService( | 93 | = new HGLoginAuthService( |
107 | (UserManagerBase)m_firstScene.CommsManager.UserAdminService, | 94 | (UserManagerBase)m_firstScene.CommsManager.UserAdminService, |
108 | welcomeMessage, | 95 | welcomeMessage, |
109 | m_firstScene.CommsManager.InterServiceInventoryService, | 96 | m_firstScene.CommsManager.InterServiceInventoryService, |
110 | m_firstScene.CommsManager.NetworkServersInfo, | 97 | m_firstScene.CommsManager.NetworkServersInfo, |
111 | authenticate, | 98 | authenticate, |
112 | rootFolder, | 99 | rootFolder, |
113 | this); | 100 | this); |
114 | 101 | ||
115 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); | 102 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); |
@@ -126,19 +113,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
126 | } | 113 | } |
127 | } | 114 | } |
128 | 115 | ||
129 | public void RemoveRegion(Scene scene) | ||
130 | { | ||
131 | if (scene == m_firstScene) | ||
132 | { | ||
133 | IHttpServer httpServer = MainServer.Instance; | ||
134 | httpServer.RemoveXmlRPCHandler("hg_login"); | ||
135 | httpServer.RemoveXmlRPCHandler("check_auth_session"); | ||
136 | httpServer.RemoveXmlRPCHandler("get_avatar_appearance"); | ||
137 | httpServer.RemoveXmlRPCHandler("update_avatar_appearance"); | ||
138 | } | ||
139 | m_scenes.Remove(scene); | ||
140 | } | ||
141 | |||
142 | public void PostInitialise() | 116 | public void PostInitialise() |
143 | { | 117 | { |
144 | 118 | ||
@@ -154,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
154 | get { return "HGStandaloneLoginModule"; } | 128 | get { return "HGStandaloneLoginModule"; } |
155 | } | 129 | } |
156 | 130 | ||
131 | public bool IsSharedModule | ||
132 | { | ||
133 | get { return true; } | ||
134 | } | ||
135 | |||
157 | #endregion | 136 | #endregion |
158 | 137 | ||
159 | protected void AddScene(Scene scene) | 138 | protected void AddScene(Scene scene) |