|
@@ -10,6 +10,7 @@ import com.example.result.Result;
|
|
|
import com.example.service.UserService;
|
|
|
import com.example.utils.JwtUtil;
|
|
|
import com.example.vo.UserLoginVO;
|
|
|
+import io.jsonwebtoken.Claims;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -94,4 +95,11 @@ public class UserController {
|
|
|
userService.forget(userDTO);
|
|
|
return Result.success();
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/role")
|
|
|
+ public Result getRole(@RequestHeader String token) {
|
|
|
+ Claims claims = JwtUtil.parseJWT(jwtProperties.getAdminSecretKey(), token);
|
|
|
+ Long id = Long.valueOf(claims.get(JwtClaimsConstant.USER_ID).toString());
|
|
|
+ return Result.success(userService.getRole(id));
|
|
|
+ }
|
|
|
}
|