Package nl.oneday.data.domain.users

Examples of nl.oneday.data.domain.users.User


  @PreAuthorize("(hasAnyRole('ROLE_USER','ROLE_ADMIN'))")
  @RequestMapping(value = Paths.USER_PROFILE)
  public String profile(Model model) {
    String pageTitel = "user profile";
    UserDetails userDetails = getCurrentUserDetails();
    User user = userService.getUserByUserName(userDetails.getUsername());


    model.addAttribute("id", user.getId());
    model.addAttribute("username", user.getUsername());
    model.addAttribute("firstname", user.getFirstName());
    model.addAttribute("lastname", user.getLastName());
    model.addAttribute("fileList", fileService.listAll());

    Long profileImageId = null;

    model.addAttribute("action", "viewProfile");
View Full Code Here


  @PreAuthorize("(hasAnyRole('ROLE_USER','ROLE_ADMIN'))")
  @RequestMapping(value = Paths.USER_SETPROFILEIMAGE_IMAGE_ID, method = RequestMethod.GET)
  @ResponseBody
  public String setProfileImage(@PathVariable(value = "imageId") Long imageId) {
    UserDetails userDetails = getCurrentUserDetails();
    User user = userService.getUserByUserName(userDetails.getUsername());
    JSONObject results = new JSONObject();
    File file = fileService.find(imageId);

      ProfileImage profileImage = new ProfileImage();
      profileImage.setFile(file);
View Full Code Here

    String pageTitel = "edit user";
    setPageAttributes(model, pageTitel);
    LOG.info("User om te editen met userName:" + userName);

    if (userName != null) {
      User user = userService.getUserByUserName(userName);

      if (user != null) {
        model.addAttribute("id", user.getId());
        model.addAttribute("username", user.getUsername());
        model.addAttribute("firstname", user.getFirstName());
        model.addAttribute("lastname", user.getLastName());
        model.addAttribute("password", "********");
        model.addAttribute("action", "edit");
        return TEMPLATE_USER_SHOW_AND_EDIT_FORM;
      }
    }
View Full Code Here

  PasswordService passwordServiceImpl;


  public boolean createUser(String firstName, String lastName, String userName, String password, String roleType) {

    User user;

    user = userRepository.findByUsername(userName.toLowerCase());
    if (user == null) {
      user = new User();
      user.setUsername(userName);
      user.setFirstName(firstName);
      user.setLastName(lastName);
      user.setPassword(passwordServiceImpl.getMD5EncodedPasswordHash(password));
      Authority authority = new Authority();

      List<Authority> authorities = new ArrayList<Authority>();
      user.setAuthorities(authorities);
      try {
        user = userRepository.saveAndFlush(user);
      }
      catch (Exception ex) {
        LOG.error("something went wrong while saving user: " + ex.getMessage());
View Full Code Here

    return false; // To change body of created methods use File | Settings | File Templates.
  }


  public boolean deleteUser(String userName) {
    User user = userRepository.findByUsername(userName);
    if (user != null) userRepository.delete(user);
    userRepository.flush();
    user = userRepository.findByUsername(userName);
    if (user == null) return true;
    return false; // To change body of created methods use File | Settings | File Templates.
View Full Code Here

TOP

Related Classes of nl.oneday.data.domain.users.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.