Package com.apress.progwt.client.domain

Examples of com.apress.progwt.client.domain.User


        //
        if (log.isDebugEnabled()) {
            log.debug("u: " + username + " p " + userpass);
        }

        User user = new User();
        user.setUsername(username.toLowerCase());
        user.setNickname(user.getUsername());
        user.setEmail(email);
        user.setSupervisor(superV);
        user.setEnabled(true);
        user.setInvitations(startingInvitations);
        user.setDateCreated(dateCreated);

        user = save(user);

        if (userpass != null) {
            createPassWord(user, userpass);

        }

        User createdU = save(user);

        createdU = setup(createdU);

        // important. otherwise we were getting directed to the user page
        // in a logged in, but not
View Full Code Here


        user.setPassword(passwordEncoder.encodePassword(userpass, salt));
    }

    public void delete(Integer id) throws PermissionDeniedException {
        if (getCurrentUser().isSupervisor()) {
            User user = userDAO.getUserForId(id);
            userDAO.delete(user);

            userCache.removeUserFromCache(user.getUsername());
        } else {
            throw new PermissionDeniedException(
                    "You don't have rights to do that.");
        }
    }
View Full Code Here

        if (useCache) {
            serverUser = (ServerSideUser) userCache
                    .getUserFromCache(username);
        }

        User u;
        if (serverUser == null) {

            u = userDAO.getUserByUsername(username);
            userCache.putUserInCache(new ServerSideUser(u));
View Full Code Here

        }
        return u;
    }

    public UserAndToken getCurrentUserAndToken() {
        User currentUser = getCurrentUser();

        return new UserAndToken(currentUser, getToken(currentUser));
    }
View Full Code Here

    public boolean nowAcceptingSignups() {
        return userDAO.getUserCount() < maxUsers;
    }

    public User save(User user) {
        User rtn = userDAO.save(user);
        userCache.removeUserFromCache(rtn.getUsername());
        return rtn;
    }
View Full Code Here

    public void toggleEnabled(Integer id)
            throws PermissionDeniedException {
        log.info("toggleEnabled " + getCurrentUser().getUsername() + " "
                + getCurrentUser().isSupervisor());
        if (getCurrentUser().isSupervisor()) {
            User user = userDAO.getUserForId(id);
            user.setEnabled(!user.isEnabled());
            save(user);
        } else {
            throw new PermissionDeniedException(
                    "You don't have rights to do that.");
        }
View Full Code Here

    public void toggleSupervisor(Integer id)
            throws PermissionDeniedException {
        if (getCurrentUser().isSupervisor()) {
            System.out.println("ID " + id);
            User user = userDAO.getUserForId(id);
            user.setSupervisor(!user.isSupervisor());
            save(user);
        } else {
            throw new PermissionDeniedException(
                    "You don't have rights to do that.");
        }
View Full Code Here

            }
            throw new UsernameNotFoundException(
                    "Username not found or duplicate: " + username);
        } else {
            log.debug("load user success " + list.get(0));
            User u = (User) list.get(0);
            log.debug("user: " + u);
            return u;
        }

        // return (User)
View Full Code Here

                throw new UsernameNotFoundException(
                        "Username not found: " + username);
            }
        } else {
            log.debug("load user success " + users.get(0));
            User u = users.get(0);
            return new ServerSideUser(u);
        }
    }
View Full Code Here

                "schoolRankings.school", FetchMode.JOIN).setFetchMode(
                "schoolRankings.process", FetchMode.SELECT).setFetchMode(
                "processTypes", FetchMode.SELECT).setResultTransformer(
                CriteriaSpecification.DISTINCT_ROOT_ENTITY);

        User rtn = (User) DataAccessUtils
                .uniqueResult(getHibernateTemplate().findByCriteria(crit));
        Hibernate.initialize(rtn.getProcessTypes());
        Hibernate.initialize(rtn.getRatingTypes());
        for (Application application : rtn.getSchoolRankings()) {
            Hibernate.initialize(application.getProcess());
            Hibernate.initialize(application.getRatings());
        }
       
        log.debug("fetched user: "+rtn.getNickname()+" ratings "+rtn.getRatingTypes().size());
       
        // Hibernate.initialize(rtn.getSchoolRankings());
        return rtn;

    }
View Full Code Here

TOP

Related Classes of com.apress.progwt.client.domain.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.