1 13 14 package org.ejbca.ui.cli; 15 16 import org.ejbca.core.model.authorization.AuthorizationDeniedException; 17 import org.ejbca.core.model.ca.crl.RevokedCertInfo; 18 import org.ejbca.core.model.ra.UserDataConstants; 19 import org.ejbca.core.model.ra.UserDataVO; 20 21 26 public class RaUnRevokeUserCommand extends BaseRaAdminCommand { 27 32 public RaUnRevokeUserCommand(String [] args) { 33 super(args); 34 } 35 36 42 public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException { 43 try { 44 if (args.length < 2) { 45 getOutputStream().println("Usage: RA unrevokeuser <username>"); 46 getOutputStream().println("A users certificate can unly be unrevoked if the revocation reason is certificate_hold."); 47 return; 48 } 49 String username = args[1]; 50 UserDataVO data = getAdminSession().findUser(administrator, username); 51 getOutputStream().println("Found user:"); 52 getOutputStream().println("username=" + data.getUsername()); 53 getOutputStream().println("dn=\"" + data.getDN() + "\""); 54 getOutputStream().println("Old status=" + data.getStatus()); 55 getOutputStream().println("New status=" + UserDataConstants.STATUS_GENERATED); 56 try { 58 getAdminSession().revokeUser(administrator, username, RevokedCertInfo.NOT_REVOKED); 59 } catch (AuthorizationDeniedException e) { 60 getOutputStream().println("Error : Not authorized to un-revoke user."); 61 } 62 } catch (Exception e) { 63 throw new ErrorAdminCommandException(e); 64 } 65 } } 67 | Popular Tags |