getLogger().info("Usage: " + getCommand() + " <username>");
getLogger().info(" A users certificate can unly be unrevoked if the revocation reason is certificate_hold.");
return;
}
String username = args[1];
UserDataVO data = ejb.getUserAdminSession().findUser(getAdmin(), username);
getLogger().info("Found user:");
getLogger().info("username=" + data.getUsername());
getLogger().info("dn=\"" + data.getDN() + "\"");
getLogger().info("Old status=" + data.getStatus());
// Revoke users certificates
try {
boolean foundCertificateOnHold = false;
// Find all user certs
Iterator<Certificate> i = ejb.getCertStoreSession().findCertificatesByUsername(getAdmin(), username).iterator();
while (i.hasNext()) {
X509Certificate cert = (X509Certificate) i.next();
if (ejb.getCertStoreSession().getStatus(cert.getIssuerDN().toString(),
cert.getSerialNumber()).revocationReason == RevokedCertInfo.REVOCATION_REASON_CERTIFICATEHOLD) {
foundCertificateOnHold = true;
try {
ejb.getUserAdminSession().revokeCert(getAdmin(), cert.getSerialNumber(), cert.getIssuerDN().toString(), RevokedCertInfo.NOT_REVOKED);
} catch (AlreadyRevokedException e) {
getLogger().error("The user was already reactivated while the request executed.");
} catch (ApprovalException e) {
getLogger().error("Reactivation already requested.");
} catch (WaitingForApprovalException e) {
getLogger().info("Reactivation request has been sent for approval.");
}
}
}
if (!foundCertificateOnHold) {
getLogger().error("No certificates with status 'On hold' were found for this user.");
} else {
data = ejb.getUserAdminSession().findUser(getAdmin(), username);
getLogger().info("New status=" + data.getStatus());
}
} catch (AuthorizationDeniedException e) {
getLogger().error("Not authorized to reactivate user.");
}
} catch (Exception e) {