/** * Returns whether the given user is ready for encryption. * Also returns true if the given user is the public user * or the recovery key user. * * @param string $user user to check * * @return boolean true if the user is ready, false otherwise */ private function isUserReady($user) { if ($user === $this->publicShareKeyId || $user === $this->recoveryKeyId) { return true; } try { $util = new Util($this->view, $user); return $util->ready(); } catch (NoUserException $e) { \OCP\Util::writeLog('Encryption library', 'No User object for ' . $user, \OCP\Util::DEBUG); return false; } }
/** * @medium * test checking whether account is ready for encryption, */ function testUserIsReady() { $this->assertEquals(true, $this->util->ready()); }