Part-DB-server/templates/tools/oauth_clients/oauth_clients.html.twig
Jan Böhmer 43493d2d02
Some checks are pending
Build assets artifact / Build assets artifact (push) Waiting to run
Docker Image Build / build (linux/amd64, amd64, ubuntu-latest) (push) Waiting to run
Docker Image Build / build (linux/arm/v7, armv7, ubuntu-24.04-arm) (push) Waiting to run
Docker Image Build / build (linux/arm64, arm64, ubuntu-24.04-arm) (push) Waiting to run
Docker Image Build / merge (push) Blocked by required conditions
Docker Image Build (FrankenPHP) / build (linux/amd64, amd64, ubuntu-latest) (push) Waiting to run
Docker Image Build (FrankenPHP) / build (linux/arm/v7, armv7, ubuntu-24.04-arm) (push) Waiting to run
Docker Image Build (FrankenPHP) / build (linux/arm64, arm64, ubuntu-24.04-arm) (push) Waiting to run
Docker Image Build (FrankenPHP) / merge (push) Blocked by required conditions
Static analysis / Static analysis (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, sqlite) (push) Waiting to run
Make oauth server controllable via env and allow to manually add clients
2026-07-30 22:33:14 +02:00

98 lines
5.2 KiB
Twig

{% extends "main_card.html.twig" %}
{% block title %}{% trans %}oauth_clients.title{% endtrans %}{% endblock %}
{% block card_title %}
<i class="fa-solid fa-plug-circle-bolt fa-fw" aria-hidden="true"></i> {% trans %}oauth_clients.title{% endtrans %}
{% endblock %}
{% block card_content %}
<p class="text-muted">{% trans %}oauth_clients.description{% endtrans %}</p>
<div class="card mb-4">
<div class="card-header">{% trans %}oauth_clients.create.title{% endtrans %}</div>
<div class="card-body">
<form action="{{ path('oauth_clients_create') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token('oauth_client_create') }}">
<div class="mb-3">
<label class="form-label" for="oauth_client_create_name">{% trans %}oauth_clients.create.name{% endtrans %}</label>
<input type="text" class="form-control" id="oauth_client_create_name" name="name" maxlength="128" required>
</div>
<div class="mb-3">
<label class="form-label" for="oauth_client_create_redirect_uris">{% trans %}oauth_clients.create.redirect_uris{% endtrans %}</label>
<textarea class="form-control" id="oauth_client_create_redirect_uris" name="redirect_uris" rows="3" required
placeholder="https://client.example.com/callback"></textarea>
<div class="form-text">{% trans %}oauth_clients.create.redirect_uris.help{% endtrans %}</div>
</div>
<div class="mb-3">
<label class="form-label">{% trans %}oauth_clients.create.scopes{% endtrans %}</label>
{% for level in scope_levels %}
<div class="form-check">
<input class="form-check-input" type="checkbox" name="scopes[]"
id="oauth_client_create_scope_{{ level.name|lower }}" value="{{ level.name|lower }}">
<label class="form-check-label" for="oauth_client_create_scope_{{ level.name|lower }}">
{{ level.translationKey|trans }}
</label>
</div>
{% endfor %}
</div>
<button type="submit" class="btn btn-primary">
<i class="fa-solid fa-plus fa-fw" aria-hidden="true"></i> {% trans %}oauth_clients.create.submit{% endtrans %}
</button>
</form>
</div>
</div>
{% if clients is empty %}
<b>{% trans %}oauth_clients.none_yet{% endtrans %}</b>
{% else %}
<table class="table table-striped table-bordered table-hover table-sm mt-2">
<thead>
<tr>
<th>{% trans %}oauth_clients.name{% endtrans %}</th>
<th>{% trans %}oauth_clients.client_id{% endtrans %}</th>
<th>{% trans %}oauth_clients.scopes{% endtrans %}</th>
<th>{% trans %}oauth_clients.redirect_uris{% endtrans %}</th>
<th>{% trans %}oauth_clients.status{% endtrans %}</th>
<th>{% trans %}oauth_clients.live_tokens{% endtrans %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for row in clients %}
{% set client = row.client %}
<tr>
<td>{{ client.name }}</td>
<td><code>{{ client.identifier }}</code></td>
<td>{{ client.scopes|join(', ') }}</td>
<td>{{ client.redirectUris|join(', ') }}</td>
<td>
{% if client.active %}
<span class="badge bg-success badge-success">{% trans %}oauth_clients.active{% endtrans %}</span>
{% else %}
<span class="badge bg-secondary badge-secondary">{% trans %}oauth_clients.inactive{% endtrans %}</span>
{% endif %}
</td>
<td>{{ row.liveTokenCount }}</td>
<td>
<form action="{{ path('oauth_clients_delete', {'identifier': client.identifier}) }}" method="post"
{{ stimulus_controller('elements/delete_btn') }} {{ stimulus_action('elements/delete_btn', "submit", "submit") }}
data-delete-title="{% trans %}oauth_clients.delete.title{% endtrans %}"
data-delete-message="{% trans %}oauth_clients.delete.message{% endtrans %}">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token('oauth_client_delete' ~ client.identifier) }}">
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash-alt fa-fw"></i> {% trans %}oauth_clients.delete{% endtrans %}
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}