fix: use enum

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
Vitor Mattos 2025-11-27 16:42:23 -03:00
parent d725cc2a41
commit d69708abdb
No known key found for this signature in database
GPG key ID: 6FECE2AD4809003A
2 changed files with 4 additions and 2 deletions

View file

@ -88,6 +88,7 @@ class Revoke extends Command {
} }
$reason = CRLReason::from($reasonCode); $reason = CRLReason::from($reasonCode);
assert($reason instanceof CRLReason);
$reasonDescription = $reason->getDescription(); $reasonDescription = $reason->getDescription();
$io->section('Revocation Details'); $io->section('Revocation Details');
@ -145,7 +146,7 @@ class Revoke extends Command {
try { try {
$success = $this->crlService->revokeCertificate( $success = $this->crlService->revokeCertificate(
$serialNumber, $serialNumber,
$reason->value, $reason,
$reasonText, $reasonText,
'cli-admin' 'cli-admin'
); );

View file

@ -111,6 +111,7 @@ class CrlApiController extends AEnvironmentAwareController {
'message' => "Invalid reason code: {$reasonCode}. Must be between 0-10 (excluding 7).", 'message' => "Invalid reason code: {$reasonCode}. Must be between 0-10 (excluding 7).",
], Http::STATUS_BAD_REQUEST); ], Http::STATUS_BAD_REQUEST);
} }
assert($reason instanceof CRLReason);
$user = $this->userSession->getUser(); $user = $this->userSession->getUser();
$revokedBy = $user ? $user->getUID() : 'system'; $revokedBy = $user ? $user->getUID() : 'system';
@ -118,7 +119,7 @@ class CrlApiController extends AEnvironmentAwareController {
try { try {
$success = $this->crlService->revokeCertificate( $success = $this->crlService->revokeCertificate(
$serialNumber, $serialNumber,
$reason->value, $reason,
$reasonText, $reasonText,
$revokedBy $revokedBy
); );