From f982d104f3d393ae15bca84c1bef373162b0fe3f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 30 Jun 2016 15:41:57 +0200 Subject: [PATCH 1/2] hide hidden parameters from list backend/auth parameters --- apps/files_external/lib/Command/Backends.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php index 260ea21039..b5d5ad4d18 100644 --- a/apps/files_external/lib/Command/Backends.php +++ b/apps/files_external/lib/Command/Backends.php @@ -98,9 +98,7 @@ class Backends extends Base { $result = [ 'name' => $data['name'], 'identifier' => $data['identifier'], - 'configuration' => array_map(function (DefinitionParameter $parameter) { - return $parameter->getTypeName(); - }, $data['configuration']) + 'configuration' => $this->formatConfiguration($data['configuration']) ]; if ($backend instanceof Backend) { $result['storage_class'] = $backend->getStorageClass(); @@ -109,4 +107,17 @@ class Backends extends Base { } return $result; } + + /** + * @param DefinitionParameter[] $parameters + * @return string[] + */ + private function formatConfiguration(array $parameters) { + $configuration = array_filter($parameters, function (DefinitionParameter $parameter) { + return $parameter->getType() !== DefinitionParameter::VALUE_HIDDEN; + }); + return array_map(function (DefinitionParameter $parameter) { + return $parameter->getTypeName(); + }, $configuration); + } } From 9fb92b56eceb0d1a84c6791d90dc1688c3da4b3e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 30 Jun 2016 15:49:31 +0200 Subject: [PATCH 2/2] show configuration options for authentication backends while listing storage Fixes #22447 --- apps/files_external/lib/Command/Backends.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php index b5d5ad4d18..d1da6db3f6 100644 --- a/apps/files_external/lib/Command/Backends.php +++ b/apps/files_external/lib/Command/Backends.php @@ -104,6 +104,10 @@ class Backends extends Base { $result['storage_class'] = $backend->getStorageClass(); $authBackends = $this->backendService->getAuthMechanismsByScheme(array_keys($backend->getAuthSchemes())); $result['supported_authentication_backends'] = array_keys($authBackends); + $authConfig = array_map(function (AuthMechanism $auth) { + return $this->serializeAuthBackend($auth)['configuration']; + }, $authBackends); + $result['authentication_configuration'] = array_combine(array_keys($authBackends), $authConfig); } return $result; }