1 13 14 package org.ejbca.ui.cli; 15 16 import org.ejbca.core.model.authorization.AuthorizationDeniedException; 17 18 19 27 public class RaSetUserStatusCommand extends BaseRaAdminCommand { 28 33 public RaSetUserStatusCommand(String [] args) { 34 super(args); 35 } 36 37 43 public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException { 44 try { 45 if (args.length < 3) { 46 getOutputStream().println("Usage: RA setuserstatus <username> <status>"); 47 getOutputStream().println( 48 "Status: NEW=10; FAILED=11; INITIALIZED=20; INPROCESS=30; GENERATED=40; HISTORICAL=50"); 49 50 return; 51 } 52 53 String username = args[1]; 54 int status = Integer.parseInt(args[2]); 55 56 try { 57 getAdminSession().setUserStatus(administrator, username, status); 58 getOutputStream().println("New status for user " + username + " is " + status); 59 } catch (AuthorizationDeniedException e) { 60 getOutputStream().println("Error : Not authorized to change userdata."); 61 } 62 } catch (Exception e) { 63 throw new ErrorAdminCommandException(e); 64 } 65 } 66 67 } 69 | Popular Tags |