Package fr.ippon.tatami.domain

Examples of fr.ippon.tatami.domain.User


    @Timed
    public Preferences updatePreferences(@RequestBody Preferences newPreferences, HttpServletResponse response) {
        this.log.debug("REST request to set account's preferences");
        Preferences preferences = null;
        try {
            User currentUser = authenticationService.getCurrentUser();
            currentUser.setPreferencesMentionEmail(newPreferences.getMentionEmail());
            currentUser.setDailyDigestSubscription(newPreferences.getDailyDigest());
            currentUser.setWeeklyDigestSubscription(newPreferences.getWeeklyDigest());

            String rssUid = userService.updateRssTimelinePreferences(newPreferences.getRssUidActive());
            currentUser.setRssUid(rssUid);

            preferences = new Preferences(currentUser);

            userService.updateUser(currentUser);
            userService.updateDailyDigestRegistration(newPreferences.getDailyDigest());
View Full Code Here


            method = RequestMethod.GET,
            produces = "application/json")
    @ResponseBody
    @Timed
    public UserPassword isPasswordManagedByLDAP(HttpServletResponse response) {
        User currentUser = authenticationService.getCurrentUser();
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        if (userService.isDomainHandledByLDAP(domain)) {
            response.setStatus(HttpServletResponse.SC_FORBIDDEN);
            return null;
        } else {
            return new UserPassword();
View Full Code Here

    @ResponseBody
    @Timed
    public UserPassword setPassword(@RequestBody UserPassword userPassword, HttpServletResponse response) {
        this.log.debug("REST request to set account's password");
        try {
            User currentUser = authenticationService.getCurrentUser();
            StandardPasswordEncoder encoder = new StandardPasswordEncoder();

            if (!encoder.matches(userPassword.getOldPassword(), currentUser.getPassword())) {
                log.debug("The old password is incorrect : {}", userPassword.getOldPassword());
                throw new Exception("oldPassword");
            }

            if (!userPassword.getNewPassword().equals(userPassword.getNewPasswordConfirmation())) {
                throw new Exception("newPasswordConfirmation");
            }

            currentUser.setPassword(userPassword.getNewPassword());

            userService.updatePassword(currentUser);

            log.debug("User password updated : {}", currentUser);
            return new UserPassword();
View Full Code Here

            produces = "application/json")
    @ResponseBody
    @Timed
    public UserDTO getUser(@PathVariable("username") String username) {
        this.log.debug("REST request to get Profile : {}", username);
        User user = userService.getUserByUsername(username);

        return userService.buildUserDTO(user);
    }
View Full Code Here

    @ResponseBody
    @Timed
    public Collection<User> searchUsers(@RequestParam("q") String query) {
        String prefix = query.toLowerCase();
        this.log.debug("REST request to find users starting with : {}", prefix);
        User currentUser = authenticationService.getCurrentUser();
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        Collection<String> logins = searchService.searchUserByPrefix(domain, prefix);
        return userService.getUsersByLogin(logins);
    }
View Full Code Here

        email = email.toLowerCase();
        if (userService.getUserByLogin(email) != null) {
            response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
            return;
        }
        User user = new User();
        user.setLogin(email);
        userService.registerUser(user);
        response.setStatus(HttpServletResponse.SC_CREATED);
    }
View Full Code Here

    public Collection<StatusDTO> listStatusForUser(@RequestParam(value = "q", required = false, defaultValue = "") String query,
                                                   @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
                                                   @RequestParam(value = "rpp", required = false, defaultValue = "20") Integer rpp) {

        log.debug("REST request to search status containing these words ({}).", query);
        final User currentUser = authenticationService.getCurrentUser();
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        List<String> line;
        if (StringUtils.isNotBlank(query)) {
            line = searchService.searchStatus(domain, query, page, rpp);
        } else {
            line = Collections.emptyList();
View Full Code Here

    @ResponseBody
    @Timed
    public Collection<UserDTO> searchUsers(@RequestParam("q") String query) {
        String prefix = query.toLowerCase();

        User currentUser = authenticationService.getCurrentUser();
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        Collection<String> logins = searchService.searchUserByPrefix(domain, prefix);
        Collection<User> users;

        if (query != null && !query.equals("")) {
            this.log.debug("REST request to find users starting with : {}", prefix);
View Full Code Here

            method = RequestMethod.GET,
            produces = "application/json")
    @ResponseBody
    @Timed
    public Collection<Group> getGroups() {
        User currentUser = authenticationService.getCurrentUser();
        return groupService.getGroupsForUser(currentUser);
    }
View Full Code Here

            method = RequestMethod.GET,
            produces = "application/json")
    @ResponseBody
    @Timed
    public Group getGroup(@PathVariable("groupId") String groupId) {
        User currentUser = authenticationService.getCurrentUser();
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        Group publicGroup = groupService.getGroupById(domain, groupId);
        if (publicGroup != null && publicGroup.isPublicGroup()) {
            Group result = getGroupFromUser(currentUser, groupId);
            Group groupClone = (Group) publicGroup.clone();
            if (result != null) {
                groupClone.setMember(true);
            }
            if (isGroupManagedByCurrentUser(publicGroup)) {
                groupClone.setAdministrator(true);
            }
            return groupClone;
        } else {
            Group result = getGroupFromUser(currentUser, groupId);
            Group groupClone = null;
            if (result == null) {
                log.info("Permission denied! User {} tried to access group ID = {} ", currentUser.getLogin(), groupId);
                return null;
            } else {
                groupClone = (Group) result.clone();
                groupClone.setMember(true);
                if (isGroupManagedByCurrentUser(publicGroup)) {
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.