[TASK] Resolve hidden dependency from EXT:backend to EXT:rsaauth 39/52739/3
authorClaus Due <claus@namelesscoder.net>
Thu, 30 Mar 2017 18:07:06 +0000 (20:07 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 4 Jul 2017 21:24:18 +0000 (23:24 +0200)
Moves always-executed code into a hook which only executes
if the rsaauth extension is installed.

Resolves: #80580
Releases: master, 8.7
Change-Id: I11cb69d7d6447268e26c07f7dc02a8a15afe80da
Reviewed-on: https://review.typo3.org/52739
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Kasper Ligaard <kasperligaard+typo3.org@gmail.com>
Reviewed-by: Claus Due <claus@phpmind.net>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/rsaauth/Classes/RsaEncryptionEncoder.php
typo3/sysext/rsaauth/ext_localconf.php

index 685d7c2..6d2dc0c 100644 (file)
@@ -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 = '';
index 7aa44dc..e1e28bd 100644 (file)
@@ -37,6 +37,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
      *
      * @param bool $useRequireJsModule
index 63f04c8..0a0d5b6 100644 (file)
@@ -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