diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-11 12:20:18 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-15 08:22:52 +0200 |
commit | 83e994c11fcc25a525e604bf7cc100f574794e02 (patch) | |
tree | 7ee44e5ad7bee886e98d7d6f14a4805bc16da611 /settings/Controller | |
parent | 82a5833217d8fb1a74e7838b3e2ccf2cb9e1b90c (diff) | |
download | nextcloud-server-83e994c11fcc25a525e604bf7cc100f574794e02.tar.gz nextcloud-server-83e994c11fcc25a525e604bf7cc100f574794e02.zip |
Make it possible to enforce mandatory 2FA for groups
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'settings/Controller')
-rw-r--r-- | settings/Controller/TwoFactorSettingsController.php | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/settings/Controller/TwoFactorSettingsController.php b/settings/Controller/TwoFactorSettingsController.php index 87dbd97b80b..6464886491e 100644 --- a/settings/Controller/TwoFactorSettingsController.php +++ b/settings/Controller/TwoFactorSettingsController.php @@ -26,12 +26,11 @@ declare(strict_types=1); namespace OC\Settings\Controller; +use OC\Authentication\TwoFactorAuth\EnforcementState; use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; -use OCP\AppFramework\Http\Response; use OCP\IRequest; -use OCP\JSON; class TwoFactorSettingsController extends Controller { @@ -46,18 +45,16 @@ class TwoFactorSettingsController extends Controller { $this->mandatoryTwoFactor = $mandatoryTwoFactor; } - public function index(): Response { - return new JSONResponse([ - 'enabled' => $this->mandatoryTwoFactor->isEnforced(), - ]); + public function index(): JSONResponse { + return new JSONResponse($this->mandatoryTwoFactor->getState()); } - public function update(bool $enabled): Response { - $this->mandatoryTwoFactor->setEnforced($enabled); + public function update(bool $enforced, array $enforcedGroups = [], array $excludedGroups = []): JSONResponse { + $this->mandatoryTwoFactor->setState( + new EnforcementState($enforced, $enforcedGroups, $excludedGroups) + ); - return new JSONResponse([ - 'enabled' => $enabled - ]); + return new JSONResponse($this->mandatoryTwoFactor->getState()); } }
\ No newline at end of file |