1111use Magento \Backend \App \AbstractAction ;
1212use Magento \Framework \App \Action \Action ;
1313use Magento \Framework \App \ActionFlag ;
14- use Magento \Framework \App \Config \ScopeConfigInterface ;
1514use Magento \Framework \AuthorizationInterface ;
1615use Magento \Framework \Event \Observer ;
1716use Magento \Framework \Event \ObserverInterface ;
18- use Magento \Framework \Module \Manager as ModuleManager ;
1917use Magento \Framework \UrlInterface ;
2018use Magento \TwoFactorAuth \Controller \Adminhtml \Tfa \Configure ;
2119use Magento \TwoFactorAuth \Controller \Adminhtml \Tfa \Index ;
2422use Magento \TwoFactorAuth \Api \UserConfigRequestManagerInterface ;
2523use Magento \TwoFactorAuth \Controller \Adminhtml \Tfa \Requestconfig ;
2624use Magento \TwoFactorAuth \Model \UserConfig \HtmlAreaTokenVerifier ;
25+ use Magento \AdminAdobeIms \Service \ImsConfig ;
2726
2827/**
2928 * Handle redirection to 2FA page if required
@@ -76,14 +75,11 @@ class ControllerActionPredispatch implements ObserverInterface
7675 * @var UserContextInterface
7776 */
7877 private $ userContext ;
78+
7979 /**
80- * @var ModuleManager
81- */
82- private $ moduleManager ;
83- /**
84- * @var ScopeConfigInterface
80+ * @var ImsConfig
8581 */
86- private $ scopeConfig ;
82+ private ImsConfig $ adminAdobeImsConfig ;
8783
8884 /**
8985 * @param TfaInterface $tfa
@@ -94,8 +90,7 @@ class ControllerActionPredispatch implements ObserverInterface
9490 * @param UrlInterface $url
9591 * @param AuthorizationInterface $authorization
9692 * @param UserContextInterface $userContext
97- * @param ModuleManager $moduleManager
98- * @param ScopeConfigInterface $scopeConfig
93+ * @param ImsConfig $adminAdobeImsConfig
9994 */
10095 public function __construct (
10196 TfaInterface $ tfa ,
@@ -106,8 +101,7 @@ public function __construct(
106101 UrlInterface $ url ,
107102 AuthorizationInterface $ authorization ,
108103 UserContextInterface $ userContext ,
109- ModuleManager $ moduleManager ,
110- ScopeConfigInterface $ scopeConfig
104+ ImsConfig $ adminAdobeImsConfig
111105 ) {
112106 $ this ->tfa = $ tfa ;
113107 $ this ->tfaSession = $ tfaSession ;
@@ -117,8 +111,7 @@ public function __construct(
117111 $ this ->url = $ url ;
118112 $ this ->authorization = $ authorization ;
119113 $ this ->userContext = $ userContext ;
120- $ this ->moduleManager = $ moduleManager ;
121- $ this ->scopeConfig = $ scopeConfig ;
114+ $ this ->adminAdobeImsConfig = $ adminAdobeImsConfig ;
122115 }
123116
124117 /**
@@ -138,8 +131,7 @@ private function redirect(string $url): void
138131 */
139132 public function execute (Observer $ observer )
140133 {
141- if ($ this ->moduleManager ->isEnabled ('Magento_AdminAdobeIms ' )
142- && $ this ->scopeConfig ->isSetFlag ('adobe_ims/integration/adobe_ims_2fa_enabled ' )) {
134+ if ($ this ->adminAdobeImsConfig ->enabled ()) {
143135 return ;
144136 }
145137 /** @var $controllerAction AbstractAction */
0 commit comments