aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/User/AuthTokens/ListCommand.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/core/Command/User/AuthTokens/ListCommand.php b/core/Command/User/AuthTokens/ListCommand.php
index 97e94f29f92..bfc49606259 100644
--- a/core/Command/User/AuthTokens/ListCommand.php
+++ b/core/Command/User/AuthTokens/ListCommand.php
@@ -72,7 +72,7 @@ class ListCommand extends Base {
$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'])));
+ $data = $this->formatTokenForPlainOutput($data);
}
return $data;
@@ -82,4 +82,19 @@ class ListCommand extends Base {
return 0;
}
+
+ public function formatTokenForPlainOutput(array $token): array {
+ $token['scope'] = implode(', ', array_keys(array_filter($token['scope'] ?? [])));
+
+ $token['lastActivity'] = date(DATE_ATOM, $token['lastActivity']);
+
+ $token['type'] = match ($token['type']) {
+ IToken::TEMPORARY_TOKEN => 'temporary',
+ IToken::PERMANENT_TOKEN => 'permanent',
+ IToken::WIPE_TOKEN => 'wipe',
+ default => $token['type'],
+ };
+
+ return $token;
+ }
}