コード例 #1
0
 @Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
 public void updateUserPassword(User user) {
   PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
   String hashedPassword = passwordEncoder.encode(user.getPassword());
   user.setPassword(hashedPassword);
   userDao.updateUser(user);
 }
コード例 #2
0
 @Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
 public void updateUser(User user) throws UserAlreadyExistsException {
   if (userDao.findDuplicateUserByUserName(user.getUsername(), user.getUserId()).size() > 0)
     throw new UserAlreadyExistsException(user.getUsername());
   else {
     userDao.updateUser(user);
   }
 }
コード例 #3
0
 @Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
 public Integer addUser(User user) throws UserAlreadyExistsException {
   if (userDao.findUserByUserName(user.getUsername()) != null)
     throw new UserAlreadyExistsException(user.getUsername());
   else {
     PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
     String hashedPassword = passwordEncoder.encode(user.getPassword());
     user.setPassword(hashedPassword);
     return userDao.addUser(user);
   }
 }
コード例 #4
0
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public void deleteUser(User user) {
    userDao.deleteUser(user);

    Map<String, Object> paramMap = new HashMap();
    paramMap.put("userId", user.getUserId());
    List<PermissionUserGroup> permissionUserGroupList =
        permissionDao.findPermissionUserGroups(paramMap, "PermissionUserGroup");
    for (PermissionUserGroup permissionUserGroup : permissionUserGroupList) {
      permissionDao.deletePermissionUserGroup(permissionUserGroup);
    }

    List<GroupUser> groupUserList = groupUserDao.findAllGroupsByUserId(user.getUserId());
    for (GroupUser groupUser : groupUserList) {
      groupUserDao.deleteGroupUser(groupUser);
    }
  }
コード例 #5
0
 @Override
 public void updateLastVisitDate(User user) {
   user.setLastVisitDate(new Date());
   userDao.updateUser(user);
 }