清理全局角色残留并修复项目权限判断

This commit is contained in:
Cheng Zhou
2026-05-29 10:20:42 +08:00
parent 63457aab11
commit 44d69c2d7b
63 changed files with 739 additions and 443 deletions
+13 -3
View File
@@ -52,12 +52,22 @@ describe("project management access", () => {
expect(source).toContain("canProject(scope.row, 'audit_export', 'read')");
});
it("opens project names in management detail when the user has setup config write permission", () => {
it("opens project names in management detail when the user has setup config read permission", () => {
const source = readProjects();
expect(source).toContain("v-if=\"canProject(scope.row, 'setup_config', 'write')\"");
expect(source).toContain("v-if=\"canProject(scope.row, 'setup_config', 'read')\"");
expect(source).toContain('@click="goProject(scope.row)" class="project-name"');
expect(source).toContain('@click="enterStudy(scope.row)"');
expect(source).toContain('if (!canProject(row, "setup_config", "write"))');
expect(source).toContain('if (!canProject(row, "setup_config", "read"))');
});
it("keeps audit export write mappings on the export operation", () => {
const projects = readProjects();
const router = readRouter();
expect(projects).toContain('audit_export: { read: "audit_logs:read", write: "audit_logs:export" }');
expect(router).toContain('audit_export: { read: "audit_logs:read", write: "audit_logs:export" }');
expect(projects).not.toContain('audit_export: { read: "audit_logs:read", write: "audit_logs:read" }');
expect(router).not.toContain('audit_export: { read: "audit_logs:read", write: "audit_logs:read" }');
});
});