diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-14 17:32:25 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-15 15:07:40 +0200 |
commit | 50e20e531ea942d900c50b510c8c13a6a1dd1465 (patch) | |
tree | db641d3406f9930dce8ba6223dd69e79b36f7627 /apps/encryption/lib | |
parent | 5911ce530b003d46348f59e9280b610f684de85a (diff) | |
download | nextcloud-server-50e20e531ea942d900c50b510c8c13a6a1dd1465.tar.gz nextcloud-server-50e20e531ea942d900c50b510c8c13a6a1dd1465.zip |
Introduce isReadyForUser and verify in file transfer ownership - fixes #23786
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r-- | apps/encryption/lib/crypto/encryption.php | 13 | ||||
-rw-r--r-- | apps/encryption/lib/keymanager.php | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/apps/encryption/lib/crypto/encryption.php b/apps/encryption/lib/crypto/encryption.php index 907a6437f5b..6eff66e72be 100644 --- a/apps/encryption/lib/crypto/encryption.php +++ b/apps/encryption/lib/crypto/encryption.php @@ -547,4 +547,17 @@ class Encryption implements IEncryptionModule { return $path; } + /** + * Check if the module is ready to be used by that specific user. + * In case a module is not ready - because e.g. key pairs have not been generated + * upon login this method can return false before any operation starts and might + * cause issues during operations. + * + * @param string $user + * @return boolean + * @since 9.1.0 + */ + public function isReadyForUser($user) { + return $this->keyManager->userHasKeys($user); + } } diff --git a/apps/encryption/lib/keymanager.php b/apps/encryption/lib/keymanager.php index 12fa5f92bd5..0accfb7900a 100644 --- a/apps/encryption/lib/keymanager.php +++ b/apps/encryption/lib/keymanager.php @@ -493,6 +493,7 @@ class KeyManager { */ public function userHasKeys($userId) { $privateKey = $publicKey = true; + $exception = null; try { $this->getPrivateKey($userId); |