tfa = $tfa; $this->authorization = $authorization; } /** * @param \Magento\User\Block\User\Edit\Tabs $subject * @throws \Magento\Framework\Exception\LocalizedException */ public function beforeToHtml(\Magento\User\Block\User\Edit\Tabs $subject) { if (empty($this->tfa->getAllEnabledProviders()) || !$this->authorization->isAllowed('MSP_TwoFactorAuth::tfa') ) { return; } $tfaForm = $subject->getLayout()->renderElement('msp_twofactorauth_edit_user_form'); $subject->addTabAfter( 'msp_twofactorauth', [ 'label' => __('2FA'), 'title' => __('2FA'), 'content' => $tfaForm, 'active' => true ], 'roles_section' ); } }