private void checkUserCanManageAgent(
     LatherContext ctx, String user, String pword, String operation) throws PermissionException {
   try {
     authManager.authenticate(user, pword);
     AuthzSubject subject =
         authzSubjectManager.findSubjectByAuth(user, HQConstants.ApplicationName);
     permissionManager.checkCreatePlatformPermission(subject);
   } catch (SecurityException exc) {
     log.warn(
         "Security exception when '"
             + user
             + "' tried to "
             + operation
             + " an Agent @ "
             + ctx.getCallerIP(),
         exc);
     throw new PermissionException();
   } catch (PermissionException exc) {
     log.warn(
         "Permission denied when '"
             + user
             + "' tried to "
             + operation
             + " an Agent @ "
             + ctx.getCallerIP());
     throw new PermissionException();
   } catch (ApplicationException exc) {
     log.warn(
         "Application exception when '"
             + user
             + "' tried to "
             + operation
             + " an Agent @ "
             + ctx.getCallerIP(),
         exc);
     throw new PermissionException();
   } catch (SystemException exc) {
     log.warn(
         "System exception when '"
             + user
             + "' tried to "
             + operation
             + " an Agent @ "
             + ctx.getCallerIP(),
         exc);
     throw new PermissionException();
   }
 }