fix: align user group access controls

This commit is contained in:
fawney19
2026-05-10 17:28:23 +08:00
parent a8ac944959
commit d246f6b42c
33 changed files with 1958 additions and 1018 deletions

View File

@@ -73,10 +73,25 @@ export interface ProxyNodeExport {
export interface UsersExportData {
version: string
exported_at: string
user_groups?: UserGroupExport[]
users: UserExport[]
standalone_keys?: StandaloneKeyExport[]
}
export interface UserGroupExport {
id?: string
name: string
description?: string | null
allowed_providers?: string[] | null
allowed_providers_mode?: 'inherit' | 'unrestricted' | 'specific' | 'deny_all'
allowed_api_formats?: string[] | null
allowed_api_formats_mode?: 'inherit' | 'unrestricted' | 'specific' | 'deny_all'
allowed_models?: string[] | null
allowed_models_mode?: 'inherit' | 'unrestricted' | 'specific' | 'deny_all'
rate_limit?: number | null
rate_limit_mode?: 'inherit' | 'system' | 'custom'
}
export interface UserExport {
email: string
email_verified?: boolean
@@ -84,10 +99,16 @@ export interface UserExport {
password_hash: string
role: string
allowed_providers?: string[] | null
allowed_providers_mode?: 'inherit' | 'unrestricted' | 'specific' | 'deny_all'
allowed_api_formats?: string[] | null
allowed_api_formats_mode?: 'inherit' | 'unrestricted' | 'specific' | 'deny_all'
allowed_models?: string[] | null
allowed_models_mode?: 'inherit' | 'unrestricted' | 'specific' | 'deny_all'
rate_limit?: number | null // null = 跟随系统默认0 = 不限制
rate_limit_mode?: 'inherit' | 'system' | 'custom'
model_capability_settings?: Record<string, Record<string, boolean>>
group_ids?: string[]
group_names?: string[]
unlimited?: boolean
wallet?: BillingSummary | null
is_active: boolean
@@ -340,9 +361,10 @@ export interface UsersImportRequest extends UsersExportData {
export interface UsersImportResponse {
message: string
stats: {
user_groups?: { created: number; updated: number; skipped: number }
users: { created: number; updated: number; skipped: number }
api_keys: { created: number; skipped: number }
standalone_keys?: { created: number; skipped: number }
api_keys: { created: number; updated?: number; skipped: number }
standalone_keys?: { created: number; updated?: number; skipped: number }
errors: string[]
}
}

View File

@@ -9,7 +9,6 @@ export type RateLimitPolicyMode = 'inherit' | 'system' | 'custom'
export interface UserGroupSummary {
id: string
name: string
priority: number
}
export interface EffectivePolicyField<T> {
@@ -18,6 +17,8 @@ export interface EffectivePolicyField<T> {
source: 'user' | 'group' | 'fallback' | string
group_id?: string | null
group_name?: string | null
group_ids?: string[]
group_names?: string[]
}
export interface UserEffectivePolicy {
@@ -58,14 +59,6 @@ export interface CreateUserRequest {
role?: UserRole
initial_gift_usd?: number | null
unlimited?: boolean
allowed_providers?: string[] | null
allowed_providers_mode?: ListPolicyMode
allowed_api_formats?: string[] | null
allowed_api_formats_mode?: ListPolicyMode
allowed_models?: string[] | null
allowed_models_mode?: ListPolicyMode
rate_limit?: number | null
rate_limit_mode?: RateLimitPolicyMode
group_ids?: string[]
}
@@ -75,14 +68,6 @@ export interface UpdateUserRequest {
role?: UserRole
unlimited?: boolean
password?: string
allowed_providers?: string[] | null
allowed_providers_mode?: ListPolicyMode
allowed_api_formats?: string[] | null
allowed_api_formats_mode?: ListPolicyMode
allowed_models?: string[] | null
allowed_models_mode?: ListPolicyMode
rate_limit?: number | null
rate_limit_mode?: RateLimitPolicyMode
group_ids?: string[]
}
@@ -121,10 +106,6 @@ export interface ResolveUserBatchSelectionResponse {
}
export interface UserBatchAccessControlPayload {
allowed_providers?: string[] | null
allowed_api_formats?: string[] | null
allowed_models?: string[] | null
rate_limit?: number | null
unlimited?: boolean
}
@@ -179,7 +160,6 @@ export interface UserGroup {
name: string
normalized_name?: string
description?: string | null
priority: number
allowed_providers?: string[] | null
allowed_providers_mode: ListPolicyMode
allowed_api_formats?: string[] | null
@@ -196,7 +176,6 @@ export interface UserGroup {
export interface UpsertUserGroupRequest {
name: string
description?: string | null
priority?: number
allowed_providers?: string[] | null
allowed_providers_mode?: ListPolicyMode
allowed_api_formats?: string[] | null