summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-07-04 16:10:03 +0200
committerGitHub <noreply@github.com>2016-07-04 16:10:03 +0200
commit8d866dfba447ebfddd921d4393ee099451b9731d (patch)
treecec445c6aff526378d0037729b7e14876df71056 /apps/files_external
parent411515ba0ebfcf984a0b46bac78fda1a96575f32 (diff)
parent9fb92b56eceb0d1a84c6791d90dc1688c3da4b3e (diff)
downloadnextcloud-server-8d866dfba447ebfddd921d4393ee099451b9731d.tar.gz
nextcloud-server-8d866dfba447ebfddd921d4393ee099451b9731d.zip
Merge pull request #25314 from owncloud/files_external-backends-config
show configuration options for authentication backends
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/Command/Backends.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php
index 260ea210397..d1da6db3f6a 100644
--- a/apps/files_external/lib/Command/Backends.php
+++ b/apps/files_external/lib/Command/Backends.php
@@ -98,15 +98,30 @@ 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();
$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;
}
+
+ /**
+ * @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);
+ }
}