/** Methode appelée à chaque fois pour vérifier si l'utilisateur est authentifié ou non. */ @Before(unless = {"login"}) static void checkLogin() { if (!session.contains("zindepId")) { flash.error("Merci de vous authentifier pour accéder à cette partie."); Admin.index(); } }
public static void deleteBookOrder(Long id) { BookOrder order = BookOrder.findById(id); System.out.println( "Admin::deleteBookOrder()::got order:" + order.getId() + " of status:" + order.status); order.delete(); System.out.println("Admin::deleteBookOrder()::deleted order"); Admin.customerOrders(); }
public static void editBookOrder(Long id, @Required String status) { System.out.println("editBookOrder()::you selected status=" + status); boolean statuschanged = false; Status newStatus = null; BookOrder order = BookOrder.findById(id); System.out.println("editBookOrder()::got order:" + order.id + " of status:" + order.status); if (status != null && status.trim().length() > 0 && !order.status.equals(Status.DELIVERED)) { try { // try to create new status newStatus = Status.valueOf(status); } catch (IllegalArgumentException iae) { System.out.println( "editBookOrder()::invalid Order Status" + status + "=" + status.length()); validation.addError("orderstatus", "Enter a valid Order Status"); params.flash(); validation.keep(); showEditBookOrderForm(id); } if (!order.status.equals(status)) { statuschanged = true; } Date now = new Date(); if (statuschanged) { // parse string to enum and set new status order.status = newStatus; order.orderDate = now; order.save(); // send email to client // EmailUtils.sendEmail(order.customer, order,statuschanged); System.out.println("editBookOrder()::new orderstatus set"); } Admin.customerOrders(); } else { System.out.println("editBookOrder()::nothing"); showEditBookOrderForm(id); } }
/** Route to Controller/method on positive authentication */ static void onAuthenticated() { Admin.index(); }