if(getGlobalConfiguration(admin).getEnableEndEntityProfileLimitations()){ if(!authorizedToEndEntityProfile(admin, data1.getEndEntityProfileId(), AvailableAccessRules.DELETE_RIGHTS)){ logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_ERROR_DELETEENDENTITY,"Administrator not authorized"); throw new AuthorizationDeniedException("Administrator not authorized to delete user.");
if (getGlobalConfiguration(admin).getEnableEndEntityProfileLimitations()) { if (!authorizedToEndEntityProfile(admin, data1.getEndEntityProfileId(), AvailableAccessRules.DELETE_RIGHTS)) { logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(), username, null, LogEntry.EVENT_ERROR_DELETEENDENTITY, "Administrator not authorized"); throw new AuthorizationDeniedException("Administrator not authorized to delete user."); }
    public void deleteUser(Admin admin, String username) throws AuthorizationDeniedException, NotFoundException, RemoveException {        debug(">deleteUser("+username+")");        // Check if administrator is authorized to delete user.        int caid = ILogSessionLocal.INTERNALCAID;        try{          UserDataPK pk = new UserDataPK(username);          UserDataLocal data1 = home.findByPrimaryKey(pk);          caid = data1.getCAId();          if(!authorizedToCA(admin, caid)){            logsession.log(admin, caid, LogEntry.MODULE_RA,  new java.util.Date(),username, null, LogEntry.EVENT_ERROR_DELETEENDENTITY,"Administrator not authorized to delete user with this CA.");            throw new AuthorizationDeniedException("Administrator not authorized to delete user with given CA.");          }          if(getGlobalConfiguration(admin).getEnableEndEntityProfileLimitations()){            if(!authorizedToEndEntityProfile(admin, data1.getEndEntityProfileId(), AvailableAccessRules.DELETE_RIGHTS)){                logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_ERROR_DELETEENDENTITY,"Administrator not authorized");                throw new AuthorizationDeniedException("Administrator not authorized to delete user.");            }          }        }catch(FinderException e){          logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_ERROR_DELETEENDENTITY,"Could not find username in database");          throw new NotFoundException("Could not find '"+username+"' in database");        }        try {            UserDataPK pk = new UserDataPK(username);            home.remove(pk);            logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_INFO_DELETEDENDENTITY,"");        } catch(EJBException e) {            logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_ERROR_DELETEENDENTITY,"Could not remove user from database");            throw new RemoveException("Could not remove '"+username+"' from database");        }        debug("<deleteUser("+username+")");    } // deleteUser