private boolean isVisible(PartyContact contact) { boolean publicSpace = true; // because this is a homepage. When this logic is exported to a more proper place // remember to pass this as an argument. if (!Authenticate.isLogged() && publicSpace && contact.getVisibleToPublic().booleanValue()) { return true; } if (Authenticate.isLogged()) { User user = Authenticate.getUser(); Person reader = user.getPerson(); if (reader.hasRole(RoleType.CONTACT_ADMIN).booleanValue() || reader.hasRole(RoleType.MANAGER).booleanValue() || reader.hasRole(RoleType.DIRECTIVE_COUNCIL).booleanValue()) { return true; } if (reader.hasRole(RoleType.EMPLOYEE).booleanValue() && contact.getVisibleToEmployees().booleanValue()) { return true; } if (reader.hasRole(RoleType.TEACHER).booleanValue() && contact.getVisibleToTeachers().booleanValue()) { return true; } if (reader.hasRole(RoleType.STUDENT).booleanValue() && contact.getVisibleToStudents().booleanValue()) { return true; } if (reader.hasRole(RoleType.ALUMNI).booleanValue() && contact.getVisibleToAlumni().booleanValue()) { return true; } if (contact.getVisibleToPublic()) { return true; } } return false; }
@Override public void showLoginPage(HttpServletRequest req, HttpServletResponse resp, String callback) throws IOException, ServletException { if (Authenticate.isLogged()) { if (Strings.isNullOrEmpty(callback)) { resp.sendRedirect(req.getContextPath() + "/login.do"); } else { resp.sendRedirect(callback); } } else { CasConfig casConfig = CoreConfiguration.casConfig(); if (Strings.isNullOrEmpty(callback)) { callback = casConfig.getCasServiceUrl(); } String casLoginUrl = casConfig.getCasLoginUrl(callback); if (FenixEduIstIntegrationConfiguration.barraLogin()) { casLoginUrl = FenixEduIstIntegrationConfiguration.getConfiguration().barraLoginUrl() + "?next=" + casLoginUrl; } resp.sendRedirect(casLoginUrl); } }