Skip to content

Commit

Permalink
Delete request after approval or rejection
Browse files Browse the repository at this point in the history
This also fixes the deletion of the certificate after approval
  • Loading branch information
darcato committed Jun 19, 2024
1 parent c90ed6b commit 5028e7f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void deleteCertLinkRequest(String requestId) {
IamCertLinkRequest request = certLinkRequestUtils.getCertLinkRequest(requestId);

certLinkRequestRepository.deleteById(request.getId());
x509CertificateRepository.delete(request.getCertificate());
eventPublisher.publishEvent(new CertLinkRequestDeletedEvent(this, request));
}

Expand All @@ -136,6 +137,7 @@ public CertLinkRequestDTO approveCertLinkRequest(String requestId) {
request = updateCertLinkRequestStatus(request, APPROVED);
notificationFactory.createCertLinkApprovedMessage(request);
eventPublisher.publishEvent(new CertLinkRequestApprovedEvent(this, request));
certLinkRequestRepository.delete(request);

IamAccount account = request.getAccount();
IamX509Certificate cert = request.getCertificate();
Expand All @@ -155,6 +157,7 @@ public CertLinkRequestDTO rejectCertLinkRequest(String requestId, String motivat
request = updateCertLinkRequestStatus(request, REJECTED);
notificationFactory.createCertLinkRejectedMessage(request);
eventPublisher.publishEvent(new CertLinkRequestRejectedEvent(this, request));
certLinkRequestRepository.delete(request);

return converter.dtoFromEntity(request);
}
Expand Down Expand Up @@ -192,7 +195,7 @@ private IamCertLinkRequest updateCertLinkRequestStatus(IamCertLinkRequest reques
}
request.setStatus(status);
request.setLastUpdateTime(new Date(timeProvider.currentTimeMillis()));
return certLinkRequestRepository.save(request);
return request;
}

static Specification<IamCertLinkRequest> baseSpec() {
Expand Down

0 comments on commit 5028e7f

Please sign in to comment.