aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorLucas Azevedo <lhs_azevedo@hotmail.com>2023-08-25 11:13:34 -0300
committerLucas Azevedo <lhs_azevedo@hotmail.com>2023-08-25 11:20:34 -0300
commit9c66bf6dc3ca29ac52f6fd83ff0d05edafb917b3 (patch)
tree2696a5c9b7af9f6b30ab250ef7507920a9ae01b6 /core/Command
parent2a36acfc2b774340099f9c8445a4f48337026225 (diff)
downloadnextcloud-server-9c66bf6dc3ca29ac52f6fd83ff0d05edafb917b3.tar.gz
nextcloud-server-9c66bf6dc3ca29ac52f6fd83ff0d05edafb917b3.zip
Use table output for list command
Signed-off-by: Lucas Azevedo <lhs_azevedo@hotmail.com>
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/User/AuthTokens/ListCommand.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/Command/User/AuthTokens/ListCommand.php b/core/Command/User/AuthTokens/ListCommand.php
index 6739e8b4648..97e94f29f92 100644
--- a/core/Command/User/AuthTokens/ListCommand.php
+++ b/core/Command/User/AuthTokens/ListCommand.php
@@ -61,18 +61,24 @@ class ListCommand extends Base {
$tokens = $this->tokenProvider->getTokenByUser($user->getUID());
- $data = array_map(function (IToken $token): mixed {
- $filtered = [
+ $tokens = array_map(function (IToken $token) use ($input): mixed {
+ $sensitive = [
'password',
'password_hash',
'token',
'public_key',
'private_key',
];
- return array_diff_key($token->jsonSerialize(), array_flip($filtered));
+ $data = array_diff_key($token->jsonSerialize(), array_flip($sensitive));
+
+ if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) {
+ $data['scope'] = implode(', ', array_keys(array_filter($data['scope'])));
+ }
+
+ return $data;
}, $tokens);
- $this->writeArrayInOutputFormat($input, $output, $data);
+ $this->writeTableInOutputFormat($input, $output, $tokens);
return 0;
}