From 3df36523cb8814b71b8327c19185d73075ee41dc Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 18 Feb 2008 03:14:31 +0000 Subject: Thank you very much, Hashbox for: Changed the public IsAdministrator back to protected, now checks Config to see whether it is allowed to run or not. Defaults to false (not allowed). To use add the following to OpenSim.ini [LL-Functions] AllowosConsoleCommand=true --- OpenSim/Region/Environment/PermissionManager.cs | 7 ++++++- OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs | 2 +- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 19 +++++++++++++------ .../Common/LSL_BuiltIn_Commands_Interface.cs | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 36f75d1..5958249 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs @@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment m_scene.EventManager.TriggerPermissionError(user, reason); } - public virtual bool IsAdministrator(LLUUID user) + protected virtual bool IsAdministrator(LLUUID user) { if (m_bypassPermissions) { @@ -495,6 +495,11 @@ namespace OpenSim.Region.Environment return IsAdministrator(user); } + public virtual bool CanRunConsoleCommand(LLUUID user) + { + return IsAdministrator(user); + } + public virtual bool CanTerraform(LLUUID user, LLVector3 position) { bool permission = false; diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index 088b985..7713490 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs @@ -1865,7 +1865,7 @@ namespace OpenSim.Region.ScriptEngine.Common m_LSL_Functions.osRegionNotice(msg); } - public int osConsoleCommand(string Command) + public bool osConsoleCommand(string Command) { return m_LSL_Functions.osConsoleCommand(Command); } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index a7d4ecf..c07f6d7 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -3676,14 +3676,21 @@ namespace OpenSim.Region.ScriptEngine.Common return LLUUID.Zero.ToString(); } - public int osConsoleCommand(string Command) + public bool osConsoleCommand(string Command) { - if (World.PermissionsMngr.IsAdministrator(m_host.OwnerID)) { - OpenSim.Framework.Console.MainConsole.Instance.RunCommand(Command); - return 1; - } else { - return 0; + m_host.AddScriptLPS(1); + Nini.Config.IConfigSource config = new Nini.Config.IniConfigSource(Application.iniFilePath); + if (config.Configs["LL-Functions"] == null) + config.AddConfig("LL-Functions"); + + if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false)) { + if (World.PermissionsMngr.CanRunConsoleCommand(m_host.OwnerID)) { + OpenSim.Framework.Console.MainConsole.Instance.RunCommand(Command); + return true; + } + return false; } + return false; } private void NotImplemented(string Command) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 81478e0..0703523 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -641,6 +641,6 @@ namespace OpenSim.Region.ScriptEngine.Common int osTerrainSetHeight(int x, int y, double val); int osRegionRestart(double seconds); void osRegionNotice(string msg); - int osConsoleCommand(string Command); + bool osConsoleCommand(string Command); } } -- cgit v1.1