| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| apiDataset | ||
| collection | ||
| data | ||
| file | ||
| folder | ||
| training | ||
| create.ts | ||
| createWithFiles.ts | ||
| delete.ts | ||
| detail.ts | ||
| exportAll.ts | ||
| getPermission.ts | ||
| list.ts | ||
| paths.ts | ||
| resumeInheritPermission.ts | ||
| searchTest.ts | ||
| update.ts |
问题 (#7006):
通过 API Key 调用知识库更新接口(api/core/dataset/update)返回 403
unAuthorization。API Key 可正常使用 list/create/delete,唯独 update 报错。
根因:
update.ts 中 authDataset/authUserPer 调用缺少 authApiKey: true。
parseHeaderCert() 默认 authApiKey=false,API Key 鉴权分支不会被执行,
请求走到末尾被拒绝。
对比其他端点:
- create.ts — authDataset({ authApiKey: true, ... }) ✓
- collection/create.ts — authDataset({ authApiKey: true, ... }) ✓
- collection/list.ts — authDataset({ authApiKey: true, ... }) ✓
- update.ts — authDataset 和 authUserPer 均缺少 authApiKey ✗
改动:
update.ts 四处调用各添加 authApiKey: true:
1. authDataset 主入口 Read 权限检查 (L88)
2. authDataset 移动目标文件夹 Manage 权限检查 (L109)
3. authDataset 移动源文件夹 Manage 权限检查 (L122)
4. authUserPer 移动至/从根目录的团队创建权限检查 (L132)
测试:
新增 projects/app/test/api/core/dataset/update.test.ts:
- token 认证更新数据集
- API Key 认证更新数据集
Fixes #7006
Signed-off-by: DadaVinqi <DadaVinqi@users.noreply.github.com>
Co-authored-by: DadaVinqi <DadaVinqi@users.noreply.github.com>
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| apiDataset | Loading commit data... | |
| collection | Loading commit data... | |
| data | Loading commit data... | |
| file | Loading commit data... | |
| folder | Loading commit data... | |
| training | Loading commit data... | |
| create.ts | Loading commit data... | |
| createWithFiles.ts | Loading commit data... | |
| delete.ts | Loading commit data... | |
| detail.ts | Loading commit data... | |
| exportAll.ts | Loading commit data... | |
| getPermission.ts | Loading commit data... | |
| list.ts | Loading commit data... | |
| paths.ts | Loading commit data... | |
| resumeInheritPermission.ts | Loading commit data... | |
| searchTest.ts | Loading commit data... | |
| update.ts | Loading commit data... |