From 887be709f5f0dbbc6ad7b1cc1a9793d04421c5b9 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 12 May 2015 18:49:25 +0200 Subject: a new approach to display the error message --- lib/private/files/storage/wrapper/encryption.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/private/files/storage') diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index f7759d91497..1683ff1350f 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -252,6 +252,30 @@ class Encryption extends Wrapper { return $result; } + /** + * check if a file can be read + * + * @param string $path + * @return bool + */ + public function isReadable($path) { + + $isReadable = true; + + $metaData = $this->getMetaData($path); + if ( + !$this->is_dir($path) && + isset($metaData['encrypted']) && + $metaData['encrypted'] === true + ) { + $fullPath = $this->getFullPath($path); + $module = $this->getEncryptionModule($path); + $isReadable = $module->isReadable($fullPath, $this->uid); + } + + return $this->storage->isReadable($path) && $isReadable; + } + /** * see http://php.net/manual/en/function.copy.php * -- cgit v1.2.3