MultiUserConsoleInputpublic class MultiUserConsoleInput extends org.gudy.azureus2.ui.console.ConsoleInput subclass of the ConsoleInput object that is used for multi users.
in this particular subclass, we replace some commands with our own versions
and disable some commands. |
Fields Summary |
---|
private List | adminCommands | private List | userCommands |
Constructors Summary |
---|
public MultiUserConsoleInput(String con, com.aelitis.azureus.core.AzureusCore _azureus_core, Reader _in, PrintStream _out, Boolean _controlling, org.gudy.azureus2.ui.console.UserProfile profile)set up the lists of commands that we prohibit, based upon the user type.
super(con, _azureus_core, _in, _out, _controlling, profile);
|
Methods Summary |
---|
protected void | initialise()initialize our list of commands that need specific roles
adminCommands = new ArrayList();
adminCommands.add("quit");
adminCommands.add("share");
adminCommands.add("user");
// move command is admin only so that standard users cannot
// prioritise their torrents
adminCommands.add("move");
adminCommands.add("log");
adminCommands.add("ui");
userCommands = new ArrayList();
userCommands.add("set");
userCommands.add("alias");
userCommands.add("add");
super.initialise();
| public void | registerCommand(org.gudy.azureus2.ui.console.commands.IConsoleCommand command)check whether the specified command is one of our banned commands for
this particular user type. some commands are able to handle different
user types, others are not relevant to anybody but admin
if( ! UserProfile.ADMIN.equals( getUserProfile().getUserType() ) )
{
Set commandNames = command.getCommandNames();
for (Iterator iter = commandNames.iterator(); iter.hasNext();) {
String cmdName = (String) iter.next();
if( adminCommands.contains(cmdName) )
return;
if( ! UserProfile.USER.equals( getUserProfile().getUserType() ) )
{
if( userCommands.contains(cmdName))
return;
}
}
}
super.registerCommand(command);
| protected void | registerCommands()add some multi-user specific commands
super.registerCommands();
// this will override the original Show command
registerCommand(new Show());
|
|