forked from EduCraft/curriculum-project-hub
fix: enforce active organization boundary
This commit is contained in:
@@ -68,4 +68,16 @@ describe("canTriggerRole (integration, per-role gate)", () => {
|
||||
const onP2 = await canTriggerRole(prisma, p2.id, "review", "ou_a");
|
||||
expect(onP2.allowed).toBe(false);
|
||||
});
|
||||
|
||||
it("denies an otherwise open role when the organization is suspended", async () => {
|
||||
const project = await prisma.project.create({
|
||||
data: { id: "p-role-suspended", organizationId: DEFAULT_ORG_ID, name: "T", workspaceDir: "/tmp/x" },
|
||||
});
|
||||
await prisma.organization.update({ where: { id: DEFAULT_ORG_ID }, data: { status: "SUSPENDED" } });
|
||||
|
||||
const result = await canTriggerRole(prisma, project.id, "draft", "ou_a");
|
||||
|
||||
expect(result.allowed).toBe(false);
|
||||
expect(result.reason).toContain(`organization ${DEFAULT_ORG_ID} is SUSPENDED`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user