mirror of
https://github.com/nextcloud/server.git
synced 2024-08-31 05:58:34 +02:00
only collect detailed access list if it is really needed
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
9c5ba2f12c
commit
da51ec38f4
@ -569,4 +569,13 @@ class Encryption implements IEncryptionModule {
|
||||
public function isReadyForUser($user) {
|
||||
return $this->keyManager->userHasKeys($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* We only need a detailed access list if the master key is not enabled
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function needDetailedAccessList() {
|
||||
return !$this->util->isMasterKeyEnabled();
|
||||
}
|
||||
}
|
||||
|
@ -168,6 +168,14 @@ class Update {
|
||||
*/
|
||||
public function update($path) {
|
||||
|
||||
$encryptionModule = $this->encryptionManager->getEncryptionModule();
|
||||
|
||||
// if the encryption module doesn't encrypt the files on a per-user basis
|
||||
// we have nothing to do here.
|
||||
if ($encryptionModule->needDetailedAccessList() === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if a folder was shared, get a list of all (sub-)folders
|
||||
if ($this->view->is_dir($path)) {
|
||||
$allFiles = $this->util->getAllFiles($path);
|
||||
@ -175,7 +183,7 @@ class Update {
|
||||
$allFiles = array($path);
|
||||
}
|
||||
|
||||
$encryptionModule = $this->encryptionManager->getEncryptionModule();
|
||||
|
||||
|
||||
foreach ($allFiles as $file) {
|
||||
$usersSharing = $this->file->getAccessList($file);
|
||||
|
@ -254,7 +254,10 @@ class Encryption extends Wrapper {
|
||||
$sharePath = dirname($sharePath);
|
||||
}
|
||||
|
||||
$accessList = $this->file->getAccessList($sharePath);
|
||||
$accessList = [];
|
||||
if ($this->encryptionModule->needDetailedAccessList()) {
|
||||
$accessList = $this->file->getAccessList($sharePath);
|
||||
}
|
||||
$this->newHeader = $this->encryptionModule->begin($this->fullPath, $this->uid, $mode, $this->header, $accessList);
|
||||
|
||||
if (
|
||||
|
@ -182,4 +182,14 @@ interface IEncryptionModule {
|
||||
*/
|
||||
public function isReadyForUser($user);
|
||||
|
||||
/**
|
||||
* Does the encryption module needs a detailed list of users with access to the file?
|
||||
* For example if the encryption module uses per-user encryption keys and needs to know
|
||||
* the users with access to the file to encrypt/decrypt it.
|
||||
*
|
||||
* @since 13.0.0
|
||||
* @return bool
|
||||
*/
|
||||
public function needDetailedAccessList();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user