@goplusvn/core 0.1.87 → 0.1.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/package.json +1 -1
- package/src/audit/__tests__/prisma-audit-extension.test.ts +113 -0
- package/src/audit/prisma-audit-extension.ts +41 -13
- package/src/configs/status.ts +67 -0
- package/src/cron/__tests__/cron-single-runner.test.ts +260 -0
- package/src/cron/cron-schedule.ts +113 -20
- package/src/cron/db-cron-manager.ts +90 -7
- package/src/cron/simple-cron-job.ts +17 -6
- package/src/crud/__tests__/status-boolean-display.test.tsx +186 -0
- package/src/crud/components/crud-detail-dialog.tsx +21 -8
- package/src/crud/components/crud-field-renderer.tsx +20 -13
- package/src/crud/components/crud-filter-chips.tsx +14 -39
- package/src/crud/components/crud-filters/datetime-filter.tsx +58 -17
- package/src/crud/components/crud-provider.tsx +10 -2
- package/src/crud/components/crud-table-toolbar.tsx +38 -40
- package/src/crud/components/crud-table.tsx +13 -8
- package/src/crud/lib/coerce.ts +36 -10
- package/src/crud/lib/filter-defaults.test.ts +115 -0
- package/src/crud/lib/filter-defaults.ts +56 -0
- package/src/crud/lib/filter-display.ts +59 -0
- package/src/crud/lib/query-builder.ts +4 -0
- package/src/types/index.ts +16 -9
- package/src/ui/data-display/data-table/data-table-toolbar.tsx +8 -2
- package/src/ui/data-display/data-table/data-table.tsx +32 -4
- package/src/ui/layout/user-dropdown.tsx +30 -23
- package/src/ui/primitives/status-badge.tsx +14 -10
- package/src/ui/shared/status-indicator.tsx +266 -74
- package/src/utils/index.ts +87 -38
- package/src/workspace/__tests__/workspace-delegation.test.ts +29 -11
|
@@ -104,8 +104,12 @@ describe("D1 — chứa trong nhánh", () => {
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
it("
|
|
108
|
-
|
|
107
|
+
it("không phải quản trị nhưng ở TRONG nhánh gốc của mình thì qua", () => {
|
|
108
|
+
// Luật đã được NỚI có chủ đích (commit "relax workspace delegation rules
|
|
109
|
+
// for user creation"): thành viên của nhánh gốc thao tác được trong chính
|
|
110
|
+
// nhánh đó, không bắt buộc phải là quản trị viên. Bài test này trước đây
|
|
111
|
+
// còn khoá luật cũ nên đỏ suốt — nay khoá đúng luật đang chạy.
|
|
112
|
+
const member = customerAdmin({
|
|
109
113
|
scope: createWorkspaceScope({
|
|
110
114
|
canViewAll: false,
|
|
111
115
|
rootIds: ["spa"],
|
|
@@ -113,10 +117,13 @@ describe("D1 — chứa trong nhánh", () => {
|
|
|
113
117
|
adminIds: [],
|
|
114
118
|
}),
|
|
115
119
|
});
|
|
116
|
-
expect(() => assertWorkspacesInScope(
|
|
117
|
-
|
|
120
|
+
expect(() => assertWorkspacesInScope(member, ["spa"])).not.toThrow();
|
|
121
|
+
// Nhưng RA NGOÀI nhánh thì vẫn chặn — nới không đồng nghĩa với bỏ ngỏ.
|
|
122
|
+
expect(() => assertWorkspacesInScope(member, ["tanloc"])).toThrow(
|
|
123
|
+
/Ngoài phạm vi/,
|
|
118
124
|
);
|
|
119
|
-
|
|
125
|
+
// Và không có nhánh nào làm quản trị thì vẫn KHÔNG được uỷ quyền người dùng.
|
|
126
|
+
expect(canDelegateUsers(member)).toBe(false);
|
|
120
127
|
});
|
|
121
128
|
|
|
122
129
|
it("toàn quyền đi qua mọi thứ", () => {
|
|
@@ -375,7 +382,11 @@ describe("Quản trị VAI TRÒ — cổng tạo/sửa/xoá", () => {
|
|
|
375
382
|
});
|
|
376
383
|
|
|
377
384
|
it("tạo vai trò trong nhánh mình: được đóng dấu workspace + giữ rank", () => {
|
|
378
|
-
const gate = assertCanManageRole(
|
|
385
|
+
const gate = assertCanManageRole(
|
|
386
|
+
customerAdmin(),
|
|
387
|
+
null,
|
|
388
|
+
draft({ rank: 80 }),
|
|
389
|
+
);
|
|
379
390
|
expect(gate.workspaceId).toBe("spa");
|
|
380
391
|
expect(gate.rank).toBe(80);
|
|
381
392
|
});
|
|
@@ -448,17 +459,24 @@ describe("Quản trị VAI TRÒ — cổng tạo/sửa/xoá", () => {
|
|
|
448
459
|
canManageRole(customerAdmin(), role({ workspaceId: "tanloc" })),
|
|
449
460
|
).toBe(false);
|
|
450
461
|
expect(
|
|
451
|
-
canManageRole(
|
|
462
|
+
canManageRole(
|
|
463
|
+
customerAdmin(),
|
|
464
|
+
role({ workspaceId: "spa", isSystem: true }),
|
|
465
|
+
),
|
|
452
466
|
).toBe(false);
|
|
453
|
-
expect(
|
|
454
|
-
|
|
455
|
-
);
|
|
467
|
+
expect(
|
|
468
|
+
canManageRole(customerAdmin(), role({ workspaceId: "spa-qc" })),
|
|
469
|
+
).toBe(true);
|
|
456
470
|
});
|
|
457
471
|
|
|
458
472
|
it("nhóm vận hành miễn mọi luật", () => {
|
|
459
473
|
expect(canManageRole(opsAdmin(), role({ isSystem: true }))).toBe(true);
|
|
460
474
|
expect(() =>
|
|
461
|
-
assertCanManageRole(
|
|
475
|
+
assertCanManageRole(
|
|
476
|
+
opsAdmin(),
|
|
477
|
+
null,
|
|
478
|
+
draft({ permissions: ["role:create"] }),
|
|
479
|
+
),
|
|
462
480
|
).not.toThrow();
|
|
463
481
|
expect(defaultRoleWorkspaceIdFor(opsAdmin())).toBeNull();
|
|
464
482
|
});
|