@7365admin1/core 3.65.0 → 3.65.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.65.0",
4
+ "version": "3.65.1",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -33,7 +33,29 @@ import {
33
33
  permissionsOutsideModules,
34
34
  requireWithinModules,
35
35
  keepStoredSiteModules,
36
+ siteModulesForOrg,
36
37
  } from "./.build/utils/site-modules.util.mjs";
38
+
39
+ test("a site's list narrows a role only when the site belongs to the role's organisation", () => {
40
+ const site = { orgId: "org-client", metadata: { modules: ["visitor-mgmt"] } };
41
+ assert.deepEqual(siteModulesForOrg(site, "org-client"), ["visitor-mgmt"]);
42
+ // A provider's role at the client's site: the client's site list does not apply.
43
+ assert.equal(siteModulesForOrg(site, "org-provider"), undefined);
44
+ // Older site rows carry `org` instead of `orgId`.
45
+ assert.deepEqual(siteModulesForOrg({ org: "org-client", metadata: { modules: ["a"] } }, "org-client"), ["a"]);
46
+ // A site with no recorded owner does not narrow an org's role; no site, nothing.
47
+ assert.equal(siteModulesForOrg({ metadata: { modules: ["a"] } }, "org-client"), undefined);
48
+ assert.equal(siteModulesForOrg(null, "org-client"), undefined);
49
+ // A role with NO organisation (role-v2 allows it) is still limited by the
50
+ // site's own list, exactly as before - leaving `org` out must not widen.
51
+ assert.deepEqual(siteModulesForOrg(site, ""), ["visitor-mgmt"]);
52
+ assert.deepEqual(siteModulesForOrg(site, undefined), ["visitor-mgmt"]);
53
+ });
54
+
55
+ test("moduleCeiling passes the site list through the owner check", () => {
56
+ const src = readFileSync("src/utils/module-ceiling.util.ts", "utf8");
57
+ assert.match(src, /effectiveSiteModules\(\s*\(orgDoc as any\)\?\.modules,\s*siteModulesForOrg\(siteDoc, orgId\),\s*\)/);
58
+ });
37
59
  import { ALWAYS_ALLOWED } from "./.build/utils/org-modules.util.mjs";
38
60
 
39
61
  /* ── reading: it must never return "nothing" ───────────────────────────── */