fix(intake): align space visual planning role
This commit is contained in:
parent
1dbd7f1d63
commit
1b0141908e
12
furniture-3d-system/src/lib/business-role-inference.test.ts
Normal file
12
furniture-3d-system/src/lib/business-role-inference.test.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { inferBusinessRolesFromDepartmentPath } from './business-role-inference'
|
||||||
|
|
||||||
|
describe('business role inference', () => {
|
||||||
|
it('maps brand center space visual department to planning', () => {
|
||||||
|
const result = inferBusinessRolesFromDepartmentPath(
|
||||||
|
'江苏简尚品牌管理有限公司 > 品牌中心 > 空间视觉部',
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(result.businessRoles).toEqual(['PLANNING'])
|
||||||
|
expect(result.reason).toContain('企划')
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -170,10 +170,10 @@ export function inferBusinessRolesFromDepartmentPath(
|
|||||||
|
|
||||||
if (root === '品牌中心' && includesSegment(parts, /空间视觉部/)) {
|
if (root === '品牌中心' && includesSegment(parts, /空间视觉部/)) {
|
||||||
return {
|
return {
|
||||||
businessRoles: ['DESIGN'],
|
businessRoles: ['PLANNING'],
|
||||||
excluded: false,
|
excluded: false,
|
||||||
shouldWarnWhenEmpty: true,
|
shouldWarnWhenEmpty: true,
|
||||||
reason: '品牌中心空间视觉部默认归设计',
|
reason: '品牌中心空间视觉部默认归企划',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -165,6 +165,21 @@ describe('non-integrated intake permissions', () => {
|
|||||||
expect(canEditNonIntegratedWorkspace(baseProduct, user, '设计卖点')).toBe(false)
|
expect(canEditNonIntegratedWorkspace(baseProduct, user, '设计卖点')).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('keeps planning business role from opening planning layout without space visual department', () => {
|
||||||
|
const user = {
|
||||||
|
id: 'planning-role-only-id',
|
||||||
|
name: '企划B',
|
||||||
|
role: 'USER',
|
||||||
|
businessRoles: ['PLANNING'],
|
||||||
|
departmentPaths: [
|
||||||
|
'江苏简尚品牌管理有限公司 > 品牌中心 > 商品企划部 > 一线品牌',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(canEditNonIntegratedWorkspace(baseProduct, user, '空间布局')).toBe(false)
|
||||||
|
expect(canEditNonIntegratedWorkspace(baseProduct, user, '企划布局')).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
it('separates purchaser owner, pricing group, and quality group access', () => {
|
it('separates purchaser owner, pricing group, and quality group access', () => {
|
||||||
const purchaser = {
|
const purchaser = {
|
||||||
id: 'purchase-id',
|
id: 'purchase-id',
|
||||||
|
|||||||
@ -181,7 +181,7 @@ function isBrandCenterDepartmentPath(path: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isSpaceVisualDepartmentPath(path: string) {
|
function isSpaceVisualDepartmentPath(path: string) {
|
||||||
return /空间视觉部/.test(path)
|
return /品牌中心/.test(path) && /空间视觉部/.test(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSupplyChainPurchaseDepartmentPath(path: string) {
|
function isSupplyChainPurchaseDepartmentPath(path: string) {
|
||||||
@ -267,10 +267,7 @@ export function isIntakeNonIntegratedBrandCenterPlanningUser(
|
|||||||
export function isIntakeNonIntegratedSpaceDepartmentUser(
|
export function isIntakeNonIntegratedSpaceDepartmentUser(
|
||||||
user: IntakeNonIntegratedPermissionUser,
|
user: IntakeNonIntegratedPermissionUser,
|
||||||
) {
|
) {
|
||||||
return (
|
return hasDepartmentPath(user, isSpaceVisualDepartmentPath)
|
||||||
hasDepartmentPath(user, isSpaceVisualDepartmentPath) ||
|
|
||||||
hasBusinessRoleFallback(user, 'DESIGN')
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isIntakeNonIntegratedSupplyChainUser(
|
export function isIntakeNonIntegratedSupplyChainUser(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user