From: Marcin Haba Date: Tue, 13 Dec 2022 13:27:53 +0000 (+0100) Subject: baculum: Add option to enable/disable audit log X-Git-Tag: Release-13.0.2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d07be344cec564a2b210f0debbb69208085b2ca7;p=thirdparty%2Fbacula.git baculum: Add option to enable/disable audit log --- diff --git a/gui/baculum/protected/API/Lang/en/messages.mo b/gui/baculum/protected/API/Lang/en/messages.mo index 17872bad2..4308a1686 100644 Binary files a/gui/baculum/protected/API/Lang/en/messages.mo and b/gui/baculum/protected/API/Lang/en/messages.mo differ diff --git a/gui/baculum/protected/API/Lang/en/messages.po b/gui/baculum/protected/API/Lang/en/messages.po index dfe00ea0e..e1f21b03a 100644 --- a/gui/baculum/protected/API/Lang/en/messages.po +++ b/gui/baculum/protected/API/Lang/en/messages.po @@ -688,3 +688,6 @@ msgstr "Configs:" msgid "Dedicated Bconsole config" msgstr "Dedicated Bconsole config" + +msgid "Audit log:" +msgstr "Audit log:" diff --git a/gui/baculum/protected/API/Lang/pl/messages.mo b/gui/baculum/protected/API/Lang/pl/messages.mo index afd1d1e20..b2b349dad 100644 Binary files a/gui/baculum/protected/API/Lang/pl/messages.mo and b/gui/baculum/protected/API/Lang/pl/messages.mo differ diff --git a/gui/baculum/protected/API/Lang/pl/messages.po b/gui/baculum/protected/API/Lang/pl/messages.po index 208a35044..a25f107d0 100644 --- a/gui/baculum/protected/API/Lang/pl/messages.po +++ b/gui/baculum/protected/API/Lang/pl/messages.po @@ -694,3 +694,6 @@ msgstr "Pliki konfig.:" msgid "Dedicated Bconsole config" msgstr "Dedykowana konfiguracja Bconsole" + +msgid "Audit log:" +msgstr "Audit log:" diff --git a/gui/baculum/protected/API/Lang/pt/messages.mo b/gui/baculum/protected/API/Lang/pt/messages.mo index 93ff8311c..410645c72 100644 Binary files a/gui/baculum/protected/API/Lang/pt/messages.mo and b/gui/baculum/protected/API/Lang/pt/messages.mo differ diff --git a/gui/baculum/protected/API/Lang/pt/messages.po b/gui/baculum/protected/API/Lang/pt/messages.po index 4d3e3f929..1d4583c72 100644 --- a/gui/baculum/protected/API/Lang/pt/messages.po +++ b/gui/baculum/protected/API/Lang/pt/messages.po @@ -695,3 +695,6 @@ msgstr "Configurações:" msgid "Dedicated Bconsole config" msgstr "Configuração do Bconsole dedicado" + +msgid "Audit log:" +msgstr "Audit log:" diff --git a/gui/baculum/protected/API/Lang/ru/messages.mo b/gui/baculum/protected/API/Lang/ru/messages.mo index 84b01b7e2..e5e25c04d 100644 Binary files a/gui/baculum/protected/API/Lang/ru/messages.mo and b/gui/baculum/protected/API/Lang/ru/messages.mo differ diff --git a/gui/baculum/protected/API/Lang/ru/messages.po b/gui/baculum/protected/API/Lang/ru/messages.po index 4a1e97db7..ef9f0a25d 100644 --- a/gui/baculum/protected/API/Lang/ru/messages.po +++ b/gui/baculum/protected/API/Lang/ru/messages.po @@ -695,3 +695,6 @@ msgstr "Настройка:" msgid "Dedicated Bconsole config" msgstr "Выделенная Bconsole" + +msgid "Audit log:" +msgstr "Audit log:" diff --git a/gui/baculum/protected/API/Modules/BaculumAPIServer.php b/gui/baculum/protected/API/Modules/BaculumAPIServer.php index 47e36a03a..5e2381e4e 100644 --- a/gui/baculum/protected/API/Modules/BaculumAPIServer.php +++ b/gui/baculum/protected/API/Modules/BaculumAPIServer.php @@ -173,6 +173,7 @@ abstract class BaculumAPIServer extends TPage { $config = $this->getModule('api_config')->getConfig('api'); + Logging::$audit_enabled = (!key_exists('audit_log', $config) || $config['audit_log'] == 1); Logging::$debug_enabled = (key_exists('debug', $config) && $config['debug'] == 1); if ($this->authenticate() === false) { diff --git a/gui/baculum/protected/API/Pages/Panel/APISettings.page b/gui/baculum/protected/API/Pages/Panel/APISettings.page index 9e44cc3b1..724d0489c 100644 --- a/gui/baculum/protected/API/Pages/Panel/APISettings.page +++ b/gui/baculum/protected/API/Pages/Panel/APISettings.page @@ -31,6 +31,15 @@ +
+
+
+ +
+
diff --git a/gui/baculum/protected/API/Pages/Panel/APISettings.php b/gui/baculum/protected/API/Pages/Panel/APISettings.php index 780974bbb..6009e53df 100644 --- a/gui/baculum/protected/API/Pages/Panel/APISettings.php +++ b/gui/baculum/protected/API/Pages/Panel/APISettings.php @@ -64,6 +64,8 @@ class APISettings extends BaculumAPIPage { return; } $this->GeneralLang->SelectedValue= $this->config['api']['lang']; + // NOTE: Default audit log is enabled + $this->GeneralAuditLog->Checked = (!key_exists('audit_log', $this->config['api']) || $this->config['api']['audit_log'] == 1); $this->GeneralDebug->Checked = ($this->config['api']['debug'] == 1); } @@ -393,6 +395,7 @@ class APISettings extends BaculumAPIPage { $reload_page = true; } $this->config['api']['lang'] = $this->GeneralLang->SelectedValue; + $this->config['api']['audit_log'] = $this->GeneralAuditLog->Checked ? 1 : 0; $this->config['api']['debug'] = $this->GeneralDebug->Checked ? 1 : 0; $this->getModule('api_config')->setConfig($this->config); if ($reload_page) { diff --git a/gui/baculum/protected/Common/Modules/Logging.php b/gui/baculum/protected/Common/Modules/Logging.php index b90dcfae4..2eee13357 100644 --- a/gui/baculum/protected/Common/Modules/Logging.php +++ b/gui/baculum/protected/Common/Modules/Logging.php @@ -41,6 +41,14 @@ class Logging extends CommonModule { */ public static $debug_enabled = false; + /* + * Stores audit enable state. + * Default audit log is enabled. + * + * @var bool + */ + public static $audit_enabled = true; + /** * Log categories. */ @@ -72,7 +80,7 @@ class Logging extends CommonModule { */ private function isEnabled($category) { $is_enabled = false; - if (self::$debug_enabled === true || $category === self::CATEGORY_AUDIT) { + if ((self::$debug_enabled === true && $category !== self::CATEGORY_AUDIT) || (self::$audit_enabled === true && $category === self::CATEGORY_AUDIT)) { // NOTE: Audit log is written always, it is not possible to disable it $is_enabled = true; }