Package fr.ippon.tatami.domain

Examples of fr.ippon.tatami.domain.User


            method = RequestMethod.GET,
            produces = "application/json")
    @ResponseBody
    @Timed
    public Collection<Tag> getPopularTags() {
        User currentUser = authenticationService.getCurrentUser();
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        List<Trend> trends = trendService.getCurrentTrends(domain);
        Collection<String> followedTags = userTagRepository.findTags(currentUser.getLogin());
        Collection<Tag> tags = new ArrayList<Tag>();
        for (Trend trend : trends) {
            Tag tag = new Tag();
            tag.setName(trend.getTag());
            if (followedTags.contains(trend.getTag())) {
View Full Code Here


    public String register(@RequestParam String email) {
        email = email.toLowerCase();
        if (userService.getUserByLogin(email) != null) {
            return "redirect:/tatami/login?action=registerFailure";
        }
        User user = new User();
        user.setLogin(email);
        userService.registerUser(user);
        return "redirect:/tatami/login?action=register";
    }
View Full Code Here

        if (email.equals(Constants.TATAMIBOT_NAME)) {
            log.debug("E-mail {} can only be used by the Tatami Bot.", email);
            return "redirect:/tatami/login";
        }
        log.debug("Creating user {}", email);
        User user = new User();
        user.setLogin(email);
        StandardPasswordEncoder encoder = new StandardPasswordEncoder();
        String encryptedPassword = encoder.encode(password);
        user.setPassword(encryptedPassword);
        userService.createUser(user);
        return "redirect:/tatami/login";
    }
View Full Code Here

    @Timed
    public Collection<Tag> getTags(@RequestParam(required = false, value = "popular") String popular,
                                   @RequestParam(required = false, value = "user") String username,
                                   @RequestParam(required = false, value = "search") String search) {
        Collection<Tag> tags = new ArrayList<Tag>();
        User currentUser = authenticationService.getCurrentUser();
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        Collection<String> followedTags = userTagRepository.findTags(currentUser.getLogin());
        Collection<String> tagNames;

        if (popular != null) {
            List<Trend> trends;
            User user = null;
            if (username != null) user = userService.getUserByUsername(username);
            if (user != null) {
                trendService.getTrendsForUser(user.getLogin());
                trends = trendService.getTrendsForUser(user.getLogin());
            } else {
                trends = trendService.getCurrentTrends(domain);
            }

            for (Trend trend : trends) {
View Full Code Here

    }

    @RequestMapping(value = "/lostpassword", method = RequestMethod.POST)
    public String lostPassword(@RequestParam String email) {
        email = email.toLowerCase();
        User user = userService.getUserByLogin(email);
        if (user == null) {
            return "redirect:/tatami/login?action=lostPasswordFailure";
        }
        if (userService.isDomainHandledByLDAP(user.getDomain())) {
            return "redirect:/tatami/login?action=ldapPasswordFailure";
        }
        userService.lostPassword(user);
        return "redirect:/tatami/login?action=lostPassword";
    }
View Full Code Here

            method = RequestMethod.GET,
            produces = "application/json")
    @ResponseBody
    @Timed
    public Tag getTag(@PathVariable("tag") String tagName) {
        User currentUser = authenticationService.getCurrentUser();
        Collection<String> followedTags = userTagRepository.findTags(currentUser.getLogin());
        Tag tag = new Tag();
        tag.setName(tagName);
        if (followedTags.contains(tagName)) {
            tag.setFollowed(true);
        }
View Full Code Here

            produces = "application/json")
    @ResponseBody
    @Timed
    public User getProfile() {
        this.log.debug("REST request to get account's profile");
        User currentUser = authenticationService.getCurrentUser();
        return userService.getUserByLogin(currentUser.getLogin());
    }
View Full Code Here

    @RequestMapping(value = "/rest/account/profile",
            method = RequestMethod.PUT)
    @ResponseBody
    @Timed
    public User updateUserProfile(@RequestBody User updatedUser, HttpServletResponse response) {
        User currentUser = authenticationService.getCurrentUser();
        currentUser.setFirstName(updatedUser.getFirstName().replace("<", " "));
        currentUser.setLastName(updatedUser.getLastName().replace("<", " "));
        currentUser.setJobTitle(StringEscapeUtils.escapeHtml(updatedUser.getJobTitle().replace("<", " ")));
        currentUser.setPhoneNumber(updatedUser.getPhoneNumber().replace("<", " "));
        try {
            userService.updateUser(currentUser);
        } catch (ConstraintViolationException cve) {
            response.setStatus(HttpServletResponse.SC_FORBIDDEN);
            return null;
View Full Code Here

    @RequestMapping(value = "/rest/account/profile",
            method = RequestMethod.DELETE)
    @Timed
    public void suppressUserProfile() {
        User currentUser = authenticationService.getCurrentUser();
        log.debug("Suppression du compte utilisateur : {}", currentUser);
        userService.deleteUser(currentUser);
    }
View Full Code Here

            produces = "application/json")
    @ResponseBody
    @Timed
    public Preferences getPreferences() {
        this.log.debug("REST request to get account's preferences");
        User currentUser = authenticationService.getCurrentUser();
        User user = userService.getUserByLogin(currentUser.getLogin());

        Preferences preferences = new Preferences(user);
        return preferences;
    }
View Full Code Here

TOP

Related Classes of fr.ippon.tatami.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.