Add "show name" console command to make it possible to show a single binding of a UUID to a name.

user_profiles
Justin Clark-Casey (justincc) 2013-05-21 18:00:41 +01:00
parent c47de9878d
commit 6edecd5d94
1 changed files with 34 additions and 0 deletions

View File

@ -567,6 +567,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
protected void RegisterConsoleCmds()
{
MainConsole.Instance.Commands.AddCommand("Users", true,
"show name",
"show name <uuid>",
"Show the bindings between a single user UUID and a user name",
String.Empty,
HandleShowUser);
MainConsole.Instance.Commands.AddCommand("Users", true,
"show names",
"show names",
@ -575,6 +582,33 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
HandleShowUsers);
}
private void HandleShowUser(string module, string[] cmd)
{
if (cmd.Length < 3)
{
MainConsole.Instance.OutputFormat("Usage: show name <uuid>");
return;
}
UUID userId;
if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId))
return;
string[] names;
if (!TryGetUserNames(userId, out names))
{
MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
return;
}
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("UUID", 36);
cdt.AddColumn("Name", 60);
cdt.AddRow(userId, string.Join(" ", names));
MainConsole.Instance.Output(cdt.ToString());
}
private void HandleShowUsers(string module, string[] cmd)
{
lock (m_UserCache)