public boolean canBook(User connectedUser, GregorianCalendar startDate,
            GregorianCalendar endDate) {
        if (connectedUser.getUserType() == UserType.STOCK_MANAGER) {
            return true;
        }

        if (connectedUser.getUserType() == UserType.STUDENT
                || connectedUser.getUserType() == UserType.TEACHER) {
            boolean book = true;
            long duration;
            // verifier les dates
            if (startDate.after(endDate)) {
                book = false;
                // verifier les durees
            } else {
                duration = (endDate.getTimeInMillis() - startDate
                        .getTimeInMillis()) / CONVERSION;
                if (duration > connectedUser.getMaxBookingLength()) {
                    book = false;
                }
            }

            if (book && connectedUser.getUserType() == UserType.STUDENT) {
                GregorianCalendar today = new GregorianCalendar();
                today.add(GregorianCalendar.DAY_OF_MONTH,
                        connectedUser.getMaxReservationLength());
                if (startDate.after(today)) {
                    book = false;
                }
            }

            return book;
        }

        return false;
    }