mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
show users reports error if not admin
This commit is contained in:
@@ -87,8 +87,8 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
|
||||
Command::show_all(shell);
|
||||
} else if (command == F_(system)) {
|
||||
EMSESP::system_.show_system(shell);
|
||||
} else if (command == F_(users) && (shell.has_flags(CommandFlags::ADMIN))) {
|
||||
EMSESP::system_.show_users(shell); // admin only
|
||||
} else if (command == F_(users)) {
|
||||
EMSESP::system_.show_users(shell);
|
||||
} else if (command == F_(devices)) {
|
||||
EMSESP::show_devices(shell);
|
||||
} else if (command == F_(log)) {
|
||||
|
||||
@@ -997,6 +997,11 @@ int8_t System::wifi_quality(int8_t dBm) {
|
||||
|
||||
// print users to console
|
||||
void System::show_users(uuid::console::Shell & shell) {
|
||||
if (!shell.has_flags(CommandFlags::ADMIN)) {
|
||||
shell.printfln("Unauthorized. You need to be an admin to view users.");
|
||||
return;
|
||||
}
|
||||
|
||||
shell.printfln("Users:");
|
||||
|
||||
#ifndef EMSESP_STANDALONE
|
||||
|
||||
Reference in New Issue
Block a user