Displayed 'Admin' as default role in API keys list

This commit is contained in:
Alejandro Celaya 2021-01-11 20:23:28 +01:00
parent fca19f265b
commit 1c75519f9b
2 changed files with 9 additions and 9 deletions

View File

@ -62,7 +62,7 @@ class ListKeysCommand extends Command
$rowData[] = sprintf($messagePattern, $this->getEnabledSymbol($apiKey));
}
$rowData[] = $expiration !== null ? $expiration->toAtomString() : '-';
$rowData[] = $apiKey->isAdmin() ? '-' : implode("\n", $apiKey->mapRoles(
$rowData[] = $apiKey->isAdmin() ? 'Admin' : implode("\n", $apiKey->mapRoles(
fn (string $roleName, array $meta) =>
empty($meta)
? Role::toFriendlyName($roleName)

View File

@ -55,9 +55,9 @@ class ListKeysCommandTest extends TestCase
+-----+------------+-----------------+-------+
| Key | Is enabled | Expiration date | Roles |
+-----+------------+-----------------+-------+
| foo | +++ | - | - |
| bar | +++ | - | - |
| baz | +++ | - | - |
| foo | +++ | - | Admin |
| bar | +++ | - | Admin |
| baz | +++ | - | Admin |
+-----+------------+-----------------+-------+
OUTPUT,
@ -69,8 +69,8 @@ class ListKeysCommandTest extends TestCase
+-----+-----------------+-------+
| Key | Expiration date | Roles |
+-----+-----------------+-------+
| foo | - | - |
| bar | - | - |
| foo | - | Admin |
| bar | - | Admin |
+-----+-----------------+-------+
OUTPUT,
@ -92,13 +92,13 @@ class ListKeysCommandTest extends TestCase
+------+-----------------+--------------------------+
| Key | Expiration date | Roles |
+------+-----------------+--------------------------+
| foo | - | - |
| foo | - | Admin |
| bar | - | Author only |
| baz | - | Domain only: example.com |
| foo2 | - | - |
| foo2 | - | Admin |
| baz2 | - | Author only |
| | | Domain only: example.com |
| foo3 | - | - |
| foo3 | - | Admin |
+------+-----------------+--------------------------+
OUTPUT,