feat: 平台治理与权限体系完善,存储进度/GPU预留/审批中心与日志整合
- 平台治理: 租户用户权限层次、资源ACL、审批中心与审批模板、访问申请 - 存储: MinIO 存储进度迁移、对象存储安全加固与测试 - 计算: GPU 资源预留、compute 轮询与同步增强 - 权限: permission v2 迁移、权限安全验收测试 - 日志: 后端运行日志中文说明、操作日志整合 - 数据处理/评测: 数据转换与模型评测优化 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -70,13 +70,27 @@ function getAuthToken(): string | null {
|
||||
return null
|
||||
}
|
||||
|
||||
function getActiveTenantId(): string | null {
|
||||
return localStorage.getItem('activeTenantId')
|
||||
}
|
||||
|
||||
/** Headers shared by Axios and raw fetch requests such as SSE streaming. */
|
||||
export function getAuthHeaders(): Record<string, string> {
|
||||
const headers: Record<string, string> = {}
|
||||
const token = getAuthToken()
|
||||
if (token) headers.Authorization = `Bearer ${token}`
|
||||
const tenantId = getActiveTenantId()
|
||||
if (tenantId) headers['X-Tenant-ID'] = tenantId
|
||||
return headers
|
||||
}
|
||||
|
||||
// 请求拦截器:注入 Authorization header
|
||||
service.interceptors.request.use(
|
||||
(config) => {
|
||||
const token = getAuthToken()
|
||||
if (token) {
|
||||
const authHeaders = getAuthHeaders()
|
||||
if (Object.keys(authHeaders).length) {
|
||||
config.headers = config.headers || {}
|
||||
config.headers['Authorization'] = `Bearer ${token}`
|
||||
Object.assign(config.headers, authHeaders)
|
||||
}
|
||||
return config
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user