aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_encryption/lib/util.php')
-rw-r--r--apps/files_encryption/lib/util.php30
1 files changed, 21 insertions, 9 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index d12b003b227..d214d13de69 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -869,6 +869,25 @@ class Util {
}
/**
+ * 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;
+ }
+ $util = new Util($this->view, $user);
+ return $util->ready();
+ }
+
+ /**
* Filter an array of UIDs to return only ones ready for sharing
* @param array $unfilteredUsers users to be checked for sharing readiness
* @return array as multi-dimensional array. keys: ready, unready
@@ -880,16 +899,9 @@ class Util {
// Loop through users and create array of UIDs that need new keyfiles
foreach ($unfilteredUsers as $user) {
-
- $util = new Util($this->view, $user);
-
// Check that the user is encryption capable, or is the
- // public system user 'ownCloud' (for public shares)
- if (
- $user === $this->publicShareKeyId
- or $user === $this->recoveryKeyId
- or $util->ready()
- ) {
+ // public system user (for public shares)
+ if ($this->isUserReady($user)) {
// Construct array of ready UIDs for Keymanager{}
$readyIds[] = $user;