From 5cf6d6fa79dada85bd56530551409809d338b7d2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 10 Jan 2010 20:17:37 -0800 Subject: All grid servers deleted, including user server. They served us well. --- OpenSim/Services/LLLoginService/LLLoginService.cs | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'OpenSim/Services') 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; using OpenSim.Framework; using OpenSim.Framework.Capabilities; +using OpenSim.Framework.Console; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; @@ -19,6 +20,7 @@ namespace OpenSim.Services.LLLoginService public class LLLoginService : ILoginService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static bool Initialized = false; private IUserAccountService m_UserAccountService; private IAuthenticationService m_AuthenticationService; @@ -33,6 +35,7 @@ namespace OpenSim.Services.LLLoginService private string m_DefaultRegionName; private string m_WelcomeMessage; private bool m_RequireInventory; + private int m_MinLoginLevel; public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) { @@ -84,6 +87,12 @@ namespace OpenSim.Services.LLLoginService m_LibraryService = ServerUtils.LoadPlugin(libService, args); } + if (!Initialized) + { + Initialized = true; + RegisterCommands(); + } + m_log.DebugFormat("[LLOGIN SERVICE]: Starting..."); } @@ -107,6 +116,12 @@ namespace OpenSim.Services.LLLoginService return LLFailedLoginResponse.UserProblem; } + if (account.UserLevel < m_MinLoginLevel) + { + m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); + return LLFailedLoginResponse.LoginBlockedProblem; + } + // Authenticate this user if (!passwd.StartsWith("$1$")) passwd = "$1$" + Util.Md5Hash(passwd); @@ -379,5 +394,50 @@ namespace OpenSim.Services.LLLoginService return null; } + + #region Console Commands + private void RegisterCommands() + { + //MainConsole.Instance.Commands.AddCommand + MainConsole.Instance.Commands.AddCommand("loginservice", false, "login level", + "login level ", + "Set the minimum user level to log in", HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("loginservice", false, "login reset", + "login reset", + "Reset the login level to allow all users", + HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("loginservice", false, "login text", + "login text ", + "Set the text users will see on login", HandleLoginCommand); + + } + + private void HandleLoginCommand(string module, string[] cmd) + { + string subcommand = cmd[1]; + + switch (subcommand) + { + case "level": + // Set the minimum level to allow login + // Useful to allow grid update without worrying about users. + // or fixing critical issues + // + if (cmd.Length > 2) + Int32.TryParse(cmd[2], out m_MinLoginLevel); + break; + case "reset": + m_MinLoginLevel = 0; + break; + case "text": + if (cmd.Length > 2) + m_WelcomeMessage = cmd[2]; + break; + } + } } + + #endregion } -- cgit v1.1