1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-04 22:41:24 +08:00

Optimized form validation

This commit is contained in:
2023-05-30 02:08:21 +08:00
parent 046eefd87a
commit 5b5fa4ca98
4 changed files with 30 additions and 0 deletions

View File

@@ -106,6 +106,9 @@ public class UserController {
@PreAuthorize("hasAuthority('system:user:modify')")
@Operation(summary = "修改用户(权限管理相关)")
public ResponseResult<User> modifyUser(@RequestBody User user) {
if (user.getId() == 1L && user.getEnable() == 0) {
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "Unable to disable super admin", null);
}
if (!StringUtils.hasText(user.getUsername())) {
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Username cannot be empty", null);
}