diff options
author | Diva Canto | 2010-01-10 20:17:37 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-10 20:17:37 -0800 |
commit | 5cf6d6fa79dada85bd56530551409809d338b7d2 (patch) | |
tree | 24f89393fc9b25f138caed27919800230dafe70d /OpenSim/Services/LLLoginService/LLLoginService.cs | |
parent | OpenSim.Region.Communications.* is no more. Thanks to everyone who contribute... (diff) | |
download | opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.zip opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.tar.gz opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.tar.bz2 opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.tar.xz |
All grid servers deleted, including user server. They served us well.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 47d1b16..32df16d 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -10,6 +10,7 @@ using OpenMetaverse; | |||
10 | 10 | ||
11 | using OpenSim.Framework; | 11 | using OpenSim.Framework; |
12 | using OpenSim.Framework.Capabilities; | 12 | using OpenSim.Framework.Capabilities; |
13 | using OpenSim.Framework.Console; | ||
13 | using OpenSim.Server.Base; | 14 | using OpenSim.Server.Base; |
14 | using OpenSim.Services.Interfaces; | 15 | using OpenSim.Services.Interfaces; |
15 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 16 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
@@ -19,6 +20,7 @@ namespace OpenSim.Services.LLLoginService | |||
19 | public class LLLoginService : ILoginService | 20 | public class LLLoginService : ILoginService |
20 | { | 21 | { |
21 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 22 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
23 | private static bool Initialized = false; | ||
22 | 24 | ||
23 | private IUserAccountService m_UserAccountService; | 25 | private IUserAccountService m_UserAccountService; |
24 | private IAuthenticationService m_AuthenticationService; | 26 | private IAuthenticationService m_AuthenticationService; |
@@ -33,6 +35,7 @@ namespace OpenSim.Services.LLLoginService | |||
33 | private string m_DefaultRegionName; | 35 | private string m_DefaultRegionName; |
34 | private string m_WelcomeMessage; | 36 | private string m_WelcomeMessage; |
35 | private bool m_RequireInventory; | 37 | private bool m_RequireInventory; |
38 | private int m_MinLoginLevel; | ||
36 | 39 | ||
37 | public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) | 40 | public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) |
38 | { | 41 | { |
@@ -84,6 +87,12 @@ namespace OpenSim.Services.LLLoginService | |||
84 | m_LibraryService = ServerUtils.LoadPlugin<ILibraryService>(libService, args); | 87 | m_LibraryService = ServerUtils.LoadPlugin<ILibraryService>(libService, args); |
85 | } | 88 | } |
86 | 89 | ||
90 | if (!Initialized) | ||
91 | { | ||
92 | Initialized = true; | ||
93 | RegisterCommands(); | ||
94 | } | ||
95 | |||
87 | m_log.DebugFormat("[LLOGIN SERVICE]: Starting..."); | 96 | m_log.DebugFormat("[LLOGIN SERVICE]: Starting..."); |
88 | 97 | ||
89 | } | 98 | } |
@@ -107,6 +116,12 @@ namespace OpenSim.Services.LLLoginService | |||
107 | return LLFailedLoginResponse.UserProblem; | 116 | return LLFailedLoginResponse.UserProblem; |
108 | } | 117 | } |
109 | 118 | ||
119 | if (account.UserLevel < m_MinLoginLevel) | ||
120 | { | ||
121 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); | ||
122 | return LLFailedLoginResponse.LoginBlockedProblem; | ||
123 | } | ||
124 | |||
110 | // Authenticate this user | 125 | // Authenticate this user |
111 | if (!passwd.StartsWith("$1$")) | 126 | if (!passwd.StartsWith("$1$")) |
112 | passwd = "$1$" + Util.Md5Hash(passwd); | 127 | passwd = "$1$" + Util.Md5Hash(passwd); |
@@ -379,5 +394,50 @@ namespace OpenSim.Services.LLLoginService | |||
379 | return null; | 394 | return null; |
380 | 395 | ||
381 | } | 396 | } |
397 | |||
398 | #region Console Commands | ||
399 | private void RegisterCommands() | ||
400 | { | ||
401 | //MainConsole.Instance.Commands.AddCommand | ||
402 | MainConsole.Instance.Commands.AddCommand("loginservice", false, "login level", | ||
403 | "login level <level>", | ||
404 | "Set the minimum user level to log in", HandleLoginCommand); | ||
405 | |||
406 | MainConsole.Instance.Commands.AddCommand("loginservice", false, "login reset", | ||
407 | "login reset", | ||
408 | "Reset the login level to allow all users", | ||
409 | HandleLoginCommand); | ||
410 | |||
411 | MainConsole.Instance.Commands.AddCommand("loginservice", false, "login text", | ||
412 | "login text <text>", | ||
413 | "Set the text users will see on login", HandleLoginCommand); | ||
414 | |||
415 | } | ||
416 | |||
417 | private void HandleLoginCommand(string module, string[] cmd) | ||
418 | { | ||
419 | string subcommand = cmd[1]; | ||
420 | |||
421 | switch (subcommand) | ||
422 | { | ||
423 | case "level": | ||
424 | // Set the minimum level to allow login | ||
425 | // Useful to allow grid update without worrying about users. | ||
426 | // or fixing critical issues | ||
427 | // | ||
428 | if (cmd.Length > 2) | ||
429 | Int32.TryParse(cmd[2], out m_MinLoginLevel); | ||
430 | break; | ||
431 | case "reset": | ||
432 | m_MinLoginLevel = 0; | ||
433 | break; | ||
434 | case "text": | ||
435 | if (cmd.Length > 2) | ||
436 | m_WelcomeMessage = cmd[2]; | ||
437 | break; | ||
438 | } | ||
439 | } | ||
382 | } | 440 | } |
441 | |||
442 | #endregion | ||
383 | } | 443 | } |