示例#1
0
  @RequestMapping(value = {"createUser"})
  public @ResponseBody String createUser(
      @RequestParam("username") String username,
      @RequestParam(required = true, value = "password") String password,
      @RequestParam(required = false, value = "roles") String role,
      @RequestParam(required = true, value = "type") String type) {

    CKUser user =
        userApiService.createUser(
            username, password, Lists.newArrayList(role), UserType.valueOf(type));
    return user.toString();
  }
示例#2
0
  @RequestMapping(value = {"", "home"})
  public ModelAndView gethomePage(HttpServletRequest request, Model model) {

    String username =
        (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    if (!StringUtils.hasText(username)) {
      return getloginPage(request, model);
    }
    CKUser user = loginService.getUserFromUserName(username);
    if (user.getUserType() == UserType.CONSULTANT) {
      logger.debug("logged in by a consultant: " + user.getUsername());
      return new ModelAndView("consultant/uploadResume");
    } else if (user.getUserType() == UserType.HR) {
      logger.debug("logged in by an HR: " + user.getUsername());
      ModelAndView mv = getFreshCandidate();
      mv.setViewName("hr/homeDashboard");
      return mv;
    }
    return new ModelAndView("login/home");
  }