outputStream.close();
}
private ActionForward checkPermissions(final HttpServletRequest request, final HttpServletResponse response)
throws IOException {
final User userView = Authenticate.getUser();
if (userView == null) {
final String externalUser = (String) request.getSession().getAttribute(getClass().getName());
if (externalUser != null && !externalUser.isEmpty()) {
return null;
}
final String username = get(request, "username");
if (username == null) {
return displayLoginPage(request, response);
}
final String password = get(request, "password");
if (isValidExternalUser(username, password)) {
request.getSession().setAttribute(getClass().getName(), username);
return null;
}
} else if (userView.getPerson().hasRole(RoleType.MANAGER)) {
return null;
}
return displayUnAuhtorizedPage(request, response);
}