@RequestMapping(value = "/{userId}", method = RequestMethod.GET)
    public String viewUserById(@PathVariable int userId, @RequestParam(value = "origin", required = false)String origin, Model model) {

        User user = (User)(SecurityContextHolder.getContext().getAuthentication().getPrincipal());
        GrantedAuthority targetAuthority = new SimpleGrantedAuthority("ROLE_ADMIN");
        List<ROLE> userRoles;
        String userType = "";


        if(userId != userDao.getUserByName(user.getUsername()).getUser_id() && !user.getAuthorities().contains(targetAuthority)) {
            return "403";
        }

        if(userDao.getUserById(userId) == null) {
            model.asMap().clear();
            return "redirect:overall";
        }

        if(origin != null) {
            model.addAttribute("origin", origin);
        }

        userRoles =  userDao.getUserRolesByUserID(userId);

        if(userRoles != null) {
            if(userRoles.contains(ROLE.ROLE_ADMIN)) {
                userType = "Administrator";
            } else if(userRoles.contains(ROLE.ROLE_USER)) {
                userType = "User";
            }
        }

        model.addAttribute("sysUser", userDao.getUserById(userId));
        model.addAttribute("userType", userType);

        return "user_view";
    }