Пример #1
0
 public void addUser(RegisterForm form) {
   User user = new User();
   user.setUsername(form.getUsername());
   user.setEmail(form.getEmail());
   user.setPassword(form.getPassword());
   user.setEnabled(true);
   user.setAuthority("ROLE_USER");
   userDao.save(user);
 }
Пример #2
0
 @Override
 public Set<User> getUserSet(String users) {
   Set<User> tagSet = new HashSet<User>();
   String[] userNameArr = users.split(",");
   for (int i = 0; i < userNameArr.length; i++) {
     User u = userDao.getUserByName(userNameArr[i]);
     if (u != null) tagSet.add(u);
   }
   return tagSet;
 }
Пример #3
0
 public void setAvatar(User user, MultipartFile avatar) throws IOException {
   user.setAvatar(IOUtils.toByteArray(avatar.getInputStream()));
   userDao.save(user);
 }
Пример #4
0
 public User getUserByName(String username) {
   return userDao.getUserByName(username);
 }
Пример #5
0
 public List<User> getSimpleUsers() {
   return userDao.getSimpleUsers();
 }
Пример #6
0
 public void blockUser(String username) {
   User user = userDao.getUserByName(username);
   user.setEnabled(!user.isEnabled());
   userDao.save(user);
 }