diff --git a/src/cmdhandler.py b/src/cmdhandler.py index 219284bad3..0f649383b3 100755 --- a/src/cmdhandler.py +++ b/src/cmdhandler.py @@ -38,6 +38,8 @@ class Command(object): command_argument = None # A reference to the command function looked up in a command table. command_function = None + # An optional dictionary that is passed through the command table as extra_vars. + extra_vars = None def parse_command_switches(self): """ @@ -243,6 +245,7 @@ def command_table_lookup(command, command_table, eval_perms=True): raise ExitCommandHandler # If flow reaches this point, user has perms and command is ready. command.command_function = cmdtuple[0] + command.extra_vars = cmdtuple[2] def handle(command): """ diff --git a/src/cmdtable.py b/src/cmdtable.py index c943136919..46bf95dba2 100644 --- a/src/cmdtable.py +++ b/src/cmdtable.py @@ -30,15 +30,17 @@ class CommandTable(object): # This ensures there are no leftovers when the class is instantiated. self.ctable = {} - def add_command(self, command_string, function, priv_tuple=None): + def add_command(self, command_string, function, priv_tuple=None, + extra_vals=None): """ Adds a command to the command table. command_string: (string) Command string (IE: WHO, QUIT, look). function: (reference) The command's function. priv_tuple: (tuple) String tuple of permissions required for command. + extra_vals: (dict) Dictionary to add to the Command object. """ - self.ctable[command_string] = (function, priv_tuple) + self.ctable[command_string] = (function, priv_tuple, extra_vals) def get_command_tuple(self, func_name): """ @@ -54,6 +56,8 @@ GLOBAL_CMD_TABLE = CommandTable() GLOBAL_CMD_TABLE.add_command("addcom", commands.comsys.cmd_addcom), GLOBAL_CMD_TABLE.add_command("comlist", commands.comsys.cmd_comlist), GLOBAL_CMD_TABLE.add_command("delcom", commands.comsys.cmd_delcom), +GLOBAL_CMD_TABLE.add_command("doing", commands.general.cmd_who, + extra_vals={"show_session_data": False}), GLOBAL_CMD_TABLE.add_command("drop", commands.general.cmd_drop), GLOBAL_CMD_TABLE.add_command("examine", commands.general.cmd_examine), GLOBAL_CMD_TABLE.add_command("get", commands.general.cmd_get), diff --git a/src/commands/general.py b/src/commands/general.py index 26f03db5d0..343f075dcf 100644 --- a/src/commands/general.py +++ b/src/commands/general.py @@ -347,7 +347,12 @@ def cmd_who(command): session_list = session_mgr.get_session_list() session = command.session pobject = session.get_pobject() - show_session_data = pobject.user_has_perm("genperms.see_session_data") + + # In the case of the DOING command, don't show session data regardless. + if command.extra_vars and command.extra_vars.get("show_session_data", None) == False: + show_session_data = False + else: + show_session_data = pobject.user_has_perm("genperms.see_session_data") # Only those with the see_session_data or superuser status can see # session details.