summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-22 10:33:18 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-22 10:33:18 +0200
commit27d6852b3ead63454d3cf0f3c79372af6852f9ac (patch)
treee96e037bdd0c900ec16ede1ab8d4fa923e11fa76 /lib
parent81b5df32365123d2c9b8a912f7ec47d1d3b29b5a (diff)
parentdf544e8dbeddb11225a5d55a04038e42cfa5eecf (diff)
downloadnextcloud-server-27d6852b3ead63454d3cf0f3c79372af6852f9ac.tar.gz
nextcloud-server-27d6852b3ead63454d3cf0f3c79372af6852f9ac.zip
Merge pull request #24131 from owncloud/dont-transfer-files-to-not-ready-user-stable9
[9.0] Introduce isReadyForUser and verify in file transfer ownership
Diffstat (limited to 'lib')
-rw-r--r--lib/private/encryption/manager.php19
-rw-r--r--lib/public/encryption/iencryptionmodule.php12
2 files changed, 31 insertions, 0 deletions
diff --git a/lib/private/encryption/manager.php b/lib/private/encryption/manager.php
index d45bbf07ee9..8714d161807 100644
--- a/lib/private/encryption/manager.php
+++ b/lib/private/encryption/manager.php
@@ -117,6 +117,25 @@ class Manager implements IManager {
}
/**
+ * @param string $user
+ */
+ public function isReadyForUser($user) {
+ if (!$this->isReady()) {
+ return false;
+ }
+
+ foreach ($this->getEncryptionModules() as $module) {
+ /** @var IEncryptionModule $m */
+ $m = call_user_func($module['callback']);
+ if (!$m->isReadyForUser($user)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
* Registers an callback function which must return an encryption module instance
*
* @param string $id
diff --git a/lib/public/encryption/iencryptionmodule.php b/lib/public/encryption/iencryptionmodule.php
index df30dd57cee..8d20a1ab57d 100644
--- a/lib/public/encryption/iencryptionmodule.php
+++ b/lib/public/encryption/iencryptionmodule.php
@@ -168,4 +168,16 @@ interface IEncryptionModule {
*/
public function prepareDecryptAll(InputInterface $input, OutputInterface $output, $user = '');
+ /**
+ * 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);
+
}