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; }