Package com.mossle.auth.domain

Examples of com.mossle.auth.domain.UserStatus


    @RequestMapping("user-status-input")
    public String input(@RequestParam(value = "id", required = false) Long id,
            Model model) {
        if (id != null) {
            UserStatus userStatus = userStatusManager.get(id);
            model.addAttribute("model", userStatus);
        }

        return "auth/user-status-input";
    }
View Full Code Here


                    userStatus.setPassword(simplePasswordEncoder
                            .encode(userStatus.getPassword()));
                }
            }

            UserStatus dest = null;
            Long id = userStatus.getId();

            if (id != null) {
                dest = userStatusManager.get(id);
                beanMapper.copy(userStatus, dest);
            } else {
                dest = userStatus;
            }

            if (id == null) {
                dest.setUserRepoRef(ScopeHolder.getUserRepoRef());
                dest.setScopeId(ScopeHolder.getScopeId());
            }

            userStatusManager.save(dest);

            messageHelper.addFlashMessage(redirectAttributes,
View Full Code Here

    @RequestMapping("user-status-initPassword")
    public String initPassword(@RequestParam("newPassword") String newPassword,
            @RequestParam("confirmPassword") String confirmPassword,
            @RequestParam("id") Long id, RedirectAttributes redirectAttributes) {
        if ((newPassword != null) && newPassword.equals(confirmPassword)) {
            UserStatus userStatus = userStatusManager.get(id);
            userStatus.setPassword(newPassword);
            userStatusManager.save(userStatus);
        }

        messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
                "操作成功");
View Full Code Here

        if (id != 0L) {
            hql = "from UserStatus where username=? and id<>?";
            params = new Object[] { username, id };
        }

        UserStatus userStatus = userStatusManager.findUnique(hql, params);

        boolean result = (userStatus == null);

        return result;
    }
View Full Code Here

            throws UsernameNotFoundException {
        if (!localUsers.contains(username)) {
            this.fetchUser(username);
        }

        UserStatus userStatus = userStatusManager.findUniqueBy("username",
                username);

        if (userStatus == null) {
            // 此处需要支持设置找不到用户的默认配置
            // 如果是与单点登录结合,找不到的用户也应该以没有任何权限的方式登录到系统里
            logger.warn("cannot find user : {}", username);
            userStatus = new UserStatus();
            userStatus.setUsername(username);
            userStatus.setPassword("");
            userStatus.setStatus(1);
        }

        Set<GrantedAuthority> dbAuthsSet = new HashSet<GrantedAuthority>();

        loadUserAuthorities(userStatus, dbAuthsSet);

        UserInfoImpl userInfo = new UserInfoImpl();
        userInfo.setUsername(username);
        userInfo.setPassword(userStatus.getPassword());
        userInfo.setAuthorities(this.getAuthorities(userStatus));
        userInfo.setAttributes(Collections.EMPTY_LIST);

        UserDetails userDetails = new UserDetailsBuilder(userInfo,
                userStatus.getPassword()).build();

        return userDetails;
    }
View Full Code Here

                if (userDto == null) {
                    messageHelper.addMessage(model, str + " is not exists.");
                    logger.info("{} is not exists", str);
                } else {
                    UserStatus userStatus = authService.createOrGetUserStatus(
                            username, userDto.getId(),
                            ScopeHolder.getUserRepoRef(),
                            ScopeHolder.getScopeId());

                    try {
View Full Code Here

            List<UserStatusDTO> userStatusDtos = new ArrayList<UserStatusDTO>();

            for (UserDTO userDto : userDtos) {
                String usernameStr = userDto.getUsername();
                String hql = "from UserStatus where username=? and userRepoRef=?";
                UserStatus userStatus = userStatusManager.findUnique(hql,
                        usernameStr, ScopeHolder.getUserRepoRef());

                if (userStatus == null) {
                    UserStatusDTO userStatusDto = new UserStatusDTO();
                    userStatusDto.setUsername(usernameStr);
View Full Code Here

        Long id = null;

        if (userDto != null) {
            String username = userDto.getUsername();

            UserStatus userStatus = authService.createOrGetUserStatus(username,
                    userDto.getId(), ScopeHolder.getUserRepoRef(),
                    ScopeHolder.getScopeId());

            id = userStatus.getId();
        }

        return "redirect:/auth/user-role-input.do?id=" + id;
    }
View Full Code Here

                return userDto;
            }

            String hql = "from UserStatus where username=? and userRepoRef=?";
            UserStatus userStatus = userStatusManager.findUnique(hql,
                    apiUserDto.getUsername(), ScopeHolder.getUserRepoRef());

            if (userStatus == null) {
                logger.debug("user has no authorities : [{}]", userId);

                logger.debug("find user : [{}]", apiUserDto.getUsername());
                userDto.setUsername(apiUserDto.getUsername());

                if ((userDto.getUsername() == null)
                        || "".equals(userDto.getUsername())) {
                    userDto.setUsername(apiUserDto.getId());
                }

                userDto.setPassword("NO_PASSWORD");
                userDto.setAuthorities(Collections.EMPTY_LIST);
                userDto.setAttributes(Collections.EMPTY_LIST);
                logger.debug("username : [{}]", userDto.getUsername());
                logger.debug("password : [{}]", userDto.getPassword());
            } else {
                userDto.setUsername(userStatus.getUsername());
                userDto.setPassword(userStatus.getPassword());

                List<String> authorties = userStatusManager.find(HQL_AUTHORITY,
                        userStatus.getId(), ScopeHolder.getScopeId());
                userDto.setAuthorities(authorties);

                List<String> roles = userStatusManager.find(HQL_ATTRIBUTE,
                        userStatus.getId(), ScopeHolder.getScopeId());
                List<String> attributes = new ArrayList<String>();

                for (String role : roles) {
                    attributes.add("ROLE_" + role);
                }
View Full Code Here

                return userDto;
            }

            String hql = "from UserStatus where username=? and userRepoRef=?";
            UserStatus userStatus = userStatusManager.findUnique(hql,
                    apiUserDto.getUsername(), ScopeHolder.getUserRepoRef());

            if (userStatus == null) {
                logger.debug("user has no authorities : [{}]", username);
                userDto.setUsername(username);
                userDto.setAuthorities(Collections.EMPTY_LIST);
                userDto.setAttributes(Collections.EMPTY_LIST);
            } else {
                userDto.setUsername(userStatus.getUsername());
                userDto.setPassword(userStatus.getPassword());
                userDto.setAppId("0");

                List<String> authorties = userStatusManager.find(HQL_AUTHORITY,
                        userStatus.getId(), ScopeHolder.getScopeId());
                logger.debug("authorties : {}", authorties);
                userDto.setAuthorities(authorties);

                List<String> roles = userStatusManager.find(HQL_ATTRIBUTE,
                        userStatus.getId(), ScopeHolder.getScopeId());
                logger.debug("roles : {}", roles);

                List<String> attributes = new ArrayList<String>();

                for (String role : roles) {
View Full Code Here

TOP

Related Classes of com.mossle.auth.domain.UserStatus

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.