From f2742fb6043c6b7332afd026d77a29b25369934c Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 25 Jul 2008 02:30:07 +0000 Subject: *Added CommandIntentions that is used to describe a console commands hazard. HAZARDOUS if it modifies the simulator, NON_HAZARDOUS if it does a command that doesn't modify the simulator but does a background command such as a forced backup, and STATISTICAL if it returns debug or more information. *This is useful for implementing a protection system from unwanted script execution or for application modules needing to know what a command does. --- .../Modules/Framework/InterfaceCommander/Commander.cs | 9 ++++++++- .../Modules/Framework/InterfaceCommander/CommanderTestModule.cs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Framework/InterfaceCommander') diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs index 84487e8..82f18a1 100644 --- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs +++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs @@ -47,12 +47,14 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander private Action m_command; private string m_help; private string m_name; + private CommandIntentions m_intentions; //A permission type system could implement this and know what a command intends on doing. - public Command(string name, Action command, string help) + public Command(string name, CommandIntentions intention, Action command, string help) { m_name = name; m_command = command; m_help = help; + m_intentions = intention; } #region ICommand Members @@ -67,6 +69,11 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander get { return m_name; } } + public CommandIntentions Intentions + { + get { return m_intentions; } + } + public string Help { get { return m_help; } diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs index 8d1371c..c569240 100644 --- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs +++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander public void PostInitialise() { - Command testCommand = new Command("hello", InterfaceHelloWorld, "Says a simple debugging test string"); + Command testCommand = new Command("hello", CommandIntentions.COMMAND_STATISTICAL, InterfaceHelloWorld, "Says a simple debugging test string"); testCommand.AddArgument("world", "Write world here", "string"); m_commander.RegisterCommand("hello", testCommand); -- cgit v1.1