From a13b19bf34c4e8f14b9861c978dece18e3357e8b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 11 May 2023 09:28:48 +0200 Subject: [PATCH] check if jwt secret is set and issue a warning if not --- class.paperless.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/class.paperless.php b/class.paperless.php index 9e5b3ab..c5a87d8 100644 --- a/class.paperless.php +++ b/class.paperless.php @@ -22,12 +22,37 @@ class SeedDMS_ExtPaperless extends SeedDMS_ExtBase { /* {{{ */ */ function init() { /* {{{ */ $GLOBALS['SEEDDMS_HOOKS']['initRestAPI'][] = new SeedDMS_ExtPaperless_RestAPI; + $GLOBALS['SEEDDMS_HOOKS']['view']['settings'][] = new SeedDMS_ExtPaperless_Settings; } /* }}} */ function main() { /* {{{ */ } /* }}} */ } /* }}} */ +/** + * Class containing method for checking the configuration + * + * @author Uwe Steinmann + * @package SeedDMS + * @subpackage paperless + */ +class SeedDMS_ExtPaperless_Settings { /* {{{ */ + /** + * Hook for checking the configuration + * + * This hook is not called if the extension isn't enabled + */ + function checkConfig($view, $extname, $conf) { + $settings = $view->getParam('settings'); + if($extname != 'paperless') + return; + if(empty($settings->_extensions['paperless']['jwtsecret'])) { + echo $view->contentSubHeading(getMLText($extname)); + echo $view->warningMsg(getMLText('paperless_jwtsecret_not_set')); + } + } +} /* }}} */ + use Psr\Container\ContainerInterface; class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */