添加特权用户:superAdmin

This commit is contained in:
高子兴 2024-07-02 15:41:05 +08:00
parent fcd9534e65
commit b7ede5652c
2 changed files with 8 additions and 3 deletions

View File

@ -59,8 +59,7 @@ class AuthenticationController {
if (JwtUtil.isTokenValid(token)) {
UserHS user = userService.getUserByUsername(JwtUtil.extractUsername(token));
if (user != null) {
return new ResponseEntity<>(new UserProfileResponse(
UserProfileResponse response = new UserProfileResponse(
user.getUsername(),
user.getNickname(),
user.getGender(),
@ -69,7 +68,12 @@ class AuthenticationController {
user.getDepartment(),
user.getRole(),
user.getCreatedAt()
), HttpStatus.OK);
);
if (user.getSuperAdmin()) {
response.setDepartment("超级管理员");
response.setRole("超级管理员");
}
return new ResponseEntity<>(response, HttpStatus.OK);
}
}
return new ResponseEntity<>(HttpStatus.NOT_FOUND);

View File

@ -25,4 +25,5 @@ public class UserHS {
private String department;
private String role;
private LocalDateTime createdAt;
private Boolean superAdmin = false;
}