private void deleteIpRestriction(HttpServletRequest request, IpRestriction restriction) throws Exception { String ipAddress = restriction.getAddress(); String ipPermission = restriction.getAllowed() ? "Allowed" : "Denied"; try { SystemDatabase database = SystemDatabaseFactory.getInstance(); database.removeIpRestriction(restriction.getID()); fireCoreEvent( request, CoreEventConstants.DELETE_IP_RESTRICTION, ipAddress, ipPermission, CoreEvent.STATE_SUCCESSFUL); } catch (Exception e) { fireCoreEvent( request, CoreEventConstants.DELETE_IP_RESTRICTION, ipAddress, ipPermission, CoreEvent.STATE_UNSUCCESSFUL); throw e; } }
private static IpRestriction findIpRestriction(IpRestriction[] restrictions, int id) { for (IpRestriction restriction : restrictions) { if (restriction.getID() == id) return restriction; } return null; }