mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 18:37:46 +08:00
fix: align user group access controls
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
数据预览
|
||||
</p>
|
||||
<ul class="space-y-1 text-muted-foreground">
|
||||
<li v-if="importUsersPreview.user_groups?.length">
|
||||
用户组: {{ importUsersPreview.user_groups.length }} 个
|
||||
</li>
|
||||
<li>用户: {{ importUsersPreview.users?.length || 0 }} 个</li>
|
||||
<li>
|
||||
API Keys: {{ importUsersPreview.users?.reduce((sum: number, u: { api_keys?: unknown[] }) => sum + (u.api_keys?.length || 0), 0) }} 个
|
||||
@@ -93,6 +96,16 @@
|
||||
class="space-y-4"
|
||||
>
|
||||
<div class="grid grid-cols-2 gap-4 text-sm">
|
||||
<div v-if="importUsersResult.stats.user_groups">
|
||||
<p class="font-medium">
|
||||
用户组
|
||||
</p>
|
||||
<p class="text-muted-foreground">
|
||||
创建: {{ importUsersResult.stats.user_groups.created }},
|
||||
更新: {{ importUsersResult.stats.user_groups.updated }},
|
||||
跳过: {{ importUsersResult.stats.user_groups.skipped }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-medium">
|
||||
用户
|
||||
|
||||
@@ -36,7 +36,9 @@ function looksLikeConfigExport(value: JsonObject): boolean {
|
||||
}
|
||||
|
||||
function looksLikeUsersExport(value: JsonObject): boolean {
|
||||
return hasArrayField(value, 'users') || hasArrayField(value, 'standalone_keys')
|
||||
return hasArrayField(value, 'users')
|
||||
|| hasArrayField(value, 'standalone_keys')
|
||||
|| hasArrayField(value, 'user_groups')
|
||||
}
|
||||
|
||||
export function useConfigExportImport(systemConfig: { value: SystemConfig }) {
|
||||
@@ -231,6 +233,11 @@ export function useConfigExportImport(systemConfig: { value: SystemConfig }) {
|
||||
return
|
||||
}
|
||||
|
||||
if (root.user_groups != null && !Array.isArray(root.user_groups)) {
|
||||
error('无效的用户数据文件:user_groups 必须是数组')
|
||||
return
|
||||
}
|
||||
|
||||
if (root.standalone_keys != null && !Array.isArray(root.standalone_keys)) {
|
||||
error('无效的用户数据文件:standalone_keys 必须是数组')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user