- 新增 user.check 功能用于核对人员是否已有系统账号 - 在 assistant-table-layout.js 中为用户表格添加 checkedIdentity 和 matchResult 字段 - 优化 AssistantConversationService 中的任务记忆和澄清流程 - 支持对草稿特定行进行修改,无需重新填写整张表 - 限制 user.check 操作最大查询数量为 100 条记录 - 实现中断任务恢复机制,保持原始请求上下文 - 添加针对多行数据选择性修改的目标行标识支持
28 lines
1.9 KiB
JavaScript
28 lines
1.9 KiB
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import {hasHomePermission,isHomePath,visibleHomeRoutes,homeLandingPath} from '../../src/utils/home-access.js'
|
|
|
|
const routes=[{path:'',redirect:'/index',children:[{path:'/index',meta:{homePage:true,affix:true}}]},{path:'/login',hidden:true},{path:'/',children:[{path:'project-archive',meta:{title:'项目资料'}}]}]
|
|
test('an archive-only manager has no homepage route and lands directly on project documents',()=>{
|
|
assert.equal(hasHomePermission(['archive:project:list']),false)
|
|
const visible=visibleHomeRoutes(routes,false)
|
|
assert.equal(visible.some(r=>r.children?.some(c=>c.meta?.homePage)),false)
|
|
assert.equal(homeLandingPath(visible,false),'/project-archive')
|
|
assert.equal(routes[0].children.length,1)
|
|
})
|
|
test('homepage permission is explicit, administrator wildcard works, and no-menu accounts have a safe fallback',()=>{
|
|
assert.equal(hasHomePermission(['warehouse:stock:list']),false)
|
|
assert.equal(hasHomePermission(['business:home:view']),true)
|
|
assert.equal(hasHomePermission(['business:home:view'],'project'),false)
|
|
assert.equal(hasHomePermission(['*:*:*'],'todo'),true)
|
|
assert.equal(homeLandingPath(routes,true),'/index')
|
|
assert.equal(homeLandingPath([{path:'/hidden',hidden:true},{path:'https://example.com'},{path:'/record/:id'}],false),'/user/profile')
|
|
for(const path of ['/index','/index/','/redirect/index?x=1','/'])assert.equal(isHomePath(path),true)
|
|
assert.equal(isHomePath('/project-archive'),false)
|
|
})
|
|
test('the database authorization menu never registers a duplicate Index route',()=>{
|
|
const dynamic=[{path:'/',children:[{path:'index',component:'businessHome/index'}]},{path:'/system',children:[{path:'user',component:'system/user/index'}]}]
|
|
assert.deepEqual(visibleHomeRoutes(dynamic,true,true),[dynamic[1]])
|
|
assert.equal(homeLandingPath(visibleHomeRoutes(dynamic,false,true),false),'/system/user')
|
|
})
|