Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Syndesi committed Nov 14, 2023
1 parent 2793c65 commit e513d29
Show file tree
Hide file tree
Showing 13 changed files with 496 additions and 22 deletions.
4 changes: 3 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
- Commands
- **User Commands**
- [`user:create`](/commands/user/user-create)
- [`user:token:create`](/commands/user/user-token-create)
- **Token Commands**
- [`token:create`](/commands/token/token-create)
- [`token:revoke`](/commands/token/token-revoke)
- **Backup Commands**
- [`backup:list`](/commands/backup/backup-list)
- [`backup:fetch`](/commands/backup/backup-fetch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
Creates a new token for an user.

<span class="yellow ">Usage:</span>
user:token:create &lt;identifier&gt; &lt;password&gt;
token:create &lt;identifier&gt; &lt;password&gt;

<span class="yellow ">Arguments:</span>
<span class="green ">identifier</span> Unique identifier of the user (email) or the user's UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<span class="highlighted dimgray "></span><span class="highlighted dimgray bg-red ">▀ ▀</span><span class="highlighted dimgray "></span> <span class="bold ">Ember Nexus API</span>
<span class="highlighted red "></span><span class="highlighted white "></span><span class="highlighted red "></span> v0.0.36, prod mode

<span class="bold ">User Token Create</span>
<span class="bold ">Token Create</span>

Found user with identifier '<span class="green ">command-test@localhost.dev</span>', user's UUID is <span class="green ">a0c8fe7b-f5be-4c08-9dff-44582081ea7c</span>.

Expand Down
62 changes: 62 additions & 0 deletions docs/commands/assets/token-revoke-help.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8"/>
<title>stdin</title>
<link rel="stylesheet" href="./cli-style.css" />
<style type="text/css">
body {color: white; background-color: black;}
.reset {color: white;}
.bg-reset {background-color: black;}
.inverted {color: black;}
.bg-inverted {background-color: white;}
.dimgray {color: dimgray;}
.red {color: red;}
.green {color: lime;}
.yellow {color: yellow;}
.blue {color: #3333FF;}
.purple {color: fuchsia;}
.cyan {color: aqua;}
.white {color: white;}
.bg-black {background-color: black;}
.bg-red {background-color: red;}
.bg-green {background-color: lime;}
.bg-yellow {background-color: yellow;}
.bg-blue {background-color: #3333FF;}
.bg-purple {background-color: fuchsia;}
.bg-cyan {background-color: aqua;}
.bg-white {background-color: white;}
.underline {text-decoration: underline;}
.bold {font-weight: bold;}
.italic {font-style: italic;}
.blink {text-decoration: blink;}
.crossed-out {text-decoration: line-through;}
.highlighted {filter: contrast(70%) brightness(190%);}
</style>
</head>
<body>
<pre>
<span class="yellow ">Description:</span>
Creates a new token for an user.

<span class="yellow ">Usage:</span>
token:create &lt;identifier&gt; &lt;password&gt;

<span class="yellow ">Arguments:</span>
<span class="green ">identifier</span> Unique identifier of the user (email) or the user's UUID
<span class="green ">password</span> Password of the user

<span class="yellow ">Options:</span>
<span class="green ">-h, --help</span> Display help for the given command. When no command is given display help for the <span class="green ">list</span> command
<span class="green ">-q, --quiet</span> Do not output any message
<span class="green ">-V, --version</span> Display this application version
<span class="green "> --ansi|--no-ansi</span> Force (or disable --no-ansi) ANSI output
<span class="green ">-n, --no-interaction</span> Do not ask any interactive question
<span class="green ">-e, --env=ENV</span> The Environment name.<span class="yellow "> [default: &quot;prod&quot;]</span>
<span class="green "> --no-debug</span> Switch off debug mode.
<span class="green ">-v|vv|vvv, --verbose</span> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
</pre>
</body>
</html>
54 changes: 54 additions & 0 deletions docs/commands/assets/token-revoke.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8"/>
<title>stdin</title>
<link rel="stylesheet" href="./cli-style.css" />
<style type="text/css">
body {color: white; background-color: black;}
.reset {color: white;}
.bg-reset {background-color: black;}
.inverted {color: black;}
.bg-inverted {background-color: white;}
.dimgray {color: dimgray;}
.red {color: red;}
.green {color: lime;}
.yellow {color: yellow;}
.blue {color: #3333FF;}
.purple {color: fuchsia;}
.cyan {color: aqua;}
.white {color: white;}
.bg-black {background-color: black;}
.bg-red {background-color: red;}
.bg-green {background-color: lime;}
.bg-yellow {background-color: yellow;}
.bg-blue {background-color: #3333FF;}
.bg-purple {background-color: fuchsia;}
.bg-cyan {background-color: aqua;}
.bg-white {background-color: white;}
.underline {text-decoration: underline;}
.bold {font-weight: bold;}
.italic {font-style: italic;}
.blink {text-decoration: blink;}
.crossed-out {text-decoration: line-through;}
.highlighted {filter: contrast(70%) brightness(190%);}
</style>
</head>
<body>
<pre>

<span class="highlighted dimgray "></span>
<span class="highlighted dimgray "></span><span class="highlighted dimgray bg-red ">▀ ▀</span><span class="highlighted dimgray "></span> <span class="bold ">Ember Nexus API</span>
<span class="highlighted red "></span><span class="highlighted white "></span><span class="highlighted red "></span> v0.0.36, prod mode

<span class="bold ">Token Create</span>

Found user with identifier '<span class="green ">command-test@localhost.dev</span>', user's UUID is <span class="green ">a0c8fe7b-f5be-4c08-9dff-44582081ea7c</span>.

▶ Successfully created new token: <span class="green ">secret-token:TBOdmNurTLRk0WNrOi0Qdt</span> .

</pre>
</body>
</html>
17 changes: 17 additions & 0 deletions docs/commands/token/token-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# `token:create`

<div class="code-title auto-refresh">Help Output</div>

```bash
php bin/console token:create --help
```

[](../assets/token-create-help.html ':include :type=html')

<div class="code-title auto-refresh">Example Command</div>

```bash
php bin/console token:create command-test@localhost.dev 1234
```

[](../assets/token-create.html ':include :type=html')
17 changes: 17 additions & 0 deletions docs/commands/token/token-revoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# `token:revoke`

<div class="code-title auto-refresh">Help Output</div>

```bash
php bin/console token:revoke --help
```

[](../assets/token-revoke-help.html ':include :type=html')

<div class="code-title auto-refresh">Example Command</div>

```bash
php bin/console token:revoke
```

[](../assets/token-revoke.html ':include :type=html')
17 changes: 0 additions & 17 deletions docs/commands/user/user-token-create.md

This file was deleted.

3 changes: 3 additions & 0 deletions lib/EmberNexusBundle/src/Service/EmberNexusConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ public function setRegisterUniqueIdentifier(string $registerUniqueIdentifier): E
if (0 === strlen($registerUniqueIdentifier)) {
throw new Exception('Unique identifier can not be an empty string.');
}
if (!preg_match("/^[A-Za-z0-9_]+$/", $registerUniqueIdentifier)) {
throw new Exception("Unique identifier must only contain alphanumeric characters and '_'.");
}
$this->registerUniqueIdentifier = $registerUniqueIdentifier;

return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/Command/UserTokenCreateCommand.php → src/Command/TokenCreateCommand.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
/**
* @psalm-suppress PropertyNotSetInConstructor $io
*/
#[AsCommand(name: 'user:token:create', description: 'Creates a new token for an user.')]
class UserTokenCreateCommand extends Command
#[AsCommand(name: 'token:create', description: 'Creates a new token for an user.')]
class TokenCreateCommand extends Command
{
private OutputStyle $io;

Expand Down
Loading

0 comments on commit e513d29

Please sign in to comment.