fix(router): check system permissions against target project

This commit is contained in:
Cheng Zhou
2026-06-08 11:08:23 +08:00
parent 8cd8c38900
commit 30e2398400
9 changed files with 283 additions and 82 deletions
+7 -1
View File
@@ -39,7 +39,13 @@ describe("admin project route permissions", () => {
expect(projectPermissionRoute).toContain("systemPermission: SYSTEM_PERMISSION_PROJECT_CONFIG");
expect(projectPermissionRoute).not.toContain("requiresProjectPm: true");
expect(source).toContain("to.meta.systemPermission");
expect(source).toContain("hasSystemPermissionAccess(to.meta.systemPermission as string, isAdmin)");
expect(source).toContain("hasSystemPermissionAccess(to.meta.systemPermission as string, isAdmin, to)");
expect(source).toContain("const targetProjectId = getTargetProjectId(to);");
expect(source).toContain('const matchedProject = items.find((study: any) => study.id === targetProjectId);');
const targetProjectBranchStart = source.indexOf("if (targetProjectId) {");
const targetProjectBranchEnd = source.indexOf("const hasPmProject", targetProjectBranchStart);
const targetProjectBranch = source.slice(targetProjectBranchStart, targetProjectBranchEnd);
expect(targetProjectBranch).not.toContain("ensureDefaultPmStudy");
});
it("keeps login landing independent from PM management backend access", () => {