fix(access): 统一 API Key 模型权限与列表契约

将全局启用、用户组基线、API Key 专属或排除规则及 scope 按固定顺序求值,避免 Key 越过所属用户组权限,并让运行时候选与模型列表共用同一权限链。

新增 Key 级可分配模型与失效规则诊断接口、OpenAI 兼容 /v1/models 及 rich 列表迁移路径;前端权限弹窗改为按当前 Key 实时加载并支持清理失效规则。

验证:Go 全量测试与 go vet 通过;Web 22 个测试文件共 142 项通过;pnpm lint、pnpm openapi、pnpm build、Compose 配置、gofmt、ShellCheck 和 git diff --check 通过;独立 PostgreSQL 真实配置验收通过。
This commit is contained in:
2026-08-03 09:17:15 +08:00
parent c28bf74230
commit cc97e6649c
26 changed files with 2249 additions and 220 deletions
+42
View File
@@ -467,6 +467,48 @@
gap: 12px;
}
.accessRuleDiagnostics {
display: grid;
gap: 0.625rem;
padding: 0.75rem;
border: 1px solid var(--warning-border, var(--border-subtle));
border-radius: var(--radius-md);
background: var(--surface-subtle);
}
.accessRuleDiagnostics > div:first-child,
.accessRuleDiagnosticRow,
.accessRuleDiagnosticRow > span {
display: flex;
align-items: center;
gap: 0.5rem;
}
.accessRuleDiagnostics > div:first-child {
flex-wrap: wrap;
color: var(--muted-foreground);
font-size: var(--font-size-sm);
}
.accessRuleDiagnostics > div:first-child strong {
color: var(--foreground);
}
.accessRuleDiagnosticRow {
justify-content: space-between;
padding-top: 0.625rem;
border-top: 1px solid var(--border-subtle);
}
.accessRuleDiagnosticRow > span {
min-width: 0;
flex-wrap: wrap;
}
.accessRuleDiagnosticRow small {
color: var(--muted-foreground);
}
.accessPermissionPanel .shCardContent {
display: grid;
gap: 12px;