From 37d2b0ff199baf6504ea472e2b7d8219cb8b6f70 Mon Sep 17 00:00:00 2001 From: Reedy Date: Thu, 31 Dec 2020 02:36:10 +0000 Subject: [PATCH] Remove TwoFactorIsEnabled hook handler Hook was part of Extension:OpenStackManager, but removed by REL1_35, so unnecessary I4741fcb073f8463f017bc1b477206dee801b662b / 46d9149c2db7c2b2d4573bede74b54779d66bee8 Change-Id: I2c5f99bfa9028c57a1eadbd81a51f84b47668848 --- extension.json | 1 - src/Hook/TwoFactorIsEnabled/SetIsEnabled.php | 54 -------------------- 2 files changed, 55 deletions(-) delete mode 100644 src/Hook/TwoFactorIsEnabled/SetIsEnabled.php diff --git a/extension.json b/extension.json index dc5ce20e..3e12acfa 100644 --- a/extension.json +++ b/extension.json @@ -42,7 +42,6 @@ }, "Hooks": { "AuthChangeFormFields": "\\MediaWiki\\Extension\\OATHAuth\\Hook\\AuthChangeFormFields\\TOTPExtendTokenField::callback", - "TwoFactorIsEnabled": "\\MediaWiki\\Extension\\OATHAuth\\Hook\\TwoFactorIsEnabled\\SetIsEnabled::callback", "LoadExtensionSchemaUpdates": "\\MediaWiki\\Extension\\OATHAuth\\Hook\\LoadExtensionSchemaUpdates\\UpdateTables::callback", "GetPreferences": "\\MediaWiki\\Extension\\OATHAuth\\Hook\\GetPreferences\\AuthModule::callback", "getUserPermissionsErrors": "\\MediaWiki\\Extension\\OATHAuth\\Hook\\GetUserPermissionsErrors\\CheckExclusiveRights::callback" diff --git a/src/Hook/TwoFactorIsEnabled/SetIsEnabled.php b/src/Hook/TwoFactorIsEnabled/SetIsEnabled.php deleted file mode 100644 index ddca8419..00000000 --- a/src/Hook/TwoFactorIsEnabled/SetIsEnabled.php +++ /dev/null @@ -1,54 +0,0 @@ -getService( 'OATHUserRepository' ); - $authUser = $userRepo->findByUser( RequestContext::getMain()->getUser() ); - $handler = new static( $authUser, $isEnabled ); - return $handler->execute(); - } - - /** - * SetIsEnabled constructor. - * @param OATHUser $authUser - * @param bool &$isEnabled - */ - protected function __construct( $authUser, &$isEnabled ) { - $this->authUser = $authUser; - $this->isEnabled = &$isEnabled; - } - - protected function execute() { - if ( $this->authUser && $this->authUser->getModule() !== null ) { - $this->isEnabled = true; - # This two-factor extension is enabled by the user, - # we don't need to check others. - return false; - } else { - $this->isEnabled = false; - # This two-factor extension isn't enabled by the user, - # but others may be. - return true; - } - } -}