예제 #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));
 }