/** @var string */
private $user;
- /** @var string */
+ /** @var array */
private $owner;
/** @var string */
$this->decryptAll = $decryptAll;
$this->logger = $logger;
$this->l = $il10n;
+ $this->owner = [];
$this->useMasterPassword = $util->isMasterKeyEnabled();
}
$this->path = $this->getPathToRealFile($path);
$this->accessList = $accessList;
$this->user = $user;
- $this->owner = $this->util->getOwner($path);
$this->isWriteOperation = false;
$this->writeCache = '';
}
}
- $publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys, $this->owner);
+ $publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys, $this->getOwner($path));
$encryptedKeyfiles = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys);
$this->keyManager->setAllFileKeys($this->path, $encryptedKeyfiles);
}
}
}
- $publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $this->owner);
+ $publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $this->getOwner($path));
$encryptedFileKey = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
return $path;
}
+ /**
+ * get owner of a file
+ *
+ * @param string $path
+ * @return string
+ */
+ protected function getOwner($path) {
+ if (!isset($this->owner[$path])) {
+ $this->owner[$path] = $this->util->getOwner($path);
+ }
+ return $this->owner[$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