diff --git a/furniture-3d-system/src/lib/installation-demo-workbench-permissions.test.ts b/furniture-3d-system/src/lib/installation-demo-workbench-permissions.test.ts index a7ff799a..6f9c3e98 100644 --- a/furniture-3d-system/src/lib/installation-demo-workbench-permissions.test.ts +++ b/furniture-3d-system/src/lib/installation-demo-workbench-permissions.test.ts @@ -26,17 +26,27 @@ describe('installation demo workbench permissions', () => { }) }) - it('lets customer service view and share the workbench without edit access', () => { + it('routes customer service through node permissions instead of a forced read-only mode', () => { + const user = { + role: 'USER', + businessRoles: ['CUSTOMER_SERVICE'], + departmentPaths: ['江苏简尚品牌管理有限公司 > 客服中心'], + } + // 旧口径已删除:客服不再被硬编码拦成只读分享,与普通员工同样走权限配置。 + expect(getInstallationDemoWorkbenchAccess(user)).toMatchObject({ + mode: 'hidden', + canView: false, + canEdit: false, + canShare: false, + }) expect( - getInstallationDemoWorkbenchAccess({ - role: 'USER', - businessRoles: ['CUSTOMER_SERVICE'], - departmentPaths: ['江苏简尚品牌管理有限公司 > 客服中心'], + getInstallationDemoWorkbenchAccess(user, { + 'installationDemoWorkbench:customerService:edit': true, }), ).toMatchObject({ - mode: 'share', + mode: 'full', canView: true, - canEdit: false, + canEdit: true, canShare: true, }) }) diff --git a/furniture-3d-system/src/lib/installation-demo-workbench-permissions.ts b/furniture-3d-system/src/lib/installation-demo-workbench-permissions.ts index 2e66cfc6..d0471817 100644 --- a/furniture-3d-system/src/lib/installation-demo-workbench-permissions.ts +++ b/furniture-3d-system/src/lib/installation-demo-workbench-permissions.ts @@ -27,21 +27,6 @@ function isInstallationDemoWorkspaceManager(user: InstallationDemoWorkbenchPermi return user.role === 'SUPER_ADMIN' || user.role === 'ADMIN' || user.role === 'SUPERVISOR' } -function normalizeDepartmentPath(value: unknown) { - return typeof value === 'string' ? value.trim().replace(/\s+/g, '') : '' -} - -function isCustomerServiceUser(user: InstallationDemoWorkbenchPermissionUser) { - if (user.businessRoles?.includes('CUSTOMER_SERVICE')) return true - return [ - user.department?.fullPath, - user.department?.name, - ...(user.departmentPaths ?? []), - ] - .map(normalizeDepartmentPath) - .some((path) => /客服中心/.test(path)) -} - export function getInstallationDemoWorkbenchAccess( user: InstallationDemoWorkbenchPermissionUser | null | undefined, overrides?: IntakeNodePermissionOverrideMap, @@ -64,14 +49,9 @@ export function getInstallationDemoWorkbenchAccess( } } - if (isCustomerServiceUser(user)) { - return { - mode: 'share', - canView: true, - canEdit: false, - canShare: true, - } - } + // 客服与其他普通员工一样走节点权限配置(正式站已为客服开通编辑权限)。 + // 旧的"客服强制只读分享"硬编码口径已删除:它排在 overrides 之前, + // 会拦住正式站给客服配置的编辑权限,导致客服只能看和分享、无法操作。 if (overrides) { const nodeAccess = resolveIntakeNodePermissionAccess(