@7365admin1/core 3.107.0 → 3.110.0
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 +18 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1231 -1062
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1228 -1059
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/e2e/assign-role-owner.e2e.test.mjs +149 -0
- package/test/e2e/harness.mjs +1 -0
- package/test/e2e/invite-org-scoping.e2e.test.mjs +6 -5
- package/test/e2e/org-invite-scope.e2e.test.mjs +188 -0
- package/test/e2e/site-delete-owner-only.e2e.test.mjs +148 -0
- package/test/invite-origin.test.mjs +42 -0
- package/test/member-role-assign.test.mjs +68 -0
- package/test/site-owner-edit.test.mjs +18 -0
- package/test/verification-scope.test.mjs +2 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assign Role on the Members screens (owner report 2026-09-25: Aigle Security /
|
|
3
|
+
* Newton 200, "No owner role found."). The pure decisions; the real HTTP path
|
|
4
|
+
* is `test/e2e/assign-role-owner.e2e.test.mjs`.
|
|
5
|
+
*/
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import assert from "node:assert/strict";
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
assignRoleRefusal,
|
|
13
|
+
isOwnerRole,
|
|
14
|
+
roleGrantsAssign,
|
|
15
|
+
} from "./.build/utils/member-role-assign.util.mjs";
|
|
16
|
+
|
|
17
|
+
const ORG = "6a3e323f04d9bfc9b638cfdb";
|
|
18
|
+
const OTHER = "690053d194b3f2e7d74be49b";
|
|
19
|
+
const SITE = "6a3e36be04d9bfc9b638cfe7";
|
|
20
|
+
const OTHER_SITE = "6a3e329104d9bfc9b638cfde";
|
|
21
|
+
const siteMember = { org: ORG, type: "security_agency", siteId: SITE };
|
|
22
|
+
|
|
23
|
+
test("the owner's case: a site role of this org, for this site, is allowed", () => {
|
|
24
|
+
const role = { org: ORG, type: "security_agency", site: SITE, status: "active" };
|
|
25
|
+
assert.equal(assignRoleRefusal(role, siteMember), null);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("an org-wide role of this org is allowed on a site member", () => {
|
|
29
|
+
assert.equal(assignRoleRefusal({ org: ORG, type: "organization", status: "active" }, siteMember), null);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("refusals: other org, template, deleted, other app, other site, missing", () => {
|
|
33
|
+
assert.equal(assignRoleRefusal({ org: OTHER, type: "security_agency", status: "active" }, siteMember), "That role belongs to a different organisation.");
|
|
34
|
+
assert.match(assignRoleRefusal({ org: "", type: "organization", status: "active" }, siteMember), /template/);
|
|
35
|
+
assert.equal(assignRoleRefusal({ org: ORG, type: "security_agency", status: "deleted" }, siteMember), "That role has been deleted.");
|
|
36
|
+
assert.equal(assignRoleRefusal({ org: ORG, type: "cleaning_services", status: "active" }, siteMember), "That role belongs to a different application.");
|
|
37
|
+
assert.equal(assignRoleRefusal({ org: ORG, type: "security_agency", site: OTHER_SITE, status: "active" }, siteMember), "That role belongs to a different site.");
|
|
38
|
+
assert.equal(assignRoleRefusal(null, siteMember), "That role does not exist.");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("an organisation-type membership may hold any of its org's app roles (38 staging rows do)", () => {
|
|
42
|
+
const orgRow = { org: ORG, type: "organization", siteId: "" };
|
|
43
|
+
assert.equal(assignRoleRefusal({ org: ORG, type: "security_agency", status: "active" }, orgRow), null);
|
|
44
|
+
assert.match(assignRoleRefusal({ type: "admin", org: "" }, orgRow), /Seven365 console/);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("roleGrantsAssign follows the client's grantsPermission rule", () => {
|
|
48
|
+
assert.equal(roleGrantsAssign(["members:assign-member-role"]), true);
|
|
49
|
+
assert.equal(roleGrantsAssign(["*"]), true);
|
|
50
|
+
assert.equal(roleGrantsAssign([]), true);
|
|
51
|
+
assert.equal(roleGrantsAssign(undefined), true);
|
|
52
|
+
assert.equal(roleGrantsAssign(["members:view-members"]), false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("isOwnerRole is exactly a '*' grant", () => {
|
|
56
|
+
assert.equal(isOwnerRole({ permissions: ["*"] }), true);
|
|
57
|
+
assert.equal(isOwnerRole({ permissions: ["members:view-members"] }), false);
|
|
58
|
+
assert.equal(isOwnerRole(null), false);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("wiring: the service no longer demands a stored owner role before any change", () => {
|
|
62
|
+
const svc = readFileSync(fileURLToPath(new URL("../src/services/member.service.ts", import.meta.url)), "utf8");
|
|
63
|
+
assert.doesNotMatch(svc, /No owner role found/);
|
|
64
|
+
assert.doesNotMatch(svc, /No owner members found/);
|
|
65
|
+
assert.match(svc, /assignRoleRefusal\(/);
|
|
66
|
+
const ctl = readFileSync(fileURLToPath(new URL("../src/controllers/member.controller.ts", import.meta.url)), "utf8");
|
|
67
|
+
assert.match(ctl, /requireRoleAssigner\(req, org\)/);
|
|
68
|
+
});
|
|
@@ -2,7 +2,9 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import test from "node:test";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
mayDeleteSite,
|
|
5
6
|
mayEditSiteDetails,
|
|
7
|
+
siteDeleteOwnerOnlyMessage,
|
|
6
8
|
siteOwnerOnlyMessage,
|
|
7
9
|
touchesSiteOwnerFields,
|
|
8
10
|
} from "./.build/utils/site-owner-edit.util.mjs";
|
|
@@ -50,3 +52,19 @@ test("the refusal names the owner, or says another organisation", () => {
|
|
|
50
52
|
"This site belongs to another organisation. Only they can change its details.",
|
|
51
53
|
);
|
|
52
54
|
});
|
|
55
|
+
|
|
56
|
+
// Owner decision 2026-09-25: only the owning client (with "Delete Site") deletes a site.
|
|
57
|
+
test("deleting needs the owner's Delete Site right or the wildcard", () => {
|
|
58
|
+
assert.equal(mayDeleteSite(["sites:delete-site"]), true);
|
|
59
|
+
assert.equal(mayDeleteSite(["*"]), true);
|
|
60
|
+
assert.equal(mayDeleteSite(["sites:see-all-sites", "sites:add-site"]), false);
|
|
61
|
+
assert.equal(mayDeleteSite([]), false);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("the provider's refusal names the owner and points at Remove from your Sites", () => {
|
|
65
|
+
assert.equal(
|
|
66
|
+
siteDeleteOwnerOnlyMessage("Management Pte Ltd"),
|
|
67
|
+
"This site belongs to Management Pte Ltd. Only they can delete it. You can remove it from your Sites list instead.",
|
|
68
|
+
);
|
|
69
|
+
assert.match(siteDeleteOwnerOnlyMessage(null), /^This site belongs to another organisation\./);
|
|
70
|
+
});
|
|
@@ -71,7 +71,8 @@ test("the cancel gate reads the STORED verification, never the request", () => {
|
|
|
71
71
|
|
|
72
72
|
test("the v1 list gate is handed the caller's own orgId, not a literal", () => {
|
|
73
73
|
const body = fn(v1, "getVerifications");
|
|
74
|
-
|
|
74
|
+
// Seven365's own list (origin) is staff-only whatever org is named.
|
|
75
|
+
assert.match(body, /requireVerificationListReach\(req, origin \? null : orgId\)/);
|
|
75
76
|
});
|
|
76
77
|
|
|
77
78
|
test("an omitted organisation costs Seven365 staff identity", () => {
|