/** * Returns the wrapped storage's value for isLocal() * * @return bool wrapped storage's isLocal() value */ public function isLocal() { if ($this->encryptionManager->isEnabled()) { return false; } return $this->storage->isLocal(); }
protected function execute(InputInterface $input, OutputInterface $output) { if ($this->encryptionManager->isEnabled() === false) { throw new \Exception('Server side encryption is not enabled'); } $output->writeln("\n"); $output->writeln('You are about to start to encrypt all files stored in your ownCloud.'); $output->writeln('It will depend on the encryption module you use which files get encrypted.'); $output->writeln('Depending on the number and size of your files this can take some time'); $output->writeln('Please make sure that no user access his files during this process!'); $output->writeln(''); $question = new ConfirmationQuestion('Do you really want to continue? (y/n) ', false); if ($this->questionHelper->ask($input, $output, $question)) { $this->forceSingleUserAndTrashbin(); try { $defaultModule = $this->encryptionManager->getEncryptionModule(); $defaultModule->encryptAll($input, $output); } catch (\Exception $ex) { $this->resetSingleUserAndTrashbin(); throw $ex; } $this->resetSingleUserAndTrashbin(); } else { $output->writeln('aborted'); } }
/** * @param array $urlParams * @param bool $encryptionSystemReady */ public function __construct($urlParams = array(), $encryptionSystemReady = true) { parent::__construct('encryption', $urlParams); $this->encryptionManager = \OC::$server->getEncryptionManager(); $this->config = \OC::$server->getConfig(); $this->registerServices(); if ($encryptionSystemReady === false) { /** @var Session $session */ $session = $this->getContainer()->query('Session'); $session->setStatus(Session::RUN_MIGRATION); } if ($this->encryptionManager->isEnabled() && $encryptionSystemReady) { /** @var Setup $setup */ $setup = $this->getContainer()->query('UserSetup'); $setup->setupSystem(); } }
protected function execute(InputInterface $input, OutputInterface $output) { try { if ($this->encryptionManager->isEnabled() === true) { $output->write('Disable server side encryption... '); $this->config->setAppValue('core', 'encryption_enabled', 'no'); $output->writeln('done.'); } else { $output->writeln('Server side encryption not enabled. Nothing to do.'); return; } $uid = $input->getArgument('user'); if ($uid === '') { $message = 'your ownCloud'; } else { $message = "{$uid}'s account"; } $output->writeln("\n"); $output->writeln("You are about to start to decrypt all files stored in {$message}."); $output->writeln('It will depend on the encryption module and your setup if this is possible.'); $output->writeln('Depending on the number and size of your files this can take some time'); $output->writeln('Please make sure that no user access his files during this process!'); $output->writeln(''); $question = new ConfirmationQuestion('Do you really want to continue? (y/n) ', false); if ($this->questionHelper->ask($input, $output, $question)) { $this->forceSingleUserAndTrashbin(); $user = $input->getArgument('user'); $result = $this->decryptAll->decryptAll($input, $output, $user); if ($result === false) { $output->writeln(' aborted.'); $output->writeln('Server side encryption remains enabled'); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); } else { if ($uid !== '') { $output->writeln('Server side encryption remains enabled'); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); } } $this->resetSingleUserAndTrashbin(); } else { $output->write('Enable server side encryption... '); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); $output->writeln('done.'); $output->writeln('aborted'); } } catch (\Exception $e) { // enable server side encryption again if something went wrong $this->config->setAppValue('core', 'encryption_enabled', 'yes'); $this->resetSingleUserAndTrashbin(); throw $e; } }
protected function execute(InputInterface $input, OutputInterface $output) { $this->writeArrayInOutputFormat($input, $output, ['enabled' => $this->encryptionManager->isEnabled(), 'defaultModule' => $this->encryptionManager->getDefaultEncryptionModuleId()]); }