summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Service
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-11-03 12:14:44 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-09-04 11:54:08 +0200
commit5df5b9c8b13770142eab82e889eed5e50da5fab3 (patch)
tree09891fdb160a0f21048b201e450b1b17f556ce22 /apps/files_external/lib/Service
parentd21713d52627a267881b8a426aa613d3ac2d14d9 (diff)
downloadnextcloud-server-5df5b9c8b13770142eab82e889eed5e50da5fab3.tar.gz
nextcloud-server-5df5b9c8b13770142eab82e889eed5e50da5fab3.zip
Handle invalid ext storage backend to keep mount point visible
Keep mount point visible and also ext storage config visible when dealing with configs relating to storage backends or auth mechanisms that were provided by an app that is currently disabled. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_external/lib/Service')
-rw-r--r--apps/files_external/lib/Service/StoragesService.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php
index 4e38ea96259..d52bf410461 100644
--- a/apps/files_external/lib/Service/StoragesService.php
+++ b/apps/files_external/lib/Service/StoragesService.php
@@ -29,6 +29,8 @@
namespace OCA\Files_External\Service;
use \OC\Files\Filesystem;
+use OCA\Files_External\Lib\Auth\InvalidAuth;
+use OCA\Files_External\Lib\Backend\InvalidBackend;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use \OCA\Files_External\Lib\Backend\Backend;
@@ -295,11 +297,11 @@ abstract class StoragesService {
) {
$backend = $this->backendService->getBackend($backendIdentifier);
if (!$backend) {
- throw new \InvalidArgumentException('Unable to get backend for ' . $backendIdentifier);
+ $backend = new InvalidBackend($backendIdentifier);
}
$authMechanism = $this->backendService->getAuthMechanism($authMechanismIdentifier);
if (!$authMechanism) {
- throw new \InvalidArgumentException('Unable to get authentication mechanism for ' . $authMechanismIdentifier);
+ $authMechanism = new InvalidAuth($authMechanismIdentifier);
}
$newStorage = new StorageConfig();
$newStorage->setMountPoint($mountPoint);
@@ -382,6 +384,10 @@ abstract class StoragesService {
$oldStorage = $this->getStorageConfigFromDBMount($existingMount);
+ if ($oldStorage->getBackend() instanceof InvalidBackend) {
+ throw new NotFoundException('Storage with id "' . $id . '" cannot be edited due to missing backend');
+ }
+
$removedUsers = array_diff($oldStorage->getApplicableUsers(), $updatedStorage->getApplicableUsers());
$removedGroups = array_diff($oldStorage->getApplicableGroups(), $updatedStorage->getApplicableGroups());
$addedUsers = array_diff($updatedStorage->getApplicableUsers(), $oldStorage->getApplicableUsers());