Package ru.webcrafter.client.user

Examples of ru.webcrafter.client.user.UserAuth


    public UserAuth getUser(long id) {
        return (UserAuth) getHibernateTemplate().get(UserAuth.class, id);
    }

    public UserAuth getUser(String userName) {
        UserAuth u = null;
        if (userName != null) {
            List list = getHibernateTemplate().find(GET_USER_BY_USERNAME, userName);
            if (list != null && !list.isEmpty()) u = (UserAuth) list.get(0);
        }
        return u;
View Full Code Here


    public String sellItemTemplate(@PathVariable("itemTemplateId") String itemTemplateId, Principal principal) {
        if (principal == null) {
            return "redirect:/craft";
        }
        final String userName = principal.getName();
        UserAuth userAuth = userService.getUser(userName);
        if (userAuth != null) {
            long userId = userAuth.getUserId();
            service.userSellItem(userId, itemTemplateId);
        }

        return "redirect:/craft";
    }
View Full Code Here

    public String applyCraft(@ModelAttribute("recipeId") RecipeId recipeId, Principal principal) {
        if (principal == null) {
            return "redirect:/craft";
        }
        final String userName = principal.getName();
        UserAuth userAuth = userService.getUser(userName);
        if (userAuth != null) {
            long userId = userAuth.getUserId();
            service.userCraft(userId, recipeId.getRecipeId());
        }

        return "redirect:/craft";
    }
View Full Code Here

    public UserAuth getUser(String userId) {
        return userDao.getUser(userId);
    }

    public UserAuth createUser(UserAuth userAuthDto) {
        UserAuth userAuth = userDao.createUser(userAuthDto);
        Role userRole = roleDao.getRole("ROLE_USER");
        if (userRole == null) {
            userRole = roleDao.createRole("ROLE_USER");
        }
        userAuth.addRole(userRole);
        return userAuth;
    }
View Full Code Here

    }

    @Transactional(readOnly = true)
    public boolean isUserInRole(String userName, String roleName) {
        if (userName == null || roleName == null) return false;
        UserAuth userAuth = userDao.getUser(userName);
        if (userAuth == null) return false;
        return userAuth.hasRole(roleName);
    }
View Full Code Here

        service = (WebCrafterService) applicationContext.getBean("rmiProxy");
    }

    @RequestMapping("/register")
    public String onAdminPageLoaded(Map<String, Object> map) {
        map.put("newUser", new UserAuth());

        return "register";
    }
View Full Code Here

        map.put("recipeId", new RecipeId());

        if (principal != null) {
            // HACKZZZ
            final String userName = principal.getName();
            UserAuth userAuth = userService.getUser(userName);
            if (userAuth != null) {
                long userId = userAuth.getUserId();
                User craftUser = service.getUser(userId);
                map.put("userCrafter", craftUser);
            }
        }
View Full Code Here

    public String buyItemTemplate(@PathVariable("itemTemplateId") String itemTemplateId, Principal principal) {
        if (principal == null) {
            return "redirect:/admin";
        }
        final String userName = principal.getName();
        UserAuth userAuth = userService.getUser(userName);
        if (userAuth != null) {
            long userId = userAuth.getUserId();
            service.userBuyItem(userId, itemTemplateId);
        }

        return "redirect:/craft";
    }
View Full Code Here

TOP

Related Classes of ru.webcrafter.client.user.UserAuth

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.