fix: 用专用权限收窄经理 AP 访问(09-07-manager-ap-access-scope)
这个提交包含在:
@@ -55,6 +55,19 @@ function buildConfig() {
|
||||
}
|
||||
|
||||
describe("workspace small-team navigation defaults", () => {
|
||||
it.each(["manager", "ceo", "finance", "finance_mgr", "system_admin"])("projects AP separately from payment navigation for %s", async (role) => {
|
||||
const employee = { id: "synthetic-actor", roleCodes: [role], permissionCodes: resolvePermissionsForRoles([role]) };
|
||||
const navigation = await getSystemNavigation({
|
||||
prisma: buildPrisma(["payment_batch_v1"]),
|
||||
config: { ...buildConfig(), paymentBatchEnabled: true },
|
||||
employee,
|
||||
hasPermission: (candidate, permission) => hasPermission(candidate.permissionCodes, permission),
|
||||
});
|
||||
const keys = Object.values(navigation.sections).flat().map((item) => item.key);
|
||||
expect(keys.includes("apOperations")).toBe(["ceo", "finance", "finance_mgr"].includes(role));
|
||||
if (role === "manager") expect(keys).toContain("paymentBatches");
|
||||
});
|
||||
|
||||
it("keeps only the small-team task path in default main navigation", () => {
|
||||
const mainModules = Object.entries(DEFAULT_MODULE_VISIBILITY)
|
||||
.filter(([, placement]) => placement === "main")
|
||||
@@ -224,7 +237,7 @@ describe("workspace small-team navigation defaults", () => {
|
||||
|
||||
const mainLabels = navigation.sections.main.map((item) => item.label);
|
||||
expect(mainLabels).toContain("付款");
|
||||
expect(mainLabels).toContain("应付账款");
|
||||
expect(mainLabels).not.toContain("应付账款");
|
||||
expect(mainLabels).not.toContain("票据");
|
||||
});
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户