Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_accesscontrol.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-10-21 18:36:34 +0300
committerGitHub <noreply@github.com>2016-10-21 18:36:34 +0300
commit929126582d83b7db2967bcb2d5d5da3500e66274 (patch)
tree2f0a6031381cc0547a7c31b158c0e3a3abe34a3e
parent303155d69d0d8ca2f6ff1bbaba387a316a6cc627 (diff)
parentacf701a36c2e11cb5163b8cc9cf45bf9e06bc892 (diff)
Merge pull request #44 from nextcloud/backport-42-cachewrapper-failurev10.0.6RC1v10.0.6v10.0.5RC2v10.0.5RC1v10.0.5v10.0.4RC1v10.0.4v10.0.3RC1v10.0.3v10.0.2stable10
[stable10] Make sure we only require what is allowed
-rw-r--r--lib/CacheWrapper.php5
-rw-r--r--lib/Operation.php20
2 files changed, 16 insertions, 9 deletions
diff --git a/lib/CacheWrapper.php b/lib/CacheWrapper.php
index 31f9c3b..1941589 100644
--- a/lib/CacheWrapper.php
+++ b/lib/CacheWrapper.php
@@ -25,6 +25,7 @@ use OC\Files\Cache\Wrapper\CacheWrapper as Wrapper;
use OCP\Constants;
use OCP\Files\Cache\ICache;
use OCP\Files\ForbiddenException;
+use OCP\Files\Storage\IStorage;
class CacheWrapper extends Wrapper {
/** @var Operation */
@@ -36,10 +37,10 @@ class CacheWrapper extends Wrapper {
/**
* @param ICache $cache
- * @param StorageWrapper $storage
+ * @param IStorage $storage
* @param Operation $operation
*/
- public function __construct(ICache $cache, StorageWrapper $storage, Operation $operation) {
+ public function __construct(ICache $cache, IStorage $storage, Operation $operation) {
parent::__construct($cache);
$this->storage = $storage;
$this->operation = $operation;
diff --git a/lib/Operation.php b/lib/Operation.php
index 0cc8f48..9cc790d 100644
--- a/lib/Operation.php
+++ b/lib/Operation.php
@@ -23,6 +23,7 @@ namespace OCA\FilesAccessControl;
use OCP\Files\ForbiddenException;
+use OCP\Files\Storage\IStorage;
use OCP\IL10N;
use OCP\WorkflowEngine\IManager;
use OCP\WorkflowEngine\IOperation;
@@ -44,11 +45,11 @@ class Operation implements IOperation{
}
/**
- * @param StorageWrapper $storage
+ * @param IStorage $storage
* @param string $path
* @throws ForbiddenException
*/
- public function checkFileAccess(StorageWrapper $storage, $path) {
+ public function checkFileAccess(IStorage $storage, $path) {
if (!$this->isBlockablePath($storage, $path) || $this->isCreatingSkeletonFiles()) {
// Allow creating skeletons and theming
// https://github.com/nextcloud/files_accesscontrol/issues/5
@@ -67,12 +68,17 @@ class Operation implements IOperation{
}
/**
- * @param StorageWrapper $storage
+ * @param IStorage $storage
* @param string $path
* @return bool
*/
- protected function isBlockablePath(StorageWrapper $storage, $path) {
- $fullPath = $storage->mountPoint . $path;
+ protected function isBlockablePath(IStorage $storage, $path) {
+ if (property_exists($storage, 'mountPoint')) {
+ /** @var StorageWrapper $storage */
+ $fullPath = $storage->mountPoint . $path;
+ } else {
+ $fullPath = $path;
+ }
if (substr_count($fullPath, '/') < 3) {
return false;
@@ -91,11 +97,11 @@ class Operation implements IOperation{
/**
* For thumbnails and versions we want to check the tags of the original file
*
- * @param StorageWrapper $storage
+ * @param IStorage $storage
* @param string $path
* @return bool
*/
- protected function translatePath(StorageWrapper $storage, $path) {
+ protected function translatePath(IStorage $storage, $path) {
if (substr_count($path, '/') < 1) {
return $path;
}