From 6edecd5d94949873411b0625928b4f0ad0e01f9a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 May 2013 18:00:41 +0100 Subject: Add "show name" console command to make it possible to show a single binding of a UUID to a name. --- .../UserManagement/UserManagementModule.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 06f1712..48ec12f 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -568,6 +568,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement protected void RegisterConsoleCmds() { MainConsole.Instance.Commands.AddCommand("Users", true, + "show name", + "show name ", + "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", "Show the bindings between user UUIDs and user 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 "); + 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) -- cgit v1.1