diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-07-06 15:58:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-06 15:58:48 +0200 |
commit | ad1d4d363fca28b34396bcfb605ba5336cf040f7 (patch) | |
tree | 4a1e712fb13f82206abde7b841e57b67916fa5da /lib | |
parent | 984953ef4a5917e672118a96e3b3714862011308 (diff) | |
parent | 001a9c02dd1361dce5808d21dbbb5c7c4f320172 (diff) | |
download | nextcloud-server-ad1d4d363fca28b34396bcfb605ba5336cf040f7.tar.gz nextcloud-server-ad1d4d363fca28b34396bcfb605ba5336cf040f7.zip |
Merge pull request #5174 from nextcloud/new-encryption-default
Use the master key by default
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Encryption/Update.php | 10 | ||||
-rw-r--r-- | lib/private/Files/Stream/Encryption.php | 5 | ||||
-rw-r--r-- | lib/public/Encryption/IEncryptionModule.php | 10 |
3 files changed, 23 insertions, 2 deletions
diff --git a/lib/private/Encryption/Update.php b/lib/private/Encryption/Update.php index ad40183767b..94d64b73504 100644 --- a/lib/private/Encryption/Update.php +++ b/lib/private/Encryption/Update.php @@ -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); diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index d1f68696848..b68917ce76e 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -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 ( diff --git a/lib/public/Encryption/IEncryptionModule.php b/lib/public/Encryption/IEncryptionModule.php index 6be9763c9c8..d96c6c8ba06 100644 --- a/lib/public/Encryption/IEncryptionModule.php +++ b/lib/public/Encryption/IEncryptionModule.php @@ -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(); + } |