From 084e22c249aef27755ddc88038daedcae81f1068 Mon Sep 17 00:00:00 2001 From: Claus Due <claus@namelesscoder.net> Date: Thu, 30 Mar 2017 20:07:06 +0200 Subject: [PATCH] [TASK] Resolve hidden dependency from EXT:backend to EXT:rsaauth Moves always-executed code into a hook which only executes if the rsaauth extension is installed. Change-Id: I11cb69d7d6447268e26c07f7dc02a8a15afe80da Resolves: #80580 Releases: master Reviewed-on: https://review.typo3.org/52269 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Thomas Hohn <thomas@hohn.dk> Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Kasper Ligaard <kasperligaard+typo3.org@gmail.com> Reviewed-by: Andreas Fernandez <typo3@scripting-base.de> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by: Jan Helke <typo3@helke.de> Tested-by: Jan Helke <typo3@helke.de> Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> --- .../backend/Classes/Controller/BackendController.php | 5 ----- typo3/sysext/rsaauth/Classes/RsaEncryptionEncoder.php | 8 ++++++++ typo3/sysext/rsaauth/ext_localconf.php | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/typo3/sysext/backend/Classes/Controller/BackendController.php b/typo3/sysext/backend/Classes/Controller/BackendController.php index ca1164a1e816..3b8b489a329b 100644 --- a/typo3/sysext/backend/Classes/Controller/BackendController.php +++ b/typo3/sysext/backend/Classes/Controller/BackendController.php @@ -32,7 +32,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\PathUtility; use TYPO3\CMS\Fluid\View\StandaloneView; -use TYPO3\CMS\Rsaauth\RsaEncryptionEncoder; /** * Class for rendering the TYPO3 backend @@ -163,10 +162,6 @@ class BackendController // load debug console $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DebugConsole'); - // Load RSA encryption - $rsaEncryptionEncoder = GeneralUtility::makeInstance(RsaEncryptionEncoder::class); - $rsaEncryptionEncoder->enableRsaEncryption(true); - $this->pageRenderer->addInlineSetting('ShowItem', 'moduleUrl', BackendUtility::getModuleUrl('show_item')); $this->css = ''; diff --git a/typo3/sysext/rsaauth/Classes/RsaEncryptionEncoder.php b/typo3/sysext/rsaauth/Classes/RsaEncryptionEncoder.php index 434e52ee2599..2b259fce6f4f 100644 --- a/typo3/sysext/rsaauth/Classes/RsaEncryptionEncoder.php +++ b/typo3/sysext/rsaauth/Classes/RsaEncryptionEncoder.php @@ -36,6 +36,14 @@ class RsaEncryptionEncoder implements SingletonInterface */ protected $pageRenderer = null; + /** + * This method is called by the hook constructPostProcess + */ + public function enableEncryptionFromBackendControllerPostConstructor() + { + $this->enableRsaEncryption(true); + } + /** * Load all necessary Javascript files * diff --git a/typo3/sysext/rsaauth/ext_localconf.php b/typo3/sysext/rsaauth/ext_localconf.php index 63f04c8b349f..0a0d5b6e7d1a 100644 --- a/typo3/sysext/rsaauth/ext_localconf.php +++ b/typo3/sysext/rsaauth/ext_localconf.php @@ -20,6 +20,7 @@ defined('TYPO3_MODE') or die(); // Add hook for user setup module $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/setup/mod/index.php']['setupScriptHook']['rsaauth'] = \TYPO3\CMS\Rsaauth\Hook\UserSetupHook::class . '->getLoginScripts'; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/setup/mod/index.php']['modifyUserDataBeforeSave']['rsaauth'] = \TYPO3\CMS\Rsaauth\Hook\UserSetupHook::class . '->decryptPassword'; +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php']['constructPostProcess'][] = \TYPO3\CMS\Rsaauth\RsaEncryptionEncoder::class . '->enableEncryptionFromBackendControllerPostConstructor'; // Add a hook to the FE login form (felogin system extension) $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs']['rsaauth'] = \TYPO3\CMS\Rsaauth\Hook\FrontendLoginHook::class . '->loginFormHook'; // Add a hook to show Backend warnings -- GitLab