Commit a90bfac2 authored by zhengjie's avatar zhengjie
Browse files

[代码优化](v2.6):禁用用户后踢出用户Bug修复

close https://github.com/elunez/eladmin/issues/551
parent 1556f133
......@@ -179,11 +179,12 @@ public class OnlineUserService {
* @param username /
*/
@Async
public void kickOutForUsername(String username) {
public void kickOutForUsername(String username) throws Exception {
List<OnlineUserDto> onlineUsers = getAll(username);
for (OnlineUserDto onlineUser : onlineUsers) {
if (onlineUser.getUserName().equals(username)) {
kickOut(onlineUser.getKey());
String token =EncryptUtils.desDecrypt(onlineUser.getKey());
kickOut(token);
}
}
}
......
......@@ -114,7 +114,7 @@ public class UserController {
@ApiOperation("修改用户")
@PutMapping
@PreAuthorize("@el.check('user:edit')")
public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody User resources){
public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
checkLevel(resources);
userService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
......
......@@ -49,7 +49,7 @@ public interface UserService {
* 编辑用户
* @param resources /
*/
void update(User resources);
void update(User resources) throws Exception;
/**
* 删除用户
......
......@@ -98,7 +98,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(User resources) {
public void update(User resources) throws Exception {
User user = userRepository.findById(resources.getId()).orElseGet(User::new);
ValidationUtil.isNull(user.getId(), "User", "id", resources.getId());
User user1 = userRepository.findByUsername(resources.getUsername());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment