diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-07-03 09:44:37 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-07-09 13:39:27 +0200 |
commit | 1c261675ad3da9804bd9a8c88326103eb2f56bd3 (patch) | |
tree | bb8dfba33103e10ca51eef1519dc25c46ec55cd3 /settings/Controller | |
parent | 22de685f546474890ff43bc7d68754afe9fbd6f1 (diff) | |
download | nextcloud-server-1c261675ad3da9804bd9a8c88326103eb2f56bd3.tar.gz nextcloud-server-1c261675ad3da9804bd9a8c88326103eb2f56bd3.zip |
Refactor: move remote wipe token logic to RW service
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'settings/Controller')
-rw-r--r-- | settings/Controller/AuthSettingsController.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/settings/Controller/AuthSettingsController.php b/settings/Controller/AuthSettingsController.php index be497315ed4..da9414dcb10 100644 --- a/settings/Controller/AuthSettingsController.php +++ b/settings/Controller/AuthSettingsController.php @@ -35,6 +35,7 @@ use OC\Authentication\Token\INamedToken; use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IToken; use OC\Authentication\Token\IWipeableToken; +use OC\Authentication\Token\RemoteWipe; use OC\Settings\Activity\Provider; use OCP\Activity\IManager; use OCP\AppFramework\Controller; @@ -63,6 +64,9 @@ class AuthSettingsController extends Controller { /** @var IManager */ private $activityManager; + /** @var RemoteWipe */ + private $remoteWipe; + /** @var ILogger */ private $logger; @@ -74,6 +78,7 @@ class AuthSettingsController extends Controller { * @param ISecureRandom $random * @param string|null $userId * @param IManager $activityManager + * @param RemoteWipe $remoteWipe * @param ILogger $logger */ public function __construct(string $appName, @@ -83,6 +88,7 @@ class AuthSettingsController extends Controller { ISecureRandom $random, ?string $userId, IManager $activityManager, + RemoteWipe $remoteWipe, ILogger $logger) { parent::__construct($appName, $request); $this->tokenProvider = $tokenProvider; @@ -90,6 +96,7 @@ class AuthSettingsController extends Controller { $this->session = $session; $this->random = $random; $this->activityManager = $activityManager; + $this->remoteWipe = $remoteWipe; $this->logger = $logger; } @@ -262,15 +269,10 @@ class AuthSettingsController extends Controller { * @throws \OC\Authentication\Exceptions\ExpiredTokenException */ public function wipe(int $id): JSONResponse { - $token = $this->tokenProvider->getTokenById($id); - - if (!($token instanceof IWipeableToken)) { + if (!$this->remoteWipe->markTokenForWipe($id)) { return new JSONResponse([], Http::STATUS_BAD_REQUEST); } - $token->wipe(); - $this->tokenProvider->updateToken($token); - return new JSONResponse([]); } } |