Search in sources :

Example 1 with UserDAO

use of fi.otavanopisto.pyramus.dao.users.UserDAO in project pyramus by otavanopisto.

the class CreateNotificationJSONRequestController method process.

public void process(JSONRequestContext requestContext) {
    ApplicationNotificationDAO applicationNotificationDAO = DAOFactory.getInstance().getApplicationNotificationDAO();
    UserDAO userDAO = DAOFactory.getInstance().getUserDAO();
    String line = requestContext.getString("line");
    ApplicationState state = ApplicationState.valueOf(requestContext.getString("state"));
    Set<User> users = new HashSet<>();
    int rowCount = requestContext.getInteger("usersTable.rowCount");
    for (int i = 0; i < rowCount; i++) {
        String colPrefix = "usersTable." + i;
        Long userId = requestContext.getLong(colPrefix + ".userId");
        User user = userDAO.findById(userId);
        users.add(user);
    }
    ApplicationNotification applicationNotification = applicationNotificationDAO.create(line, state);
    applicationNotificationDAO.setUsers(applicationNotification, users);
    requestContext.setRedirectURL(requestContext.getRequest().getContextPath() + "/applications/editnotification.page?notification=" + applicationNotification.getId());
}
Also used : ApplicationNotification(fi.otavanopisto.pyramus.domainmodel.application.ApplicationNotification) User(fi.otavanopisto.pyramus.domainmodel.users.User) ApplicationNotificationDAO(fi.otavanopisto.pyramus.dao.application.ApplicationNotificationDAO) UserDAO(fi.otavanopisto.pyramus.dao.users.UserDAO) ApplicationState(fi.otavanopisto.pyramus.domainmodel.application.ApplicationState) HashSet(java.util.HashSet)

Example 2 with UserDAO

use of fi.otavanopisto.pyramus.dao.users.UserDAO in project pyramus by otavanopisto.

the class OpenIDAuthorizationStrategy method processResponse.

@SuppressWarnings("unchecked")
public User processResponse(RequestContext requestContext) throws AuthenticationException {
    UserDAO userDAO = DAOFactory.getInstance().getUserDAO();
    try {
        HttpSession session = requestContext.getRequest().getSession();
        // extract the parameters from the authentication response
        // (which comes in as a HTTP request from the OpenID provider)
        ParameterList openidResp = new ParameterList(requestContext.getRequest().getParameterMap());
        // retrieve the previously stored discovery information
        DiscoveryInformation discovered = (DiscoveryInformation) session.getAttribute("discovered");
        // extract the receiving URL from the HTTP request
        StringBuffer receivingURL = requestContext.getRequest().getRequestURL();
        String queryString = requestContext.getRequest().getQueryString();
        if (queryString != null && queryString.length() > 0) {
            receivingURL.append("?").append(requestContext.getRequest().getQueryString());
        }
        // verify the response
        VerificationResult verification = consumerManager.verify(receivingURL.toString(), openidResp, discovered);
        // examine the verification result and extract the verified identifier
        Identifier verified = verification.getVerifiedId();
        if (verified != null) {
            AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
            List<String> emails = null;
            if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
                emails = fetchResp.getAttributeValues("email");
            }
            UserVariableDAO userVariableDAO = DAOFactory.getInstance().getUserVariableDAO();
            User user = userDAO.findByExternalIdAndAuthProvider(verified.getIdentifier(), getName());
            if (user == null) {
                user = userDAO.findByEmail(emails.get(0));
                if (user != null) {
                    String expectedLoginServer = userVariableDAO.findByUserAndKey(user, "openid.expectedlogin");
                    String loginServer = verification.getAuthResponse().getParameterValue("openid.op_endpoint");
                    if (!StringUtils.isBlank(expectedLoginServer) && expectedLoginServer.equals(loginServer)) {
                        userVariableDAO.setUserVariable(user, "openid.expectedlogin", null);
                        userDAO.updateExternalId(user, verified.getIdentifier());
                    } else {
                        throw new AuthenticationException(AuthenticationException.LOCAL_USER_MISSING);
                    }
                } else {
                    throw new AuthenticationException(AuthenticationException.LOCAL_USER_MISSING);
                }
            }
            return user;
        } else {
            return null;
        }
    } catch (MessageException e) {
        throw new SmvcRuntimeException(e);
    } catch (DiscoveryException e) {
        throw new SmvcRuntimeException(e);
    } catch (AssociationException e) {
        throw new SmvcRuntimeException(e);
    }
}
Also used : User(fi.otavanopisto.pyramus.domainmodel.users.User) AuthenticationException(fi.otavanopisto.pyramus.plugin.auth.AuthenticationException) HttpSession(javax.servlet.http.HttpSession) SmvcRuntimeException(fi.internetix.smvc.SmvcRuntimeException) FetchResponse(org.openid4java.message.ax.FetchResponse) Identifier(org.openid4java.discovery.Identifier) UserDAO(fi.otavanopisto.pyramus.dao.users.UserDAO) VerificationResult(org.openid4java.consumer.VerificationResult) UserVariableDAO(fi.otavanopisto.pyramus.dao.users.UserVariableDAO) MessageException(org.openid4java.message.MessageException) DiscoveryInformation(org.openid4java.discovery.DiscoveryInformation) AuthSuccess(org.openid4java.message.AuthSuccess) ParameterList(org.openid4java.message.ParameterList) AssociationException(org.openid4java.association.AssociationException) DiscoveryException(org.openid4java.discovery.DiscoveryException)

Example 3 with UserDAO

use of fi.otavanopisto.pyramus.dao.users.UserDAO in project pyramus by otavanopisto.

the class LDAPAuthorizationStrategy method getUser.

/**
 * Returns the user corresponding to the given credentials. If no user cannot be found, returns
 * <code>null</code>.
 *
 * @param username The username
 * @param password The password
 *
 * @return The user corresponding to the given credentials, or <code>null</code> if not found
 * @throws AuthenticationException
 */
public User getUser(String username, String password) throws AuthenticationException {
    UserDAO userDAO = DAOFactory.getInstance().getUserDAO();
    LDAPConnection connection;
    try {
        connection = LDAPUtils.getLDAPConnection();
        final String searchFilter = "(" + System.getProperty("authentication.ldap.usernameAttr") + "=" + username + ")";
        final LDAPSearchResults searchResults = connection.search(System.getProperty("authentication.ldap.authdn"), LDAPConnection.SCOPE_SUB, searchFilter, null, false);
        if (searchResults != null && searchResults.hasMore()) {
            LDAPEntry entry = searchResults.next();
            try {
                String uniqueIdAttr = System.getProperty("authentication.ldap.uniqueIdAttr");
                boolean idEncoded = "1".equals(System.getProperty("authentication.ldap.uniqueIdEncoded"));
                connection.bind(Integer.parseInt(System.getProperty("authentication.ldap.version")), entry.getDN(), password.getBytes("UTF8"));
                String id = idEncoded ? LDAPUtils.getAttributeBinaryValue(entry.getAttribute(uniqueIdAttr)) : entry.getAttribute(uniqueIdAttr).getStringValue();
                User user = userDAO.findByExternalIdAndAuthProvider(id, getName());
                if (user == null)
                    throw new AuthenticationException(AuthenticationException.LOCAL_USER_MISSING);
                return user;
            } catch (UnsupportedEncodingException e) {
                throw new LDAPException();
            }
        }
    } catch (LDAPException e) {
        throw new SmvcRuntimeException(e);
    }
    return null;
}
Also used : LDAPEntry(com.novell.ldap.LDAPEntry) LDAPSearchResults(com.novell.ldap.LDAPSearchResults) User(fi.otavanopisto.pyramus.domainmodel.users.User) UserDAO(fi.otavanopisto.pyramus.dao.users.UserDAO) LDAPException(com.novell.ldap.LDAPException) AuthenticationException(fi.otavanopisto.pyramus.plugin.auth.AuthenticationException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) SmvcRuntimeException(fi.internetix.smvc.SmvcRuntimeException) LDAPConnection(com.novell.ldap.LDAPConnection)

Example 4 with UserDAO

use of fi.otavanopisto.pyramus.dao.users.UserDAO in project pyramus by otavanopisto.

the class ImportLDAPUsersViewController method processSend.

public void processSend(PageRequestContext requestContext) {
    EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();
    UserDAO userDAO = DAOFactory.getInstance().getUserDAO();
    List<User> createdUsers = new ArrayList<User>();
    int rowCount = requestContext.getInteger("importTable.rowCount");
    for (int i = 0; i < rowCount; i++) {
        String colPrefix = "importTable." + i;
        if ("1".equals(requestContext.getString(colPrefix + ".import"))) {
            String email = requestContext.getString(colPrefix + ".email");
            String firstName = requestContext.getString(colPrefix + ".firstName");
            String lastName = requestContext.getString(colPrefix + ".lastName");
            String roleName = requestContext.getString(colPrefix + ".role");
            String id = requestContext.getString(colPrefix + ".id");
            Role role = Enum.valueOf(Role.class, roleName);
            User user = userDAO.create(firstName, lastName, id, "LDAP", role);
            emailDAO.create(user.getContactInfo(), null, Boolean.TRUE, email);
            createdUsers.add(user);
        }
    }
    requestContext.getRequest().setAttribute("createdUsers", createdUsers);
    requestContext.setRedirectURL(requestContext.getRequest().getContextPath() + "system/importldapusers.page");
}
Also used : Role(fi.otavanopisto.pyramus.domainmodel.users.Role) UserRole(fi.otavanopisto.pyramus.framework.UserRole) User(fi.otavanopisto.pyramus.domainmodel.users.User) UserDAO(fi.otavanopisto.pyramus.dao.users.UserDAO) ArrayList(java.util.ArrayList) EmailDAO(fi.otavanopisto.pyramus.dao.base.EmailDAO)

Example 5 with UserDAO

use of fi.otavanopisto.pyramus.dao.users.UserDAO in project pyramus by otavanopisto.

the class EditStudentViewController method process.

public void process(PageRequestContext pageRequestContext) {
    StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
    PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
    StudentActivityTypeDAO studentActivityTypeDAO = DAOFactory.getInstance().getStudentActivityTypeDAO();
    StudentEducationalLevelDAO studentEducationalLevelDAO = DAOFactory.getInstance().getStudentEducationalLevelDAO();
    StudentExaminationTypeDAO studentExaminationTypeDAO = DAOFactory.getInstance().getStudentExaminationTypeDAO();
    StudentStudyEndReasonDAO studyEndReasonDAO = DAOFactory.getInstance().getStudentStudyEndReasonDAO();
    UserVariableKeyDAO userVariableKeyDAO = DAOFactory.getInstance().getUserVariableKeyDAO();
    UserVariableDAO userVariableDAO = DAOFactory.getInstance().getUserVariableDAO();
    StudyProgrammeDAO studyProgrammeDAO = DAOFactory.getInstance().getStudyProgrammeDAO();
    MunicipalityDAO municipalityDAO = DAOFactory.getInstance().getMunicipalityDAO();
    NationalityDAO nationalityDAO = DAOFactory.getInstance().getNationalityDAO();
    SchoolDAO schoolDAO = DAOFactory.getInstance().getSchoolDAO();
    LanguageDAO languageDAO = DAOFactory.getInstance().getLanguageDAO();
    ContactTypeDAO contactTypeDAO = DAOFactory.getInstance().getContactTypeDAO();
    ContactURLTypeDAO contactURLTypeDAO = DAOFactory.getInstance().getContactURLTypeDAO();
    CreditLinkDAO creditLinkDAO = DAOFactory.getInstance().getCreditLinkDAO();
    CourseAssessmentDAO courseAssessmentDAO = DAOFactory.getInstance().getCourseAssessmentDAO();
    TransferCreditDAO transferCreditDAO = DAOFactory.getInstance().getTransferCreditDAO();
    UserIdentificationDAO userIdentificationDAO = DAOFactory.getInstance().getUserIdentificationDAO();
    UserDAO userDAO = DAOFactory.getInstance().getUserDAO();
    CurriculumDAO curriculumDAO = DAOFactory.getInstance().getCurriculumDAO();
    StudentLodgingPeriodDAO studentLodgingPeriodDAO = DAOFactory.getInstance().getStudentLodgingPeriodDAO();
    PersonVariableKeyDAO personVariableKeyDAO = DAOFactory.getInstance().getPersonVariableKeyDAO();
    PersonVariableDAO personVariableDAO = DAOFactory.getInstance().getPersonVariableDAO();
    StudentStudyPeriodDAO studentStudyPeriodDAO = DAOFactory.getInstance().getStudentStudyPeriodDAO();
    StaffMemberDAO staffMemberDAO = DAOFactory.getInstance().getStaffMemberDAO();
    Locale locale = pageRequestContext.getRequest().getLocale();
    User loggedUser = userDAO.findById(pageRequestContext.getLoggedUserId());
    Long personId = pageRequestContext.getLong("person");
    Person person = personDAO.findById(personId);
    List<Student> students = UserUtils.canAccessAllOrganizations(loggedUser) ? studentDAO.listByPerson(person) : studentDAO.listByPersonAndOrganization(person, loggedUser.getOrganization());
    Collections.sort(students, new Comparator<Student>() {

        @Override
        public int compare(Student o1, Student o2) {
            /**
             * Ordering study programmes as follows
             *  1. studies that have start date but no end date (ongoing)
             *  2. studies that have no start nor end date
             *  3. studies that have ended
             *  4. studies that are archived
             *  5. other
             */
            int o1class = (o1.getArchived()) ? 4 : (o1.getStudyStartDate() != null && o1.getStudyEndDate() == null) ? 1 : (o1.getStudyStartDate() == null && o1.getStudyEndDate() == null) ? 2 : (o1.getStudyEndDate() != null) ? 3 : 5;
            int o2class = (o2.getArchived()) ? 4 : (o2.getStudyStartDate() != null && o2.getStudyEndDate() == null) ? 1 : (o2.getStudyStartDate() == null && o2.getStudyEndDate() == null) ? 2 : (o2.getStudyEndDate() != null) ? 3 : 5;
            if (o1class == o2class) {
                // classes are the same, we try to do last comparison from the start dates
                return ((o1.getStudyStartDate() != null) && (o2.getStudyStartDate() != null)) ? o2.getStudyStartDate().compareTo(o1.getStudyStartDate()) : 0;
            } else
                return o1class < o2class ? -1 : o1class == o2class ? 0 : 1;
        }
    });
    Map<Long, String> studentTags = new HashMap<>();
    Map<Long, Boolean> studentHasCredits = new HashMap<>();
    List<UserVariableKey> userVariableKeys = userVariableKeyDAO.listByUserEditable(Boolean.TRUE);
    Collections.sort(userVariableKeys, new StringAttributeComparator("getVariableName"));
    JSONObject studentLodgingPeriods = new JSONObject();
    JSONObject studentStudyPeriodsJSON = new JSONObject();
    for (Student student : students) {
        StringBuilder tagsBuilder = new StringBuilder();
        Iterator<Tag> tagIterator = student.getTags().iterator();
        while (tagIterator.hasNext()) {
            Tag tag = tagIterator.next();
            tagsBuilder.append(tag.getText());
            if (tagIterator.hasNext())
                tagsBuilder.append(' ');
        }
        studentTags.put(student.getId(), tagsBuilder.toString());
        studentHasCredits.put(student.getId(), creditLinkDAO.countByStudent(student) + courseAssessmentDAO.countByStudent(student) + transferCreditDAO.countByStudent(student) > 0);
        JSONArray variables = new JSONArray();
        for (UserVariableKey userVariableKey : userVariableKeys) {
            UserVariable userVariable = userVariableDAO.findByUserAndVariableKey(student, userVariableKey);
            JSONObject variable = new JSONObject();
            variable.put("type", userVariableKey.getVariableType());
            variable.put("name", userVariableKey.getVariableName());
            variable.put("key", userVariableKey.getVariableKey());
            variable.put("value", userVariable != null ? userVariable.getValue() : "");
            variables.add(variable);
        }
        setJsDataVariable(pageRequestContext, "variables." + student.getId(), variables.toString());
        List<StudentLodgingPeriod> studentLodgingPeriodEntities = studentLodgingPeriodDAO.listByStudent(student);
        studentLodgingPeriodEntities.sort(Comparator.comparing(StudentLodgingPeriod::getBegin, Comparator.nullsLast(Comparator.naturalOrder())));
        JSONArray lodgingPeriods = new JSONArray();
        for (StudentLodgingPeriod period : studentLodgingPeriodEntities) {
            JSONObject periodJSON = new JSONObject();
            periodJSON.put("id", period.getId());
            periodJSON.put("begin", period.getBegin() != null ? period.getBegin().getTime() : null);
            periodJSON.put("end", period.getEnd() != null ? period.getEnd().getTime() : null);
            lodgingPeriods.add(periodJSON);
        }
        if (!lodgingPeriods.isEmpty()) {
            studentLodgingPeriods.put(student.getId(), lodgingPeriods);
        }
        List<StudentStudyPeriod> studyPeriods = studentStudyPeriodDAO.listByStudent(student);
        studyPeriods.sort(Comparator.comparing(StudentStudyPeriod::getBegin, Comparator.nullsLast(Comparator.naturalOrder())));
        JSONArray studyPeriodsJSON = new JSONArray();
        for (StudentStudyPeriod studyPeriod : studyPeriods) {
            JSONObject periodJSON = new JSONObject();
            periodJSON.put("id", studyPeriod.getId());
            periodJSON.put("begin", studyPeriod.getBegin() != null ? studyPeriod.getBegin().getTime() : null);
            periodJSON.put("end", studyPeriod.getEnd() != null ? studyPeriod.getEnd().getTime() : null);
            periodJSON.put("type", studyPeriod.getPeriodType());
            studyPeriodsJSON.add(periodJSON);
        }
        if (!studyPeriodsJSON.isEmpty()) {
            studentStudyPeriodsJSON.put(student.getId(), studyPeriodsJSON);
        }
    }
    setJsDataVariable(pageRequestContext, "studentLodgingPeriods", studentLodgingPeriods.toString());
    setJsDataVariable(pageRequestContext, "studentStudyPeriods", studentStudyPeriodsJSON.toString());
    List<PersonVariableKey> personVariableKeys = personVariableKeyDAO.listUserEditablePersonVariableKeys();
    Collections.sort(personVariableKeys, new StringAttributeComparator("getVariableName"));
    JSONArray personVariablesJSON = new JSONArray();
    for (PersonVariableKey personVariableKey : personVariableKeys) {
        PersonVariable personVariable = personVariableDAO.findByPersonAndVariableKey(person, personVariableKey);
        JSONObject personVariableJSON = new JSONObject();
        personVariableJSON.put("type", personVariableKey.getVariableType());
        personVariableJSON.put("name", personVariableKey.getVariableName());
        personVariableJSON.put("key", personVariableKey.getVariableKey());
        personVariableJSON.put("value", personVariable != null ? personVariable.getValue() : "");
        personVariablesJSON.add(personVariableJSON);
    }
    setJsDataVariable(pageRequestContext, "personVariables", personVariablesJSON.toString());
    List<Nationality> nationalities = nationalityDAO.listUnarchived();
    Collections.sort(nationalities, new StringAttributeComparator("getName"));
    List<Municipality> municipalities = municipalityDAO.listUnarchived();
    Collections.sort(municipalities, new StringAttributeComparator("getName"));
    List<Language> languages = languageDAO.listUnarchived();
    Collections.sort(languages, new StringAttributeComparator("getName"));
    List<School> schools = schoolDAO.listUnarchived();
    Collections.sort(schools, new StringAttributeComparator("getName"));
    List<ContactURLType> contactURLTypes = contactURLTypeDAO.listUnarchived();
    Collections.sort(contactURLTypes, new StringAttributeComparator("getName"));
    List<ContactType> contactTypes = contactTypeDAO.listUnarchived();
    Collections.sort(contactTypes, new StringAttributeComparator("getName"));
    String username = "";
    boolean hasInternalAuthenticationStrategies = AuthenticationProviderVault.getInstance().hasInternalStrategies();
    if (UserUtils.allowEditCredentials(loggedUser, person)) {
        if (hasInternalAuthenticationStrategies) {
            // TODO: Support for multiple internal authentication providers
            List<InternalAuthenticationProvider> internalAuthenticationProviders = AuthenticationProviderVault.getInstance().getInternalAuthenticationProviders();
            if (internalAuthenticationProviders.size() == 1) {
                InternalAuthenticationProvider internalAuthenticationProvider = internalAuthenticationProviders.get(0);
                if (internalAuthenticationProvider != null) {
                    UserIdentification userIdentification = userIdentificationDAO.findByAuthSourceAndPerson(internalAuthenticationProvider.getName(), person);
                    if (internalAuthenticationProvider.canUpdateCredentials()) {
                        if (userIdentification != null) {
                            username = internalAuthenticationProvider.getUsername(userIdentification.getExternalId());
                        }
                    }
                }
            }
        }
    }
    JSONArray studentStudyPeriodTypesJSON = new JSONArray();
    for (StudentStudyPeriodType studentStudyPeriodType : StudentStudyPeriodType.values()) {
        JSONObject studyPeriodType = new JSONObject();
        studyPeriodType.put("id", studentStudyPeriodType.toString());
        studyPeriodType.put("displayName", Messages.getInstance().getText(locale, String.format("generic.studentStudyPeriods.%s", studentStudyPeriodType)));
        studyPeriodType.put("beginOnly", StudentStudyPeriodType.BEGINDATE_ONLY.contains(studentStudyPeriodType));
        studentStudyPeriodTypesJSON.add(studyPeriodType);
    }
    setJsDataVariable(pageRequestContext, "studentStudyPeriodTypes", studentStudyPeriodTypesJSON.toString());
    List<Curriculum> curriculums = curriculumDAO.listUnarchived();
    Collections.sort(curriculums, new StringAttributeComparator("getName"));
    List<StudyProgramme> studyProgrammes = UserUtils.canAccessAllOrganizations(loggedUser) ? studyProgrammeDAO.listUnarchived() : studyProgrammeDAO.listByOrganization(loggedUser.getOrganization(), Archived.UNARCHIVED);
    Collections.sort(studyProgrammes, new StringAttributeComparator("getName"));
    List<StaffMember> studyApprovers = staffMemberDAO.listByProperty(StaffMemberProperties.STUDY_APPROVER.getKey(), "1");
    // Add study approvers to the list that have been used before so the selections can be persisted
    List<StaffMember> selectedStudyApprovers = students.stream().map(student -> student.getStudyApprover()).filter(Objects::nonNull).collect(Collectors.toList());
    for (StaffMember selectedStudyApprover : selectedStudyApprovers) {
        Long selectedStudyApproverId = selectedStudyApprover.getId();
        boolean isSelectedInList = studyApprovers.stream().map(StaffMember::getId).anyMatch(selectedStudyApproverId::equals);
        if (!isSelectedInList) {
            studyApprovers.add(selectedStudyApprover);
        }
    }
    studyApprovers.sort(Comparator.comparing(StaffMember::getLastName).thenComparing(StaffMember::getFirstName));
    readUserVariablePresets(pageRequestContext);
    pageRequestContext.getRequest().setAttribute("tags", studentTags);
    pageRequestContext.getRequest().setAttribute("person", person);
    pageRequestContext.getRequest().setAttribute("students", students);
    pageRequestContext.getRequest().setAttribute("activityTypes", studentActivityTypeDAO.listUnarchived());
    pageRequestContext.getRequest().setAttribute("contactURLTypes", contactURLTypes);
    pageRequestContext.getRequest().setAttribute("contactTypes", contactTypes);
    pageRequestContext.getRequest().setAttribute("examinationTypes", studentExaminationTypeDAO.listUnarchived());
    pageRequestContext.getRequest().setAttribute("educationalLevels", studentEducationalLevelDAO.listUnarchived());
    pageRequestContext.getRequest().setAttribute("nationalities", nationalities);
    pageRequestContext.getRequest().setAttribute("municipalities", municipalities);
    pageRequestContext.getRequest().setAttribute("languages", languages);
    pageRequestContext.getRequest().setAttribute("schools", schools);
    pageRequestContext.getRequest().setAttribute("studyProgrammes", studyProgrammes);
    pageRequestContext.getRequest().setAttribute("curriculums", curriculums);
    pageRequestContext.getRequest().setAttribute("studyEndReasons", studyEndReasonDAO.listByParentReason(null));
    pageRequestContext.getRequest().setAttribute("variableKeys", userVariableKeys);
    pageRequestContext.getRequest().setAttribute("personVariableKeys", personVariableKeys);
    pageRequestContext.getRequest().setAttribute("studentHasCredits", studentHasCredits);
    pageRequestContext.getRequest().setAttribute("hasInternalAuthenticationStrategies", hasInternalAuthenticationStrategies);
    pageRequestContext.getRequest().setAttribute("username", username);
    pageRequestContext.getRequest().setAttribute("allowEditCredentials", UserUtils.allowEditCredentials(loggedUser, person));
    pageRequestContext.getRequest().setAttribute("studyApprovers", studyApprovers);
    pageRequestContext.setIncludeJSP("/templates/students/editstudent.jsp");
}
Also used : Locale(java.util.Locale) ContactType(fi.otavanopisto.pyramus.domainmodel.base.ContactType) HashMap(java.util.HashMap) UserVariableKey(fi.otavanopisto.pyramus.domainmodel.users.UserVariableKey) StaffMember(fi.otavanopisto.pyramus.domainmodel.users.StaffMember) UserVariable(fi.otavanopisto.pyramus.domainmodel.users.UserVariable) StudentLodgingPeriodDAO(fi.otavanopisto.pyramus.dao.students.StudentLodgingPeriodDAO) PersonDAO(fi.otavanopisto.pyramus.dao.base.PersonDAO) InternalAuthenticationProvider(fi.otavanopisto.pyramus.plugin.auth.InternalAuthenticationProvider) MunicipalityDAO(fi.otavanopisto.pyramus.dao.base.MunicipalityDAO) StudentEducationalLevelDAO(fi.otavanopisto.pyramus.dao.students.StudentEducationalLevelDAO) UserIdentificationDAO(fi.otavanopisto.pyramus.dao.users.UserIdentificationDAO) Municipality(fi.otavanopisto.pyramus.domainmodel.base.Municipality) CourseAssessmentDAO(fi.otavanopisto.pyramus.dao.grading.CourseAssessmentDAO) NationalityDAO(fi.otavanopisto.pyramus.dao.base.NationalityDAO) LanguageDAO(fi.otavanopisto.pyramus.dao.base.LanguageDAO) StudentActivityTypeDAO(fi.otavanopisto.pyramus.dao.students.StudentActivityTypeDAO) Student(fi.otavanopisto.pyramus.domainmodel.students.Student) StudentDAO(fi.otavanopisto.pyramus.dao.students.StudentDAO) UserVariableKeyDAO(fi.otavanopisto.pyramus.dao.users.UserVariableKeyDAO) JSONObject(net.sf.json.JSONObject) StudentStudyPeriodType(fi.otavanopisto.pyramus.domainmodel.students.StudentStudyPeriodType) PersonVariableKey(fi.otavanopisto.pyramus.domainmodel.users.PersonVariableKey) Person(fi.otavanopisto.pyramus.domainmodel.base.Person) User(fi.otavanopisto.pyramus.domainmodel.users.User) StudyProgramme(fi.otavanopisto.pyramus.domainmodel.base.StudyProgramme) StringAttributeComparator(fi.otavanopisto.pyramus.util.StringAttributeComparator) StudentStudyEndReasonDAO(fi.otavanopisto.pyramus.dao.students.StudentStudyEndReasonDAO) ContactURLTypeDAO(fi.otavanopisto.pyramus.dao.base.ContactURLTypeDAO) School(fi.otavanopisto.pyramus.domainmodel.base.School) StaffMemberDAO(fi.otavanopisto.pyramus.dao.users.StaffMemberDAO) TransferCreditDAO(fi.otavanopisto.pyramus.dao.grading.TransferCreditDAO) UserDAO(fi.otavanopisto.pyramus.dao.users.UserDAO) Language(fi.otavanopisto.pyramus.domainmodel.base.Language) UserVariableDAO(fi.otavanopisto.pyramus.dao.users.UserVariableDAO) SchoolDAO(fi.otavanopisto.pyramus.dao.base.SchoolDAO) ContactTypeDAO(fi.otavanopisto.pyramus.dao.base.ContactTypeDAO) PersonVariableKeyDAO(fi.otavanopisto.pyramus.dao.users.PersonVariableKeyDAO) StudentStudyPeriodDAO(fi.otavanopisto.pyramus.dao.students.StudentStudyPeriodDAO) StudentExaminationTypeDAO(fi.otavanopisto.pyramus.dao.students.StudentExaminationTypeDAO) CurriculumDAO(fi.otavanopisto.pyramus.dao.base.CurriculumDAO) PersonVariable(fi.otavanopisto.pyramus.domainmodel.users.PersonVariable) JSONArray(net.sf.json.JSONArray) StudyProgrammeDAO(fi.otavanopisto.pyramus.dao.base.StudyProgrammeDAO) CreditLinkDAO(fi.otavanopisto.pyramus.dao.grading.CreditLinkDAO) Nationality(fi.otavanopisto.pyramus.domainmodel.base.Nationality) StudentLodgingPeriod(fi.otavanopisto.pyramus.domainmodel.students.StudentLodgingPeriod) PersonVariableDAO(fi.otavanopisto.pyramus.dao.users.PersonVariableDAO) ContactURLType(fi.otavanopisto.pyramus.domainmodel.base.ContactURLType) Curriculum(fi.otavanopisto.pyramus.domainmodel.base.Curriculum) Tag(fi.otavanopisto.pyramus.domainmodel.base.Tag) StudentStudyPeriod(fi.otavanopisto.pyramus.domainmodel.students.StudentStudyPeriod) UserIdentification(fi.otavanopisto.pyramus.domainmodel.users.UserIdentification)

Aggregations

UserDAO (fi.otavanopisto.pyramus.dao.users.UserDAO)26 User (fi.otavanopisto.pyramus.domainmodel.users.User)22 PersonDAO (fi.otavanopisto.pyramus.dao.base.PersonDAO)8 Person (fi.otavanopisto.pyramus.domainmodel.base.Person)8 SmvcRuntimeException (fi.internetix.smvc.SmvcRuntimeException)7 Student (fi.otavanopisto.pyramus.domainmodel.students.Student)6 HttpSession (javax.servlet.http.HttpSession)5 EmailDAO (fi.otavanopisto.pyramus.dao.base.EmailDAO)4 StaffMember (fi.otavanopisto.pyramus.domainmodel.users.StaffMember)4 LoginRequiredException (fi.internetix.smvc.LoginRequiredException)3 StaffMemberDAO (fi.otavanopisto.pyramus.dao.users.StaffMemberDAO)3 UserVariableDAO (fi.otavanopisto.pyramus.dao.users.UserVariableDAO)3 Email (fi.otavanopisto.pyramus.domainmodel.base.Email)3 AccessDeniedException (fi.internetix.smvc.AccessDeniedException)2 ContactTypeDAO (fi.otavanopisto.pyramus.dao.base.ContactTypeDAO)2 CurriculumDAO (fi.otavanopisto.pyramus.dao.base.CurriculumDAO)2 LanguageDAO (fi.otavanopisto.pyramus.dao.base.LanguageDAO)2 MunicipalityDAO (fi.otavanopisto.pyramus.dao.base.MunicipalityDAO)2 NationalityDAO (fi.otavanopisto.pyramus.dao.base.NationalityDAO)2 SchoolDAO (fi.otavanopisto.pyramus.dao.base.SchoolDAO)2