summaryrefslogtreecommitdiffstats
path: root/apps/files_external/service/storagesservice.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/service/storagesservice.php')
-rw-r--r--apps/files_external/service/storagesservice.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/apps/files_external/service/storagesservice.php b/apps/files_external/service/storagesservice.php
index dd28c415cea..26ff956d27e 100644
--- a/apps/files_external/service/storagesservice.php
+++ b/apps/files_external/service/storagesservice.php
@@ -23,12 +23,9 @@
namespace OCA\Files_external\Service;
-use \OCP\IUserSession;
use \OC\Files\Filesystem;
-
use \OCA\Files_external\Lib\StorageConfig;
use \OCA\Files_external\NotFoundException;
-use \OCA\Files_External\Service\BackendService;
use \OCA\Files_External\Lib\Backend\Backend;
use \OCA\Files_External\Lib\Auth\AuthMechanism;
use \OCP\Files\StorageNotAvailableException;
@@ -85,6 +82,7 @@ abstract class StoragesService {
array_values($applicableGroups),
$mount['priority']
);
+ $config->setType($mount['type']);
$config->setId((int)$mount['mount_id']);
return $config;
} catch (\UnexpectedValueException $e) {
@@ -132,10 +130,23 @@ abstract class StoragesService {
throw new NotFoundException('Storage with id "' . $id . '" not found');
}
- return $this->getStorageConfigFromDBMount($mount);
+ $config = $this->getStorageConfigFromDBMount($mount);
+ if ($this->isApplicable($config)) {
+ return $config;
+ } else {
+ throw new NotFoundException('Storage with id "' . $id . '" not found');
+ }
}
/**
+ * Check whether this storage service should provide access to a storage
+ *
+ * @param StorageConfig $config
+ * @return bool
+ */
+ abstract protected function isApplicable(StorageConfig $config);
+
+ /**
* Gets all storages, valid or not
*
* @return StorageConfig[] array of storage configs