示例#1
0
 @Override
 public User create(UserCreateForm form) {
   User user = new User();
   user.setEmail(form.getEmail());
   user.setPasswordHash(new BCryptPasswordEncoder().encode(form.getPassword()));
   user.setRole(form.getRole());
   return userRepository.save(user);
 }
示例#2
0
 @Override
 public Optional<User> getUserByEmail(String email) {
   return userRepository.findOneByEmail(email);
 }
示例#3
0
 @Override
 public Collection<User> getAllUsers() {
   return userRepository.findAll(new Sort("email"));
 }
示例#4
0
 @Override
 public Optional<User> getUserById(long id) {
   return Optional.of(userRepository.findOne(id));
 }