1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 15:01:23 +08:00

Protected super admin

This commit is contained in:
2023-05-17 17:08:34 +08:00
parent de2f1ef31e
commit bea1f30266
5 changed files with 92 additions and 21 deletions

View File

@@ -57,7 +57,10 @@ public class UserController {
}
@DeleteMapping("/{id}")
public ResponseResult deleteRole(@PathVariable Long id) {
public ResponseResult deleteUser(@PathVariable Long id) {
if (id == 1L) {
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "Unable to remove super admin", null);
}
LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(User::getId, id);
if (userService.remove(wrapper)) {
@@ -68,7 +71,7 @@ public class UserController {
}
@PutMapping()
public ResponseResult modifyRole(@RequestBody User user) {
public ResponseResult modifyUser(@RequestBody User user) {
if (!StringUtils.hasText(user.getUsername())) {
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Username cannot be empty", null);
}