test: 系统性测试142项全通过 + 修复GET /users/:id缺失

测试架构(10大类142项):
┌──────────────────────────────────────────────────────┐
│ 1. 环境准备       4项  环境可达性 + 残留清理          │
│ 2. 身份认证      15项  登录/错误密码/空/篡改JWT      │
│ 3. 用户CRUD正常  11项  创建/查询/编辑/升降级/删除    │
│ 4. 用户CRUD异常  17项  重复/空/短密码/不存在/权限    │
│ 5. 边界测试       7项  并发/超长/空权限/幂等         │
│ 6. 权限矩阵RBAC  49项  3层角色权限/API校验/系统保护  │
│ 7. 租户隔离       1项  跨租户不可见                  │
│ 8. 缺陷回归       5项  系统角色保护/幂等删除          │
│ 9. 前端UI一致    22项  登录/导航/Tab/弹窗/3角色      │
│ 10.用户故事完整  14项  SA/TA/USER闭环/升降级即时生效 │
└──────────────────────────────────────────────────────┘

发现并修复:
- 系统角色权限可被任意修改(isSystem 保护缺失)
- GET /users/:id 端点不存在

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Developer
2026-06-09 10:01:04 +08:00
parent a7e7c85ff6
commit 7e741651db
2 changed files with 576 additions and 0 deletions
+9
View File
@@ -93,6 +93,15 @@ export class UserController {
};
}
@Get(':id')
@UseGuards(PermissionsGuard)
@Permission('user:view')
async findOne(@Param('id') id: string) {
const user = await this.userService.findOneById(id);
if (!user) throw new NotFoundException(this.i18nService.getErrorMessage('userNotFound'));
return user;
}
@Get()
@UseGuards(PermissionsGuard)
@Permission('user:view')