/** * Is this user current - is the current date after their start date and before their end date? * * @param user * @param week * @return */ protected boolean isCurrentUser(User user, Long week) { Long startWeek = DateHandler.getWeekNumber(parseDate(user.getStartDate(), "Jan 11, 2011")); Long endWeek = DateHandler.getWeekNumber(parseDate(user.getEndDate(), "Dec 31, 9999")); if (startWeek.compareTo(week) <= 0 && endWeek.compareTo(week) >= 0) { return true; } return false; }
public boolean isValidEmail(String fromAddress, DataStorage dataStore) { // Whitelist all @songkick.com email addresses if (fromAddress.contains("@songkick.com")) { return true; } List<com.songkick.snippets.model.User> users = dataStore.getCurrentUsers(); // Whitelist all existing users for (com.songkick.snippets.model.User user : users) { if (user.matchesEmail(fromAddress)) { return true; } } return false; }
public String isSongkickAdmin(String redirectURL, DataStorage dataStore) { User user = getUser(); if (user == null) { Debug.error("Authenticator.isSongkickAdmin: no user found, could not authenticate"); return userService.createLoginURL(redirectURL); } // Whitelist admin users if (user.getEmail().equals("*****@*****.**")) { return null; } List<com.songkick.snippets.model.User> users = dataStore.getCurrentUsers(); for (com.songkick.snippets.model.User modelUser : users) { if (modelUser.matchesEmail(user.getEmail()) && modelUser.isAdmin()) { return null; } } return userService.createLoginURL(redirectURL); }