]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add option to enable/disable audit log
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 13 Dec 2022 13:27:53 +0000 (14:27 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Mon, 9 Jan 2023 12:34:42 +0000 (13:34 +0100)
12 files changed:
gui/baculum/protected/API/Lang/en/messages.mo
gui/baculum/protected/API/Lang/en/messages.po
gui/baculum/protected/API/Lang/pl/messages.mo
gui/baculum/protected/API/Lang/pl/messages.po
gui/baculum/protected/API/Lang/pt/messages.mo
gui/baculum/protected/API/Lang/pt/messages.po
gui/baculum/protected/API/Lang/ru/messages.mo
gui/baculum/protected/API/Lang/ru/messages.po
gui/baculum/protected/API/Modules/BaculumAPIServer.php
gui/baculum/protected/API/Pages/Panel/APISettings.page
gui/baculum/protected/API/Pages/Panel/APISettings.php
gui/baculum/protected/Common/Modules/Logging.php

index 17872bad29ea3b16d4d0736888704178d88b2410..4308a1686640e03cd05191b7a30fb9986e508fd3 100644 (file)
Binary files a/gui/baculum/protected/API/Lang/en/messages.mo and b/gui/baculum/protected/API/Lang/en/messages.mo differ
index dfe00ea0e6976dd097ada156d46b99e37b6ba74b..e1f21b03adfde2a61d06e0abf4793223b16a6384 100644 (file)
@@ -688,3 +688,6 @@ msgstr "Configs:"
 
 msgid "Dedicated Bconsole config"
 msgstr "Dedicated Bconsole config"
+
+msgid "Audit log:"
+msgstr "Audit log:"
index afd1d1e20683fc60a47bb3ed9ee2c54c90a1aefe..b2b349dadce4eefd70115f4f558c02d65aa7d5e1 100644 (file)
Binary files a/gui/baculum/protected/API/Lang/pl/messages.mo and b/gui/baculum/protected/API/Lang/pl/messages.mo differ
index 208a350445495875af2984c10206c5ddedb04d4f..a25f107d03db335d25e1620b8d792b8f8d538325 100644 (file)
@@ -694,3 +694,6 @@ msgstr "Pliki konfig.:"
 
 msgid "Dedicated Bconsole config"
 msgstr "Dedykowana konfiguracja Bconsole"
+
+msgid "Audit log:"
+msgstr "Audit log:"
index 93ff8311cad80428f9008f2c5742410251da1b40..410645c728138e1dc690a9770def34dd65b7d57b 100644 (file)
Binary files a/gui/baculum/protected/API/Lang/pt/messages.mo and b/gui/baculum/protected/API/Lang/pt/messages.mo differ
index 4d3e3f929f3ef84727420ddd117cbc8425dd657e..1d4583c726fde3e41a79c87d45742c248289a9da 100644 (file)
@@ -695,3 +695,6 @@ msgstr "Configurações:"
 msgid "Dedicated Bconsole config"
 msgstr "Configuração do Bconsole dedicado"
 
+
+msgid "Audit log:"
+msgstr "Audit log:"
index 84b01b7e28d7e27998e8ca2c8b31f56783c337f9..e5e25c04dda26be1e5e027e20e00e7ecc072c467 100644 (file)
Binary files a/gui/baculum/protected/API/Lang/ru/messages.mo and b/gui/baculum/protected/API/Lang/ru/messages.mo differ
index 4a1e97db723c6858a62538f7538d11f3a78b812a..ef9f0a25db9889d61c66ed2c740d598ad84c10ca 100644 (file)
@@ -695,3 +695,6 @@ msgstr "Настройка:"
 msgid "Dedicated Bconsole config"
 msgstr "Выделенная Bconsole"
 
+
+msgid "Audit log:"
+msgstr "Audit log:"
index 47e36a03ad1088b34c7b266ad03b6f8678bb3a29..5e2381e4eaf400f4b718ce9859fc5888ddd07235 100644 (file)
@@ -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) {
index 9e44cc3b1cdcab9b73db0d21b0462ba14f0d379a..724d0489c5d87005a6fdcfe050a80c14d24d4c57 100644 (file)
                                </com:TActiveDropDownList>
                        </div>
                </div>
+               <div class="w3-row w3-section">
+                       <div class="w3-col w3-quarter"><com:TLabel ForControl="GeneralAuditLog" Text="<%[ Audit log: ]%>" /></div>
+                       <div class="w3-col w3-threequarter">
+                               <com:TActiveCheckBox
+                                       ID="GeneralAuditLog"
+                                       CssClass="w3-check"
+                               />
+                       </div>
+               </div>
                <div class="w3-row w3-section">
                        <div class="w3-col w3-quarter"><com:TLabel ForControl="GeneralDebug" Text="<%[ Debug: ]%>" /></div>
                        <div class="w3-col w3-threequarter">
index 780974bbbc24317aede1a2f909b7f37f07dee441..6009e53df4359fc5d54a00d8cec55a9203e20ee6 100644 (file)
@@ -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) {
index b90dcfae44385618da3d12229d8ba23ca42b0c7d..2eee133575f78e1c5d9d1bbb1abe5c2764df91e8 100644 (file)
@@ -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;
                }