diff options
Diffstat (limited to 'apps/encryption')
-rw-r--r-- | apps/encryption/l10n/es.js | 2 | ||||
-rw-r--r-- | apps/encryption/l10n/es.json | 2 | ||||
-rw-r--r-- | apps/encryption/l10n/lv.js | 10 | ||||
-rw-r--r-- | apps/encryption/l10n/lv.json | 10 | ||||
-rw-r--r-- | apps/encryption/lib/Crypto/EncryptAll.php | 23 | ||||
-rw-r--r-- | apps/encryption/lib/Session.php | 2 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/EncryptAllTest.php | 33 |
7 files changed, 38 insertions, 44 deletions
diff --git a/apps/encryption/l10n/es.js b/apps/encryption/l10n/es.js index a1d92c851f5..114aa02968f 100644 --- a/apps/encryption/l10n/es.js +++ b/apps/encryption/l10n/es.js @@ -39,7 +39,7 @@ OC.L10N.register( "In order to use this encryption module you need to enable server-side encryption in the admin settings. Once enabled this module will encrypt all your files transparently. The encryption is based on AES 256 keys.\nThe module will not touch existing files, only new files will be encrypted after server-side encryption was enabled. It is also not possible to disable the encryption again and switch back to an unencrypted system.\nPlease read the documentation to know all implications before you decide to enable server-side encryption." : "De manera de usar este módulo de cifrado necesita activar el cifrado del lado del servidor en la configuraciones de administrador. Una vez que esté habilitado este módulo cifrará todos tus archivos de manera transparente. El cifrado está basado en llaves AES-256\nEl módulo no tocará los archivos existentes, solo los archivos nuevos serán cifrados una vez que el cifrado del lado del servidor se habilite. Además, no es posible deshabilitar el cifrado de nuevo y cambiar a un sistema sin cifrado.\nPor favor lea la documentación para que entienda todas las implicaciones antes de que decida habilitar el cifrado del lado del servidor.", "Encryption app is enabled but your keys are not initialized, please log-out and log-in again" : "La app de cifrado está habilitada pero sus claves no se han inicializado, por favor, cierre la sesión y vuelva a iniciarla de nuevo.", "Encrypt the home storage" : "Encriptar el almacenamiento personal", - "Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted" : "Al activar esta opción se encriptarán todos los archivos almacenados en la memoria principal, de lo contrario serán cifrados sólo los archivos de almacenamiento externo", + "Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted" : "Al activar esta opción se encriptarán todos los archivos almacenados en la memoria principal, de lo contrario, serán cifrados sólo los archivos de almacenamiento externo", "Enable recovery key" : "Activa la clave de recuperación", "Disable recovery key" : "Desactiva la clave de recuperación", "The recovery key is an additional encryption key used to encrypt files. It is used to recover files from an account if the password is forgotten." : "La llave de recuperación es una llave de cifrado adicional utilizada para cifrar archivos. Es utilizada para recuperar los archivos de una cuenta si la contraseña fuese olvidada.", diff --git a/apps/encryption/l10n/es.json b/apps/encryption/l10n/es.json index 3cd877cc715..9ec1c763bba 100644 --- a/apps/encryption/l10n/es.json +++ b/apps/encryption/l10n/es.json @@ -37,7 +37,7 @@ "In order to use this encryption module you need to enable server-side encryption in the admin settings. Once enabled this module will encrypt all your files transparently. The encryption is based on AES 256 keys.\nThe module will not touch existing files, only new files will be encrypted after server-side encryption was enabled. It is also not possible to disable the encryption again and switch back to an unencrypted system.\nPlease read the documentation to know all implications before you decide to enable server-side encryption." : "De manera de usar este módulo de cifrado necesita activar el cifrado del lado del servidor en la configuraciones de administrador. Una vez que esté habilitado este módulo cifrará todos tus archivos de manera transparente. El cifrado está basado en llaves AES-256\nEl módulo no tocará los archivos existentes, solo los archivos nuevos serán cifrados una vez que el cifrado del lado del servidor se habilite. Además, no es posible deshabilitar el cifrado de nuevo y cambiar a un sistema sin cifrado.\nPor favor lea la documentación para que entienda todas las implicaciones antes de que decida habilitar el cifrado del lado del servidor.", "Encryption app is enabled but your keys are not initialized, please log-out and log-in again" : "La app de cifrado está habilitada pero sus claves no se han inicializado, por favor, cierre la sesión y vuelva a iniciarla de nuevo.", "Encrypt the home storage" : "Encriptar el almacenamiento personal", - "Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted" : "Al activar esta opción se encriptarán todos los archivos almacenados en la memoria principal, de lo contrario serán cifrados sólo los archivos de almacenamiento externo", + "Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted" : "Al activar esta opción se encriptarán todos los archivos almacenados en la memoria principal, de lo contrario, serán cifrados sólo los archivos de almacenamiento externo", "Enable recovery key" : "Activa la clave de recuperación", "Disable recovery key" : "Desactiva la clave de recuperación", "The recovery key is an additional encryption key used to encrypt files. It is used to recover files from an account if the password is forgotten." : "La llave de recuperación es una llave de cifrado adicional utilizada para cifrar archivos. Es utilizada para recuperar los archivos de una cuenta si la contraseña fuese olvidada.", diff --git a/apps/encryption/l10n/lv.js b/apps/encryption/l10n/lv.js index 4e4d6b4ade3..b44cc20db29 100644 --- a/apps/encryption/l10n/lv.js +++ b/apps/encryption/l10n/lv.js @@ -2,16 +2,16 @@ OC.L10N.register( "encryption", { "Missing recovery key password" : "Pazudusi atkopšanas atslēgas parole", - "Please repeat the recovery key password" : "Lūdzu atkārtot atgūšanas atslēgas paroli", + "Please repeat the recovery key password" : "Lūgums atkārtot atkopes atslēgas paroli", "Repeated recovery key password does not match the provided recovery key password" : "Atkārtota atkopšanas atslēgas parole nesakrīt ar izsniegto atkopšanas atslēgu paroli", "Recovery key successfully enabled" : "Atkopšanas atslēga ir veiksmīgi iespējota", - "Could not enable recovery key. Please check your recovery key password!" : "Atkopšanas atslēgu nevarēja iespējot. Lūdzu, pārbaudiet atkopšanas atslēgas paroli!", + "Could not enable recovery key. Please check your recovery key password!" : "Atkopes atslēgu nevarēja iespējot. Lūgums pārbaudīt atkopes atslēgas paroli.", "Recovery key successfully disabled" : "Atkopšanas atslēga ir veiksmīgi deaktivizēta", - "Could not disable recovery key. Please check your recovery key password!" : "Atkopšanas atslēgu nevarēja atspējot. Lūdzu, pārbaudiet atkopšanas atslēgas paroli!", + "Could not disable recovery key. Please check your recovery key password!" : "Atkopes atslēgu nevarēja atspējot. Lūgums pārbaudīt atkopes atslēgas paroli.", "Missing parameters" : "Trūkstošos parametrs", "Please provide the old recovery password" : "Lūgums norādīt iepriekšējo atkopes paroli", - "Please provide a new recovery password" : "Lūdzu, ievadiet jaunu paroli", - "Please repeat the new recovery password" : "Lūdzu, atkārtojiet jauno atkopšanas paroli", + "Please provide a new recovery password" : "Lūgums norādīt jaunu atkopes paroli", + "Please repeat the new recovery password" : "Lūgums atkārtot jauno atkopes paroli", "Password successfully changed." : "Parole veiksmīgi nomainīta.", "Could not change the password. Maybe the old password was not correct." : "Nevarēja mainīt paroli. Varbūt vecā parole nav pareiza.", "Recovery Key disabled" : "Atkopšanas atslēga deaktivizēta", diff --git a/apps/encryption/l10n/lv.json b/apps/encryption/l10n/lv.json index 4bf8d7fce8e..42787888d86 100644 --- a/apps/encryption/l10n/lv.json +++ b/apps/encryption/l10n/lv.json @@ -1,15 +1,15 @@ { "translations": { "Missing recovery key password" : "Pazudusi atkopšanas atslēgas parole", - "Please repeat the recovery key password" : "Lūdzu atkārtot atgūšanas atslēgas paroli", + "Please repeat the recovery key password" : "Lūgums atkārtot atkopes atslēgas paroli", "Repeated recovery key password does not match the provided recovery key password" : "Atkārtota atkopšanas atslēgas parole nesakrīt ar izsniegto atkopšanas atslēgu paroli", "Recovery key successfully enabled" : "Atkopšanas atslēga ir veiksmīgi iespējota", - "Could not enable recovery key. Please check your recovery key password!" : "Atkopšanas atslēgu nevarēja iespējot. Lūdzu, pārbaudiet atkopšanas atslēgas paroli!", + "Could not enable recovery key. Please check your recovery key password!" : "Atkopes atslēgu nevarēja iespējot. Lūgums pārbaudīt atkopes atslēgas paroli.", "Recovery key successfully disabled" : "Atkopšanas atslēga ir veiksmīgi deaktivizēta", - "Could not disable recovery key. Please check your recovery key password!" : "Atkopšanas atslēgu nevarēja atspējot. Lūdzu, pārbaudiet atkopšanas atslēgas paroli!", + "Could not disable recovery key. Please check your recovery key password!" : "Atkopes atslēgu nevarēja atspējot. Lūgums pārbaudīt atkopes atslēgas paroli.", "Missing parameters" : "Trūkstošos parametrs", "Please provide the old recovery password" : "Lūgums norādīt iepriekšējo atkopes paroli", - "Please provide a new recovery password" : "Lūdzu, ievadiet jaunu paroli", - "Please repeat the new recovery password" : "Lūdzu, atkārtojiet jauno atkopšanas paroli", + "Please provide a new recovery password" : "Lūgums norādīt jaunu atkopes paroli", + "Please repeat the new recovery password" : "Lūgums atkārtot jauno atkopes paroli", "Password successfully changed." : "Parole veiksmīgi nomainīta.", "Could not change the password. Maybe the old password was not correct." : "Nevarēja mainīt paroli. Varbūt vecā parole nav pareiza.", "Recovery Key disabled" : "Atkopšanas atslēga deaktivizēta", diff --git a/apps/encryption/lib/Crypto/EncryptAll.php b/apps/encryption/lib/Crypto/EncryptAll.php index d9db616e6f1..4ed75b85a93 100644 --- a/apps/encryption/lib/Crypto/EncryptAll.php +++ b/apps/encryption/lib/Crypto/EncryptAll.php @@ -12,6 +12,7 @@ use OC\Files\View; use OCA\Encryption\KeyManager; use OCA\Encryption\Users\Setup; use OCA\Encryption\Util; +use OCP\Files\FileInfo; use OCP\IConfig; use OCP\IL10N; use OCP\IUser; @@ -202,15 +203,19 @@ class EncryptAll { while ($root = array_pop($directories)) { $content = $this->rootView->getDirectoryContent($root); foreach ($content as $file) { - $path = $root . '/' . $file['name']; - if ($this->rootView->is_dir($path)) { + $path = $root . '/' . $file->getName(); + if ($file->isShared()) { + $progress->setMessage("Skip shared file/folder $path"); + $progress->advance(); + continue; + } elseif ($file->getType() === FileInfo::TYPE_FOLDER) { $directories[] = $path; continue; } else { $progress->setMessage("encrypt files for user $userCount: $path"); $progress->advance(); try { - if ($this->encryptFile($path) === false) { + if ($this->encryptFile($file, $path) === false) { $progress->setMessage("encrypt files for user $userCount: $path (already encrypted)"); $progress->advance(); } @@ -231,17 +236,9 @@ class EncryptAll { } } - /** - * encrypt file - * - * @param string $path - * @return bool - */ - protected function encryptFile($path) { - + protected function encryptFile(FileInfo $fileInfo, string $path): bool { // skip already encrypted files - $fileInfo = $this->rootView->getFileInfo($path); - if ($fileInfo !== false && $fileInfo->isEncrypted()) { + if ($fileInfo->isEncrypted()) { return true; } diff --git a/apps/encryption/lib/Session.php b/apps/encryption/lib/Session.php index e2731d9611d..df1e5d664ad 100644 --- a/apps/encryption/lib/Session.php +++ b/apps/encryption/lib/Session.php @@ -66,7 +66,7 @@ class Session { public function getPrivateKey() { $key = $this->session->get('privateKey'); if (is_null($key)) { - throw new PrivateKeyMissingException('please try to log-out and log-in again', 0); + throw new PrivateKeyMissingException('please try to log-out and log-in again'); } return $key; } diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index 9b39c62b650..c56e3375a73 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -82,7 +82,7 @@ class EncryptAllTest extends TestCase { /** * We need format method to return a string - * @var OutputFormatterInterface|\PHPUnit\Framework\MockObject\MockObject + * @var OutputFormatterInterface&MockObject */ $outputFormatter = $this->createMock(OutputFormatterInterface::class); $outputFormatter->method('isDecorated')->willReturn(false); @@ -114,6 +114,13 @@ class EncryptAllTest extends TestCase { ); } + protected function createFileInfoMock($type, string $name): FileInfo&MockObject { + $fileInfo = $this->createMock(FileInfo::class); + $fileInfo->method('getType')->willReturn($type); + $fileInfo->method('getName')->willReturn($name); + return $fileInfo; + } + public function testEncryptAll(): void { /** @var EncryptAll&MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) @@ -299,8 +306,8 @@ class EncryptAllTest extends TestCase { '', null, [ - ['name' => 'foo', 'type' => 'dir'], - ['name' => 'bar', 'type' => 'file'], + $this->createFileInfoMock(FileInfo::TYPE_FOLDER, 'foo'), + $this->createFileInfoMock(FileInfo::TYPE_FILE, 'bar'), ], ], [ @@ -308,26 +315,17 @@ class EncryptAllTest extends TestCase { '', null, [ - ['name' => 'subfile', 'type' => 'file'] + $this->createFileInfoMock(FileInfo::TYPE_FILE, 'subfile'), ], ], ]); - $this->view->expects($this->any())->method('is_dir') - ->willReturnCallback( - function ($path) { - if ($path === '/user1/files/foo') { - return true; - } - return false; - } - ); - $encryptAllCalls = []; $encryptAll->expects($this->exactly(2)) ->method('encryptFile') - ->willReturnCallback(function (string $path) use (&$encryptAllCalls): void { + ->willReturnCallback(function (FileInfo $file, string $path) use (&$encryptAllCalls): bool { $encryptAllCalls[] = $path; + return true; }); $outputFormatter = $this->createMock(OutputFormatterInterface::class); @@ -362,8 +360,7 @@ class EncryptAllTest extends TestCase { $fileInfo = $this->createMock(FileInfo::class); $fileInfo->expects($this->any())->method('isEncrypted') ->willReturn($isEncrypted); - $this->view->expects($this->any())->method('getFileInfo') - ->willReturn($fileInfo); + $this->view->expects($this->never())->method('getFileInfo'); if ($isEncrypted) { @@ -375,7 +372,7 @@ class EncryptAllTest extends TestCase { } $this->assertTrue( - $this->invokePrivate($this->encryptAll, 'encryptFile', ['foo.txt']) + $this->invokePrivate($this->encryptAll, 'encryptFile', [$fileInfo, 'foo.txt']) ); } |