diff --git a/services/histserv/app/Application.cxx b/services/histserv/app/Application.cxx index a32af9d323cf450338f04bbe57700afe3d77de56..1668612b1ac2ccb2799b42d71157fa6e6f21e2fc 100644 --- a/services/histserv/app/Application.cxx +++ b/services/histserv/app/Application.cxx @@ -69,18 +69,20 @@ Application::Application(ProgramOptions const& opt) : fOpt(opt) fServer->Register("/", fUiCmdActor.get()); fServer->Hide("/UiCmdActor"); - fServer->RegisterCommand("/Reset_Hist", "/UiCmdActor/->SetResetHistos()"); - fServer->RegisterCommand("/Save_Hist", "/UiCmdActor/->SetSaveHistos()"); - fServer->RegisterCommand("/Stop_Server", "/UiCmdActor/->SetServerStop()"); - - /* - fServer->RegisterCommand("/Reset_Hist", "this->ResetHistograms()"); - fServer->RegisterCommand("/Save_Hist", "this->SaveHistograms()"); - */ - - fServer->Restrict("/Reset_Hist", "allow=admin"); - fServer->Restrict("/Save_Hist", "allow=admin"); - fServer->Restrict("/Stop_Server", "allow=admin"); + if (!fOpt.HideGuiCommands()) { + fServer->RegisterCommand("/Reset_Hist", "/UiCmdActor/->SetResetHistos()"); + fServer->RegisterCommand("/Save_Hist", "/UiCmdActor/->SetSaveHistos()"); + fServer->RegisterCommand("/Stop_Server", "/UiCmdActor/->SetServerStop()"); + + /* + fServer->RegisterCommand("/Reset_Hist", "this->ResetHistograms()"); + fServer->RegisterCommand("/Save_Hist", "this->SaveHistograms()"); + */ + + fServer->Restrict("/Reset_Hist", "allow=admin"); + fServer->Restrict("/Save_Hist", "allow=admin"); + fServer->Restrict("/Stop_Server", "allow=admin"); + } // Provide signal handling for external interruptions // NOTE: SZh 02.04.2024: diff --git a/services/histserv/app/ProgramOptions.cxx b/services/histserv/app/ProgramOptions.cxx index 54522eaf284fd70ef0afada29d348d134e7b4f29..94058260e682570bbfb22007027417a9dba9fca1 100644 --- a/services/histserv/app/ProgramOptions.cxx +++ b/services/histserv/app/ProgramOptions.cxx @@ -44,6 +44,8 @@ namespace cbm::services::histserv "name of the output ROOT file with histograms backup"); config_add("overwrite,w", po::bool_switch(&fOverwrite)->default_value(false), "allow to overwite an existing output file"); + config_add("hideguicmds", po::bool_switch(&fHideGuiCommands)->default_value(false), + "allow to hides (disable) the GUI commands for Reset/Save/Close"); // --- Allowed options po::options_description cmdline_options("Allowed options"); diff --git a/services/histserv/app/ProgramOptions.h b/services/histserv/app/ProgramOptions.h index 47a913878b89576415f0610db3ef7d98286f8050..7f8f1372d89ff608f4aecbde4133c8bc54b6ee47 100644 --- a/services/histserv/app/ProgramOptions.h +++ b/services/histserv/app/ProgramOptions.h @@ -45,6 +45,9 @@ namespace cbm::services::histserv /** @brief Get overwrite option **/ [[nodiscard]] bool Overwrite() const { return fOverwrite; } + /** @brief Get overwrite option **/ + [[nodiscard]] bool HideGuiCommands() const { return fHideGuiCommands; } + // /** @brief Get configuration file name (YAML format) **/ // [[nodiscard]] const std::string& ConfigFile() const { return fConfig; } @@ -59,6 +62,7 @@ namespace cbm::services::histserv uint32_t fuHttpServerPort = 8080; ///< HTTP port of the ROOT web server std::string fsHistoFileName = "histos_dump.root"; ///< Output file name (ROOT format) bool fOverwrite = false; ///< Enable overwriting of existing output file + bool fHideGuiCommands = false; ///< Hides (disables) the GUI commands for Reset/Save/Close //std::string fConfig = ""; ///< Configuration file name (YAML format) };