forked from RyanGoodwill/backend
添加特权用户:superAdmin
This commit is contained in:
parent
fcd9534e65
commit
b7ede5652c
@ -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);
|
||||
|
||||
@ -25,4 +25,5 @@ public class UserHS {
|
||||
private String department;
|
||||
private String role;
|
||||
private LocalDateTime createdAt;
|
||||
private Boolean superAdmin = false;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user