mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-05 08:05:12 +00:00
补齐管理员密钥中英文权限展示并修复依赖安全扫描
This commit is contained in:
1 parent
194d69e636
commit
ff04296510
8 files changed
+660
-25
No files matched your search
@@ -67,7 +67,7 @@
|
||||
"postcss@<8.5.18": ">=8.5.18",
|
||||
"dompurify@<3.4.17": ">=3.4.17",
|
||||
"source-map-js@<1.2.2": ">=1.2.2",
|
||||
"follow-redirects@<1.16.1": ">=1.16.1",
|
||||
"follow-redirects@<1.16.2": ">=1.16.2",
|
||||
"decode-uri-component@<0.5.1": ">=0.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+5
-5
@@ -10,7 +10,7 @@ overrides:
|
||||
postcss@<8.5.18: '>=8.5.18'
|
||||
dompurify@<3.4.17: '>=3.4.17'
|
||||
source-map-js@<1.2.2: '>=1.2.2'
|
||||
follow-redirects@<1.16.1: '>=1.16.1'
|
||||
follow-redirects@<1.16.2: '>=1.16.2'
|
||||
decode-uri-component@<0.5.1: '>=0.5.1'
|
||||
|
||||
importers:
|
||||
@@ -2566,8 +2566,8 @@ packages:
|
||||
flatted@3.3.3:
|
||||
resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
|
||||
|
||||
follow-redirects@1.16.1:
|
||||
resolution: {integrity: sha512-FNvFGzoMLWmE6Yj9spb/zjd7yiNCHiAW9/Tg9CXrQ8wuu32HtlJOwWO11OJafl5FfY3DxTdQ0vj42zU1kvv5jg==}
|
||||
follow-redirects@1.16.2:
|
||||
resolution: {integrity: sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow==}
|
||||
engines: {node: '>=4.0'}
|
||||
peerDependencies:
|
||||
debug: '*'
|
||||
@@ -6563,7 +6563,7 @@ snapshots:
|
||||
|
||||
axios@1.20.0:
|
||||
dependencies:
|
||||
follow-redirects: 1.16.1
|
||||
follow-redirects: 1.16.2
|
||||
form-data: 4.0.6
|
||||
https-proxy-agent: 5.0.1
|
||||
proxy-from-env: 2.1.0
|
||||
@@ -7305,7 +7305,7 @@ snapshots:
|
||||
|
||||
flatted@3.3.3: {}
|
||||
|
||||
follow-redirects@1.16.1: {}
|
||||
follow-redirects@1.16.2: {}
|
||||
|
||||
for-in@1.0.2: {}
|
||||
|
||||
|
||||
@@ -55,11 +55,11 @@
|
||||
<label class="flex gap-2"><input v-model="rule.include_ungrouped" type="checkbox" />{{ t('adminAccessKeys.includeUngrouped') }}</label>
|
||||
<div>{{ t('adminAccessKeys.accountTypes') }}<div class="flex flex-wrap gap-4"><label v-for="type in accountTypes" :key="type" class="flex gap-2"><input v-model="rule.account_types" type="checkbox" :value="type" />{{ type }}</label></div></div>
|
||||
<label class="block">{{ t('adminAccessKeys.platforms') }}<select v-model="rule.platforms" multiple class="input mt-1"><option v-for="platform in CONCRETE_PLATFORM_OPTIONS" :key="platform.value" :value="platform.value">{{ platform.label }}</option></select></label>
|
||||
<div>{{ t('adminAccessKeys.accountOperations') }}<div class="grid gap-2 sm:grid-cols-2"><label v-for="permission in accountPermissions" :key="permission.id" class="flex gap-2"><input v-model="rule.permissions" type="checkbox" :value="permission.id" />{{ permission.label }} <span class="text-xs text-gray-500">{{ permission.id }}</span></label></div></div>
|
||||
<div>{{ t('adminAccessKeys.accountOperations') }}<div class="grid gap-2 sm:grid-cols-2"><label v-for="permission in accountPermissions" :key="permission.id" class="flex gap-2"><input v-model="rule.permissions" type="checkbox" :value="permission.id" />{{ permissionLabel(permission) }} <span class="text-xs text-gray-500">{{ permission.id }}</span></label></div></div>
|
||||
<div v-if="groupPermissions.length" class="space-y-2 rounded border border-amber-300 p-3">
|
||||
<p>{{ t('adminAccessKeys.groupOperations') }}</p>
|
||||
<p class="text-sm text-amber-700 dark:text-amber-300">{{ t('adminAccessKeys.modelAllowlistHint') }}</p>
|
||||
<div class="grid gap-2 sm:grid-cols-2"><label v-for="permission in groupPermissions" :key="permission.id" class="flex gap-2"><input v-model="rule.permissions" type="checkbox" :value="permission.id" />{{ permission.label }} <span class="text-xs text-gray-500">{{ permission.id }}</span></label></div>
|
||||
<div class="grid gap-2 sm:grid-cols-2"><label v-for="permission in groupPermissions" :key="permission.id" class="flex gap-2"><input v-model="rule.permissions" type="checkbox" :value="permission.id" />{{ permissionLabel(permission) }} <span class="text-xs text-gray-500">{{ permission.id }}</span></label></div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-secondary btn-sm" @click="draft.policy.rules.splice(index, 1)">{{ t('adminAccessKeys.removeRule') }}</button>
|
||||
</fieldset>
|
||||
@@ -68,7 +68,7 @@
|
||||
<legend>{{ t('adminAccessKeys.globalPermissions') }}</legend>
|
||||
<fieldset v-for="category in globalCategories" :key="category.name" class="space-y-2 rounded border border-gray-200 p-3 dark:border-dark-700">
|
||||
<legend class="text-sm font-medium">{{ category.name }}</legend>
|
||||
<label v-for="permission in category.permissions" :key="permission.id" class="flex gap-2"><input v-model="draft.policy.global_permissions" type="checkbox" :value="permission.id" />{{ permission.label }} <span class="text-xs text-gray-500">{{ permission.id }}</span></label>
|
||||
<label v-for="permission in category.permissions" :key="permission.id" class="flex gap-2"><input v-model="draft.policy.global_permissions" type="checkbox" :value="permission.id" />{{ permissionLabel(permission) }} <span class="text-xs text-gray-500">{{ permission.id }}</span></label>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
@@ -87,7 +87,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import * as api from '@/api/admin/adminAccessKeys'
|
||||
import type { AccessRule, AdminKey, AdminKeyInput, Permission } from '@/api/admin/adminAccessKeys'
|
||||
@@ -95,9 +95,11 @@ import { getAllIncludingInactive } from '@/api/admin/groups'
|
||||
import { CONCRETE_PLATFORM_OPTIONS } from '@/constants/platforms'
|
||||
import BaseDialog from '@/components/common/BaseDialog.vue'
|
||||
import TotpStepUpDialog from '@/components/auth/TotpStepUpDialog.vue'
|
||||
import { useAdminAccessKeyPermissions } from '@/composables/useAdminAccessKeyPermissions'
|
||||
import { isStepUpCancelled, useStepUp } from '@/composables/useStepUp'
|
||||
|
||||
const { t } = useI18n()
|
||||
const { t, locale } = useI18n()
|
||||
const { permissionLabel, permissionCategory } = useAdminAccessKeyPermissions()
|
||||
const stepUp = useStepUp()
|
||||
const items = ref<AdminKey[]>([])
|
||||
const permissions = ref<Permission[]>([])
|
||||
@@ -116,13 +118,19 @@ const ips = ref('')
|
||||
const fullAccessPrompt = ref(false)
|
||||
const fullAccessPhrase = ref('')
|
||||
const fullAccessConfirmed = ref(false)
|
||||
// 切换语言后重新阅读当前语言的风险说明,不能复用尚未保存的扩权确认。
|
||||
watch(locale, () => {
|
||||
if (fullAccessConfirmed.value && draft.value) draft.value.policy.full_access = false
|
||||
fullAccessConfirmed.value = false
|
||||
cancelFullAccess()
|
||||
})
|
||||
const accountTypes = ['oauth', 'setup-token', 'apikey', 'upstream', 'bedrock', 'service_account']
|
||||
const accountPermissions = computed(() => permissions.value.filter(p => p.scope === 'account'))
|
||||
const groupPermissions = computed(() => permissions.value.filter(p => p.scope === 'group'))
|
||||
const globalCategories = computed(() => {
|
||||
const categories = new Map<string, Permission[]>()
|
||||
for (const permission of permissions.value.filter(p => p.scope === 'global')) {
|
||||
const name = permission.category || t('adminAccessKeys.other')
|
||||
const name = permissionCategory(permission)
|
||||
categories.set(name, [...(categories.get(name) || []), permission])
|
||||
}
|
||||
return Array.from(categories, ([name, permissions]) => ({ name, permissions }))
|
||||
@@ -139,10 +147,10 @@ function normalizeItem(item: AdminKey): AdminKey {
|
||||
} }
|
||||
}
|
||||
function ruleSummary(rule: AccessRule): string {
|
||||
const selectedGroups = rule.all_groups ? t('adminAccessKeys.allGroupsSummary') : rule.group_ids.map(id => groups.value.find(group => group.id === id)?.name || t('adminAccessKeys.groupFallback', { id })).join('、') || t('adminAccessKeys.noGroups')
|
||||
const selectedGroups = rule.all_groups ? t('adminAccessKeys.allGroupsSummary') : rule.group_ids.map(id => groups.value.find(group => group.id === id)?.name || t('adminAccessKeys.groupFallback', { id })).join(t('adminAccessKeys.listSeparator')) || t('adminAccessKeys.noGroups')
|
||||
const groupLabel = selectedGroups + (rule.include_ungrouped ? t('adminAccessKeys.ungroupedSummary') : '')
|
||||
const types = rule.account_types.join('、') || t('adminAccessKeys.noAccountTypes')
|
||||
const platforms = rule.platforms.join('、') || t('adminAccessKeys.anyPlatform')
|
||||
const types = rule.account_types.join(t('adminAccessKeys.listSeparator')) || t('adminAccessKeys.noAccountTypes')
|
||||
const platforms = rule.platforms.join(t('adminAccessKeys.listSeparator')) || t('adminAccessKeys.anyPlatform')
|
||||
return t('adminAccessKeys.ruleSummary', { groups: groupLabel, types, platforms, count: rule.permissions.length })
|
||||
}
|
||||
function emptyRule(): AccessRule { return { permissions: [], group_ids: [], all_groups: false, include_ungrouped: false, account_types: [], platforms: [] } }
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import AdminAccessKeysSettings from '../AdminAccessKeysSettings.vue'
|
||||
import en from '@/i18n/locales/en'
|
||||
import zh from '@/i18n/locales/zh'
|
||||
import enKeys from '@/i18n/locales/en/adminAccessKeys'
|
||||
import zhKeys from '@/i18n/locales/zh/adminAccessKeys'
|
||||
|
||||
const catalogSource = readFileSync(resolve(process.cwd(), '../backend/internal/pkg/adminaccess/catalog.go'), 'utf8')
|
||||
const catalog = [...catalogSource.matchAll(/Permission\{"([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)"\}/g)].map(([, id, label, category, scope]) => ({ id, label, category, scope }))
|
||||
const mocks = vi.hoisted(() => ({ list: vi.fn(), create: vi.fn(), update: vi.fn(), rotate: vi.fn(), revoke: vi.fn(), deleteRecord: vi.fn() }))
|
||||
vi.mock('@/api/admin/adminAccessKeys', () => mocks)
|
||||
vi.mock('@/api/admin/groups', () => ({ getAllIncludingInactive: vi.fn().mockResolvedValue([{ id: 7, name: 'Example group' }]) }))
|
||||
vi.mock('@/components/auth/TotpStepUpDialog.vue', () => ({ default: { template: '<div />' } }))
|
||||
vi.mock('@/composables/useStepUp', () => ({ useStepUp: () => ({ run: (fn: () => unknown) => fn() }), isStepUpCancelled: () => false }))
|
||||
const wrappers: ReturnType<typeof mount>[] = []
|
||||
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()))
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mocks.list.mockResolvedValue({ items: [], permissions: [...catalog, { id: 'future.feature', label: '后端新增权限', category: '后端新增分类', scope: 'global' }, { id: 'payment.mark.paid', label: '不可误认成人工确认到账', category: '未知分类', scope: 'global' }] })
|
||||
mocks.create.mockResolvedValue({ key: 'secret', item: { id: 'created', name: 'Example key' } })
|
||||
})
|
||||
function setup(locale: 'en' | 'zh' = 'en') {
|
||||
const i18n = createI18n({ legacy: false, locale, fallbackLocale: 'en', messages: { en, zh } })
|
||||
const wrapper = mount(AdminAccessKeysSettings, { global: { plugins: [i18n], stubs: { teleport: true } } })
|
||||
wrappers.push(wrapper)
|
||||
return { wrapper, i18n }
|
||||
}
|
||||
|
||||
describe('管理员密钥英文体验', () => {
|
||||
it('各自后端目录的每个权限都有准确的中英文标签与分类', () => {
|
||||
expect(catalog.length).toBeGreaterThan(50)
|
||||
expect(new Set(catalog.map(permission => permission.id)).size).toBe(catalog.length)
|
||||
const expectedKeys = catalog.map(permission => permission.id.replaceAll('_', '_u').replaceAll('.', '_d')).sort()
|
||||
for (const messages of [enKeys, zhKeys]) {
|
||||
expect(Object.keys(messages.permissions).sort()).toEqual(expectedKeys)
|
||||
for (const { label, category } of Object.values(messages.permissions)) {
|
||||
expect(label.trim()).not.toBe('')
|
||||
expect(category.trim()).not.toBe('')
|
||||
}
|
||||
}
|
||||
expect(en.adminAccessKeys).toEqual(enKeys)
|
||||
expect(zh.adminAccessKeys).toEqual(zhKeys)
|
||||
for (const permission of catalog) {
|
||||
const key = permission.id.replaceAll('_', '_u').replaceAll('.', '_d') as keyof typeof zhKeys.permissions
|
||||
expect(zhKeys.permissions[key]).toEqual({ label: permission.label, category: permission.category })
|
||||
expect(enKeys.permissions[key].label).not.toMatch(/[\u3400-\u9fff]/u)
|
||||
expect(enKeys.permissions[key].category).not.toMatch(/[\u3400-\u9fff]/u)
|
||||
}
|
||||
})
|
||||
|
||||
it('切换语言清除待确认文字和本次扩权,必须使用当前语言重新确认', async () => {
|
||||
const { wrapper, i18n } = setup('zh')
|
||||
await flushPromises()
|
||||
await wrapper.get('[data-test="create"]').trigger('click')
|
||||
await wrapper.get('[data-test="name"]').setValue('Example key')
|
||||
await wrapper.get('[data-test="full-access"]').setValue(true)
|
||||
await wrapper.get('[data-test="full-access-phrase"]').setValue('开启全权访问')
|
||||
i18n.global.locale.value = 'en'
|
||||
await flushPromises()
|
||||
expect(wrapper.find('[data-test="full-access-phrase"]').exists()).toBe(false)
|
||||
expect(wrapper.get<HTMLInputElement>('[data-test="full-access"]').element.checked).toBe(false)
|
||||
expect(wrapper.text()).not.toMatch(/[\u3400-\u9fff]/u)
|
||||
await wrapper.get('[data-test="full-access"]').setValue(true)
|
||||
expect(wrapper.get<HTMLInputElement>('[data-test="full-access-phrase"]').element.value).toBe('')
|
||||
await wrapper.get('[data-test="full-access-phrase"]').setValue('ENABLE FULL ACCESS')
|
||||
await wrapper.get('[data-test="full-access-confirm"]').trigger('click')
|
||||
expect(wrapper.get<HTMLInputElement>('[data-test="full-access"]').element.checked).toBe(true)
|
||||
i18n.global.locale.value = 'zh'
|
||||
await flushPromises()
|
||||
expect(wrapper.get<HTMLInputElement>('[data-test="full-access"]').element.checked).toBe(false)
|
||||
await wrapper.get('[data-test="full-access"]').setValue(true)
|
||||
await wrapper.get('[data-test="full-access-phrase"]').setValue('ENABLE FULL ACCESS')
|
||||
expect(wrapper.get('[data-test="full-access-confirm"]').attributes('disabled')).toBeDefined()
|
||||
await wrapper.get('[data-test="full-access-phrase"]').setValue('开启全权访问')
|
||||
await wrapper.get('[data-test="full-access-confirm"]').trigger('click')
|
||||
await wrapper.get('[data-test="save"]').trigger('click')
|
||||
await flushPromises()
|
||||
expect(mocks.create).toHaveBeenCalledWith(expect.objectContaining({ policy: expect.objectContaining({ full_access: true }), confirm_full_access: true }))
|
||||
})
|
||||
|
||||
it('语言切换保留已有全权权限并翻译列表摘要', async () => {
|
||||
mocks.list.mockResolvedValueOnce({ items: [{ id: 'existing', name: 'Existing key', enabled: true, allowed_ips: [], policy: { full_access: true, rules: [{ permissions: ['accounts.read'], group_ids: [7], account_types: ['oauth'], platforms: ['openai'] }], global_permissions: [] } }], permissions: catalog })
|
||||
const { wrapper, i18n } = setup('zh')
|
||||
await flushPromises()
|
||||
await wrapper.findAll('button').find(button => button.text() === '编辑权限')!.trigger('click')
|
||||
i18n.global.locale.value = 'en'
|
||||
await flushPromises()
|
||||
expect(wrapper.get<HTMLInputElement>('[data-test="full-access"]').element.checked).toBe(true)
|
||||
expect(wrapper.text()).toContain('Full access')
|
||||
expect(wrapper.text()).toContain('Example group')
|
||||
expect(wrapper.text()).not.toMatch(/[\u3400-\u9fff]/u)
|
||||
})
|
||||
|
||||
it('英文环境翻译页面及后端权限目录,未知权限不泄漏中文标签或分类', async () => {
|
||||
const { wrapper } = setup()
|
||||
await flushPromises()
|
||||
await wrapper.get('[data-test="create"]').trigger('click')
|
||||
expect(wrapper.text()).toContain('Admin access keys')
|
||||
expect(wrapper.text()).not.toMatch(/[\u3400-\u9fff]/u)
|
||||
expect(wrapper.text()).toContain('Read accounts (redacted)')
|
||||
expect(wrapper.text()).toContain('Finance')
|
||||
expect(wrapper.text()).toContain('future.feature')
|
||||
const unknown = wrapper.get('input[value="payment.mark.paid"]').element.closest('label')!
|
||||
expect(unknown.textContent).toContain('Unknown permission (payment.mark.paid)')
|
||||
for (const permission of catalog) {
|
||||
const key = permission.id.replaceAll('_', '_u').replaceAll('.', '_d') as keyof typeof enKeys.permissions
|
||||
expect(wrapper.get(`input[value="${permission.id}"]`).element.closest('label')!.textContent).toContain(enKeys.permissions[key].label)
|
||||
}
|
||||
const creation = wrapper.find('input[value="accounts.create"]')
|
||||
await creation.setValue(true)
|
||||
expect(wrapper.text()).not.toMatch(/[\u3400-\u9fff]/u)
|
||||
await wrapper.get('[data-test="full-access"]').setValue(true)
|
||||
expect(wrapper.text()).toContain('ENABLE FULL ACCESS')
|
||||
expect(wrapper.text()).not.toMatch(/[\u3400-\u9fff]/u)
|
||||
await wrapper.get('[data-test="full-access-phrase"]').setValue('开启全权访问')
|
||||
expect(wrapper.get('[data-test="full-access-confirm"]').attributes('disabled')).toBeDefined()
|
||||
await wrapper.get('[data-test="full-access-phrase"]').setValue('ENABLE FULL ACCESS')
|
||||
await wrapper.get('[data-test="full-access-confirm"]').trigger('click')
|
||||
await wrapper.get('[data-test="name"]').setValue('Example key')
|
||||
await wrapper.get('[data-test="save"]').trigger('click')
|
||||
await flushPromises()
|
||||
expect(mocks.create).toHaveBeenCalledWith(expect.objectContaining({ confirm_full_access: true, policy: expect.objectContaining({ full_access: true }) }))
|
||||
expect(wrapper.get('[role="status"]').text()).toBe('Key saved')
|
||||
})
|
||||
})
|
||||
@@ -3,14 +3,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import AdminAccessKeysSettings from '../AdminAccessKeysSettings.vue'
|
||||
import zh from '@/i18n/locales/zh/adminAccessKeys'
|
||||
import en from '@/i18n/locales/en/adminAccessKeys'
|
||||
const mountSettings = () => mount(AdminAccessKeysSettings, { global: { stubs: { teleport: true } } })
|
||||
vi.mock('vue-i18n', () => ({ useI18n: () => ({
|
||||
t: (key: string, values: Record<string, unknown> = {}) => {
|
||||
const message = zh[key.replace('adminAccessKeys.', '') as keyof typeof zh]
|
||||
if (!message) throw new Error(`缺少翻译:${key}`)
|
||||
return message.replace(/\{(\w+)\}/g, (_, name: string) => String(values[name]))
|
||||
}
|
||||
}) }))
|
||||
import { createI18n } from 'vue-i18n'
|
||||
const mountSettings = () => mount(AdminAccessKeysSettings, { global: { plugins: [createI18n({ legacy: false, locale: 'zh', messages: { zh: { adminAccessKeys: zh }, en: { adminAccessKeys: en } } })], stubs: { teleport: true } } })
|
||||
import { getAllIncludingInactive } from '@/api/admin/groups'
|
||||
const mocks = vi.hoisted(() => ({ list: vi.fn(), create: vi.fn(), update: vi.fn(), rotate: vi.fn(), revoke: vi.fn(), deleteRecord: vi.fn(), stepUp: vi.fn((fn: () => unknown) => fn()) }))
|
||||
vi.mock('@/api/admin/adminAccessKeys', () => mocks)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { Permission } from '@/api/admin/adminAccessKeys'
|
||||
|
||||
// 权限 ID 是稳定协议;后端标签和分类可能始终是中文,不作为本地化回退值。
|
||||
export function useAdminAccessKeyPermissions() {
|
||||
const { t, te } = useI18n()
|
||||
function permissionLabel(permission: Permission): string {
|
||||
const key = `adminAccessKeys.permissions.${permission.id.replaceAll('_', '_u').replaceAll('.', '_d')}.label`
|
||||
return te(key) ? t(key) : t('adminAccessKeys.unknownPermission', { id: permission.id })
|
||||
}
|
||||
function permissionCategory(permission: Permission): string {
|
||||
const key = `adminAccessKeys.permissions.${permission.id.replaceAll('_', '_u').replaceAll('.', '_d')}.category`
|
||||
return te(key) ? t(key) : t('adminAccessKeys.other')
|
||||
}
|
||||
return { permissionLabel, permissionCategory }
|
||||
}
|
||||
@@ -75,5 +75,249 @@ export default {
|
||||
"rulesSuspended": "Resource rules are suspended and resume when full access is disabled. Expiration, IP restrictions, rate limits, and auditing remain active.",
|
||||
"fullAccessConfirmTitle": "Confirm full access",
|
||||
"fullAccessPhrase": "ENABLE FULL ACCESS",
|
||||
"fullAccessPhraseHint": "Type “{phrase}” to confirm:"
|
||||
"fullAccessPhraseHint": "Type “{phrase}” to confirm:",
|
||||
"unknownPermission": "Unknown permission ({id})",
|
||||
"permissions": {
|
||||
"accounts_didentity_dread": {
|
||||
"label": "Read account email, plan, and creation time (no tokens)",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dusage_dread": {
|
||||
"label": "Read and refresh authorized account quota and snapshots",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dstats_dread": {
|
||||
"label": "Read account usage and cost statistics",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"openai_dquota_dread": {
|
||||
"label": "Read OpenAI upstream quota and remaining resets",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"openai_dquota_dreset": {
|
||||
"label": "Use an OpenAI reset to restore quota",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"openai_dreferrals_dread": {
|
||||
"label": "Read OpenAI referral eligibility and remaining invitations",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"openai_dreferrals_dinvite": {
|
||||
"label": "Send OpenAI invitation emails",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"accounts_doptions_dwrite": {
|
||||
"label": "Write OpenAI OAuth identity and connection options",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_drate_dwrite": {
|
||||
"label": "Set account billing multiplier",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"groups_dlist_dread": {
|
||||
"label": "Read selected group details (name, platform, and status)",
|
||||
"category": "Groups"
|
||||
},
|
||||
"groups_dcapacity_dread": {
|
||||
"label": "Read selected group capacity (entire group, regardless of account type)",
|
||||
"category": "Groups"
|
||||
},
|
||||
"openai_dtokens_drefresh": {
|
||||
"label": "Refresh caller-provided OpenAI tokens (returns tokens; selected proxy allowed)",
|
||||
"category": "OAuth"
|
||||
},
|
||||
"accounts_dread": {
|
||||
"label": "Read accounts (redacted)",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dcreate": {
|
||||
"label": "Create accounts",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dupdate": {
|
||||
"label": "Edit account names and notes",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dcredentials": {
|
||||
"label": "Write credentials (no read access)",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dmodels_dwrite": {
|
||||
"label": "Edit account model allowlist IDs and mappings",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dnetwork": {
|
||||
"label": "Change endpoints, proxies, and connection options",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dstatus": {
|
||||
"label": "Enable, disable, and toggle account scheduling",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dschedule": {
|
||||
"label": "Change concurrency, priority, and expiration",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_drefresh": {
|
||||
"label": "Refresh OAuth credentials",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_drecover": {
|
||||
"label": "Clear account errors and rate-limit state",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_ddelete": {
|
||||
"label": "Delete accounts (affects shared groups)",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"accounts_dgroups": {
|
||||
"label": "Change authorized group associations",
|
||||
"category": "Accounts"
|
||||
},
|
||||
"groups_dmodels_dread": {
|
||||
"label": "Read selected group model allowlists and candidate IDs",
|
||||
"category": "Group models"
|
||||
},
|
||||
"groups_dmodels_dwrite": {
|
||||
"label": "Edit selected group model allowlists (affects the entire group)",
|
||||
"category": "Group models"
|
||||
},
|
||||
"proxies_dread": {
|
||||
"label": "Read proxy IP candidates (paginated, without credentials)",
|
||||
"category": "Proxies"
|
||||
},
|
||||
"models_ddefaults_dread": {
|
||||
"label": "Read default model allowlist IDs and mappings",
|
||||
"category": "Models"
|
||||
},
|
||||
"dashboard_dread": {
|
||||
"label": "Read site-wide business reports",
|
||||
"category": "Reports"
|
||||
},
|
||||
"users_dread": {
|
||||
"label": "Read all user profiles (including contact details)",
|
||||
"category": "Users"
|
||||
},
|
||||
"users_dbalance_dread": {
|
||||
"label": "Read all user balances and transaction history",
|
||||
"category": "Finance"
|
||||
},
|
||||
"users_dbalance_dwrite": {
|
||||
"label": "Add or subtract any user balance",
|
||||
"category": "Finance"
|
||||
},
|
||||
"users_dquotas_dread": {
|
||||
"label": "Read all user platform quotas",
|
||||
"category": "Users"
|
||||
},
|
||||
"users_dquotas_dwrite": {
|
||||
"label": "Change and reset all user platform quotas",
|
||||
"category": "Users"
|
||||
},
|
||||
"groups_dread": {
|
||||
"label": "Read all group configurations",
|
||||
"category": "Groups"
|
||||
},
|
||||
"usage_dread": {
|
||||
"label": "Read site-wide usage details and user usage",
|
||||
"category": "Reports"
|
||||
},
|
||||
"payment_dread": {
|
||||
"label": "Read all payment orders and reports",
|
||||
"category": "Finance"
|
||||
},
|
||||
"payment_dcancel": {
|
||||
"label": "Cancel payment orders",
|
||||
"category": "Finance"
|
||||
},
|
||||
"payment_dfulfill": {
|
||||
"label": "Retry payment order fulfillment",
|
||||
"category": "Finance"
|
||||
},
|
||||
"payment_drefund": {
|
||||
"label": "Issue refunds and confirm refund results",
|
||||
"category": "Finance"
|
||||
},
|
||||
"payment_dplans_dread": {
|
||||
"label": "Read all payment plans",
|
||||
"category": "Finance"
|
||||
},
|
||||
"payment_dplans_dwrite": {
|
||||
"label": "Create, edit, and delete payment plans",
|
||||
"category": "Finance"
|
||||
},
|
||||
"subscriptions_dread": {
|
||||
"label": "Read all subscription records",
|
||||
"category": "Subscriptions"
|
||||
},
|
||||
"subscriptions_dassign": {
|
||||
"label": "Assign subscriptions to any user",
|
||||
"category": "Subscriptions"
|
||||
},
|
||||
"subscriptions_dextend": {
|
||||
"label": "Extend subscription expiration",
|
||||
"category": "Subscriptions"
|
||||
},
|
||||
"subscriptions_drevoke": {
|
||||
"label": "Revoke subscriptions",
|
||||
"category": "Subscriptions"
|
||||
},
|
||||
"subscriptions_drestore": {
|
||||
"label": "Restore subscriptions",
|
||||
"category": "Subscriptions"
|
||||
},
|
||||
"subscriptions_dreset": {
|
||||
"label": "Reset subscription quota",
|
||||
"category": "Subscriptions"
|
||||
},
|
||||
"announcements_dread": {
|
||||
"label": "Read all announcements and read receipts",
|
||||
"category": "Content"
|
||||
},
|
||||
"announcements_dwrite": {
|
||||
"label": "Create, publish, and edit announcements",
|
||||
"category": "Content"
|
||||
},
|
||||
"announcements_ddelete": {
|
||||
"label": "Delete announcements",
|
||||
"category": "Content"
|
||||
},
|
||||
"promo_dread": {
|
||||
"label": "Read promotion codes and usage records",
|
||||
"category": "Finance"
|
||||
},
|
||||
"promo_dwrite": {
|
||||
"label": "Create and edit promotion code benefits",
|
||||
"category": "Finance"
|
||||
},
|
||||
"promo_ddelete": {
|
||||
"label": "Delete promotion codes",
|
||||
"category": "Finance"
|
||||
},
|
||||
"ops_dread": {
|
||||
"label": "Read site-wide operational metrics",
|
||||
"category": "Monitoring"
|
||||
},
|
||||
"ops_derrors_dread": {
|
||||
"label": "Read site-wide request error details (sensitive)",
|
||||
"category": "Monitoring"
|
||||
},
|
||||
"ops_derrors_dresolve": {
|
||||
"label": "Mark request error resolution status",
|
||||
"category": "Monitoring"
|
||||
},
|
||||
"ops_dalerts_dread": {
|
||||
"label": "Read site-wide alert rules and events",
|
||||
"category": "Monitoring"
|
||||
},
|
||||
"ops_dalerts_dwrite": {
|
||||
"label": "Change alert rules, status, and silences",
|
||||
"category": "Monitoring"
|
||||
},
|
||||
"system_dread": {
|
||||
"label": "Read current and available system versions",
|
||||
"category": "System"
|
||||
}
|
||||
},
|
||||
"listSeparator": ", "
|
||||
}
|
||||
@@ -75,5 +75,249 @@ export default {
|
||||
"rulesSuspended": "资源规则已暂停,关闭全权访问后恢复;有效期、IP 限制、限流和审计继续生效。",
|
||||
"fullAccessConfirmTitle": "确认开启全权访问",
|
||||
"fullAccessPhrase": "开启全权访问",
|
||||
"fullAccessPhraseHint": "请输入“{phrase}”以确认:"
|
||||
"fullAccessPhraseHint": "请输入“{phrase}”以确认:",
|
||||
"unknownPermission": "未知权限({id})",
|
||||
"permissions": {
|
||||
"accounts_didentity_dread": {
|
||||
"label": "读取账户邮箱、套餐及创建时间(不含令牌)",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dusage_dread": {
|
||||
"label": "读取及主动刷新授权账户额度与快照",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dstats_dread": {
|
||||
"label": "读取账户用量与费用统计",
|
||||
"category": "账户"
|
||||
},
|
||||
"openai_dquota_dread": {
|
||||
"label": "查询 OpenAI 上游额度与重置次数",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"openai_dquota_dreset": {
|
||||
"label": "消耗 OpenAI 重置次数恢复额度",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"openai_dreferrals_dread": {
|
||||
"label": "查询 OpenAI 邀请资格与次数",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"openai_dreferrals_dinvite": {
|
||||
"label": "发送 OpenAI 邀请邮件",
|
||||
"category": "OpenAI"
|
||||
},
|
||||
"accounts_doptions_dwrite": {
|
||||
"label": "写入 OpenAI OAuth 身份与连接选项",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_drate_dwrite": {
|
||||
"label": "设置账户计费倍率",
|
||||
"category": "账户"
|
||||
},
|
||||
"groups_dlist_dread": {
|
||||
"label": "读取所选分组基本信息(名称、平台、状态)",
|
||||
"category": "分组"
|
||||
},
|
||||
"groups_dcapacity_dread": {
|
||||
"label": "读取所选分组容量(整个分组,不按账户类型过滤)",
|
||||
"category": "分组"
|
||||
},
|
||||
"openai_dtokens_drefresh": {
|
||||
"label": "刷新调用方提供的 OpenAI 令牌(返回令牌,可使用所选代理)",
|
||||
"category": "OAuth"
|
||||
},
|
||||
"accounts_dread": {
|
||||
"label": "查看账户(脱敏)",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dcreate": {
|
||||
"label": "创建账户",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dupdate": {
|
||||
"label": "编辑名称与备注",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dcredentials": {
|
||||
"label": "写入凭证(不包含读取)",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dmodels_dwrite": {
|
||||
"label": "编辑账户白名单模型 ID 与映射",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dnetwork": {
|
||||
"label": "修改接入地址、代理与连接选项",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dstatus": {
|
||||
"label": "启用、停用与调度开关",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dschedule": {
|
||||
"label": "修改并发、优先级与有效期",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_drefresh": {
|
||||
"label": "刷新 OAuth 凭证",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_drecover": {
|
||||
"label": "清除账户错误与限流状态",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_ddelete": {
|
||||
"label": "删除账户(影响共享分组)",
|
||||
"category": "账户"
|
||||
},
|
||||
"accounts_dgroups": {
|
||||
"label": "调整授权分组关联",
|
||||
"category": "账户"
|
||||
},
|
||||
"groups_dmodels_dread": {
|
||||
"label": "读取所选分组模型白名单与候选 ID",
|
||||
"category": "分组模型"
|
||||
},
|
||||
"groups_dmodels_dwrite": {
|
||||
"label": "编辑所选分组模型白名单(影响整个分组)",
|
||||
"category": "分组模型"
|
||||
},
|
||||
"proxies_dread": {
|
||||
"label": "读取代理 IP 候选(分页,不含认证凭证)",
|
||||
"category": "代理"
|
||||
},
|
||||
"models_ddefaults_dread": {
|
||||
"label": "读取默认白名单模型 ID(含默认映射)",
|
||||
"category": "模型"
|
||||
},
|
||||
"dashboard_dread": {
|
||||
"label": "读取全站经营报表",
|
||||
"category": "报表"
|
||||
},
|
||||
"users_dread": {
|
||||
"label": "读取全站用户资料(含联系方式)",
|
||||
"category": "用户"
|
||||
},
|
||||
"users_dbalance_dread": {
|
||||
"label": "读取全站用户余额及流水",
|
||||
"category": "财务"
|
||||
},
|
||||
"users_dbalance_dwrite": {
|
||||
"label": "增减任意用户余额",
|
||||
"category": "财务"
|
||||
},
|
||||
"users_dquotas_dread": {
|
||||
"label": "读取全站用户平台额度",
|
||||
"category": "用户"
|
||||
},
|
||||
"users_dquotas_dwrite": {
|
||||
"label": "修改与重置全站用户平台额度",
|
||||
"category": "用户"
|
||||
},
|
||||
"groups_dread": {
|
||||
"label": "读取所有分组配置",
|
||||
"category": "分组"
|
||||
},
|
||||
"usage_dread": {
|
||||
"label": "读取全站用量明细及用户用量",
|
||||
"category": "报表"
|
||||
},
|
||||
"payment_dread": {
|
||||
"label": "读取全站支付订单与报表",
|
||||
"category": "财务"
|
||||
},
|
||||
"payment_dcancel": {
|
||||
"label": "取消支付订单",
|
||||
"category": "财务"
|
||||
},
|
||||
"payment_dfulfill": {
|
||||
"label": "重新履约支付订单",
|
||||
"category": "财务"
|
||||
},
|
||||
"payment_drefund": {
|
||||
"label": "发起退款及确认退款结果",
|
||||
"category": "财务"
|
||||
},
|
||||
"payment_dplans_dread": {
|
||||
"label": "读取全部支付套餐",
|
||||
"category": "财务"
|
||||
},
|
||||
"payment_dplans_dwrite": {
|
||||
"label": "创建、修改和删除支付套餐",
|
||||
"category": "财务"
|
||||
},
|
||||
"subscriptions_dread": {
|
||||
"label": "读取全站订阅记录",
|
||||
"category": "订阅"
|
||||
},
|
||||
"subscriptions_dassign": {
|
||||
"label": "分配全站用户订阅",
|
||||
"category": "订阅"
|
||||
},
|
||||
"subscriptions_dextend": {
|
||||
"label": "延长订阅有效期",
|
||||
"category": "订阅"
|
||||
},
|
||||
"subscriptions_drevoke": {
|
||||
"label": "撤销订阅",
|
||||
"category": "订阅"
|
||||
},
|
||||
"subscriptions_drestore": {
|
||||
"label": "恢复订阅",
|
||||
"category": "订阅"
|
||||
},
|
||||
"subscriptions_dreset": {
|
||||
"label": "重置订阅额度",
|
||||
"category": "订阅"
|
||||
},
|
||||
"announcements_dread": {
|
||||
"label": "读取所有公告与阅读记录",
|
||||
"category": "内容"
|
||||
},
|
||||
"announcements_dwrite": {
|
||||
"label": "创建、发布与修改公告",
|
||||
"category": "内容"
|
||||
},
|
||||
"announcements_ddelete": {
|
||||
"label": "删除公告",
|
||||
"category": "内容"
|
||||
},
|
||||
"promo_dread": {
|
||||
"label": "读取优惠码及使用记录",
|
||||
"category": "财务"
|
||||
},
|
||||
"promo_dwrite": {
|
||||
"label": "创建与修改优惠码权益",
|
||||
"category": "财务"
|
||||
},
|
||||
"promo_ddelete": {
|
||||
"label": "删除优惠码",
|
||||
"category": "财务"
|
||||
},
|
||||
"ops_dread": {
|
||||
"label": "读取全站运维指标",
|
||||
"category": "监控"
|
||||
},
|
||||
"ops_derrors_dread": {
|
||||
"label": "读取全站请求错误详情(敏感)",
|
||||
"category": "监控"
|
||||
},
|
||||
"ops_derrors_dresolve": {
|
||||
"label": "标记请求错误处理状态",
|
||||
"category": "监控"
|
||||
},
|
||||
"ops_dalerts_dread": {
|
||||
"label": "读取全站告警规则与事件",
|
||||
"category": "监控"
|
||||
},
|
||||
"ops_dalerts_dwrite": {
|
||||
"label": "修改告警规则、状态与静默",
|
||||
"category": "监控"
|
||||
},
|
||||
"system_dread": {
|
||||
"label": "读取系统版本与可更新版本",
|
||||
"category": "系统"
|
||||
}
|
||||
},
|
||||
"listSeparator": "、"
|
||||
}
|
||||
Reference in new issue
Block a user