mirror of
https://github.com/tips-of-mine/gestion-certificats2.git
synced 2025-06-28 13:58:42 +02:00
![google-labs-jules[bot]](/assets/img/avatar_default.png)
Implémente la fonctionnalité de révocation pour les certificats de type 'intermédiaire'. Modifications principales : - CertificateController.php : - Suppression de l'interdiction de révoquer les certificats intermédiaires. - Ajout d'une logique spécifique pour révoquer un certificat intermédiaire en utilisant la configuration et la CRL du CA Racine. - Les certificats 'simple' continuent d'être révoqués via le script revoke_cert.sh. - app/src/Views/certificates/index.php : - Le bouton 'Révoquer' est maintenant affiché pour les certificats intermédiaires non révoqués. - app/src/Lang/fr.json : - Ajout de nouvelles clés de traduction pour les messages relatifs à la révocation des certificats intermédiaires. - Modification de la clé 'cert_revoke_error_ca_revocation' pour indiquer que seuls les certificats ROOT ne peuvent être révoqués via l'interface. Ces modifications permettent une gestion plus complète des certificats intermédiaires directement depuis l'interface utilisateur.
72 lines
4.4 KiB
PHP
72 lines
4.4 KiB
PHP
<?php
|
|
// Variables attendues du contrôleur: $groupedCertificates, $translations, $currentLang, $darkModeClass, $successMessage, $errorMessage, $userRole
|
|
require_once APP_ROOT_DIR . '/src/Views/shared/header.php';
|
|
?>
|
|
|
|
<div class="container">
|
|
<h1><?= htmlspecialchars($translations['certificates']) ?></h1>
|
|
<div class="actions-bar">
|
|
<a href="/dashboard" class="button secondary-button"><?= htmlspecialchars($translations['back_to_dashboard']) ?></a>
|
|
<a href="/certificates/create" class="button primary-button"><?= htmlspecialchars($translations['create_new_certificate']) ?></a>
|
|
</div>
|
|
|
|
<?php if (isset($successMessage)): ?>
|
|
<p class="success-message"><?= htmlspecialchars($successMessage); ?></p>
|
|
<?php endif; ?>
|
|
<?php if (isset($errorMessage)): ?>
|
|
<p class="error-message"><?= htmlspecialchars($errorMessage); ?></p>
|
|
<?php endif; ?>
|
|
|
|
<?php if (empty($groupedCertificates)): ?>
|
|
<p><?= htmlspecialchars($translations['no_certificates_yet']) ?></p>
|
|
<?php else: ?>
|
|
<?php foreach ($groupedCertificates as $perimeterName => $certsInPerimeter): ?>
|
|
<h2 class="perimeter-heading"><?= htmlspecialchars($perimeterName) ?></h2>
|
|
<div class="table-responsive">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th><?= htmlspecialchars($translations['certificate_name']) ?></th>
|
|
<th><?= htmlspecialchars($translations['type']) ?></th>
|
|
<th><?= htmlspecialchars($translations['expiration_date']) ?></th>
|
|
<th><?= htmlspecialchars($translations['status']) ?></th>
|
|
<th><?= htmlspecialchars($translations['actions']) ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($certsInPerimeter as $cert): ?>
|
|
<tr class="<?= $cert['is_revoked'] ? 'revoked-cert' : '' ?>">
|
|
<td><?= htmlspecialchars($cert['name']) ?></td>
|
|
<td><?= htmlspecialchars($translations[$cert['type']] ?? $cert['type']) ?></td>
|
|
<td><?= htmlspecialchars((new DateTime($cert['expiration_date']))->format('Y-m-d')) ?></td>
|
|
<td>
|
|
<?php if ($cert['is_revoked']): ?>
|
|
<span class="status-revoked"><?= htmlspecialchars($translations['revoked']) ?></span>
|
|
(<?= htmlspecialchars((new DateTime($cert['revoked_at']))->format('Y-m-d')) ?>)
|
|
<?php else: ?>
|
|
<span class="status-active"><?= htmlspecialchars($translations['active']) ?></span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
// Les certificats 'simple' ou 'intermediate' non révoqués peuvent être révoqués
|
|
if (!$cert['is_revoked'] && ($cert['type'] === 'simple' || $cert['type'] === 'intermediate')): ?>
|
|
<form action="/certificates/revoke" method="post" class="inline-form" onsubmit="return confirm('<?= htmlspecialchars($translations['confirm_revoke']) ?>');">
|
|
<input type="hidden" name="certificate_id" value="<?= htmlspecialchars($cert['id']) ?>">
|
|
<button type="submit" class="button danger-button"><?= htmlspecialchars($translations['revoke_certificate']) ?></button>
|
|
</form>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php
|
|
require_once APP_ROOT_DIR . '/src/Views/shared/footer.php';
|
|
?>
|