|
@@ -84,7 +84,13 @@ public class AdminArticleController {
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
|
public Result<Map<String, Object>> create(@RequestBody Map<String, Object> body,
|
|
public Result<Map<String, Object>> create(@RequestBody Map<String, Object> body,
|
|
|
- @RequestAttribute("userId") Long adminId) {
|
|
|
|
|
|
|
+ @RequestAttribute("userId") Long adminId,
|
|
|
|
|
+ @RequestAttribute("role") String role) {
|
|
|
|
|
+ // B-142-1:admin 端点角色守卫(参照本控制器 #move 与 AdminReferralController#summary 的「无权限」惯例),
|
|
|
|
|
+ // 双保险——拦截器已整族强制登录,此处再拒绝非 admin(如登录的 parent/child)越权建文章。
|
|
|
|
|
+ if (!"admin".equals(role)) {
|
|
|
|
|
+ return Result.error("无权限");
|
|
|
|
|
+ }
|
|
|
String title = (String) body.get("title");
|
|
String title = (String) body.get("title");
|
|
|
String content = (String) body.get("content");
|
|
String content = (String) body.get("content");
|
|
|
|
|
|