summaryrefslogtreecommitdiffstats
path: root/apps/files_external/controller/storagescontroller.php
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-09-23 15:35:17 +0100
committerRobin McCorkell <rmccorkell@owncloud.com>2015-09-23 16:00:11 +0100
commit24043333008b12dfbe7374cb318d9041717b87e0 (patch)
tree415d4ddb64db6da0971d6059769a0ef0e63a815f /apps/files_external/controller/storagescontroller.php
parent6f5f1c4f142e5e2417b188b55d2f9fadf03749b3 (diff)
downloadnextcloud-server-24043333008b12dfbe7374cb318d9041717b87e0.tar.gz
nextcloud-server-24043333008b12dfbe7374cb318d9041717b87e0.zip
Perform visibility checks on storages
StoragesService::getStorages() will check the visibility of the backend and auth mechanism for the storage, and if either are not visible to the user (aka disabled by admin) then the storage will be filtered out. The original method StoragesService::getAllStorages() still exists in case such storages need to be detected, but its use is discouraged.
Diffstat (limited to 'apps/files_external/controller/storagescontroller.php')
-rw-r--r--apps/files_external/controller/storagescontroller.php13
1 files changed, 3 insertions, 10 deletions
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php
index 71055fd1b9c..6a01112f8c5 100644
--- a/apps/files_external/controller/storagescontroller.php
+++ b/apps/files_external/controller/storagescontroller.php
@@ -153,7 +153,7 @@ abstract class StoragesController extends Controller {
$backend = $storage->getBackend();
/** @var AuthMechanism */
$authMechanism = $storage->getAuthMechanism();
- if (!$backend || $backend->checkDependencies()) {
+ if ($backend->checkDependencies()) {
// invalid backend
return new DataResponse(
array(
@@ -165,7 +165,7 @@ abstract class StoragesController extends Controller {
);
}
- if (!$backend->isVisibleFor($this->getVisibilityType())) {
+ if (!$backend->isVisibleFor($this->service->getVisibilityType())) {
// not permitted to use backend
return new DataResponse(
array(
@@ -176,7 +176,7 @@ abstract class StoragesController extends Controller {
Http::STATUS_UNPROCESSABLE_ENTITY
);
}
- if (!$authMechanism->isVisibleFor($this->getVisibilityType())) {
+ if (!$authMechanism->isVisibleFor($this->service->getVisibilityType())) {
// not permitted to use auth mechanism
return new DataResponse(
array(
@@ -211,13 +211,6 @@ abstract class StoragesController extends Controller {
}
/**
- * Get the visibility type for this controller, used in validation
- *
- * @return string BackendService::VISIBILITY_* constants
- */
- abstract protected function getVisibilityType();
-
- /**
* Check whether the given storage is available / valid.
*
* Note that this operation can be time consuming depending