@7365admin1/core 3.64.5-staging.298 → 3.64.5-staging.299
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/.changeset/module-ceiling-site-owner.md +5 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/site-modules.test.mjs +22 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Role writes: a site's own module list narrows a role only when the site belongs to the role's organisation. A service provider's role at a client's site is no longer refused modules the client switched off for that site — matching what the role editor now offers.
|
package/dist/index.js
CHANGED
|
@@ -11769,6 +11769,13 @@ function effectiveSiteModules(orgModules, siteModules) {
|
|
|
11769
11769
|
const allowed = site.filter((key) => org.includes(key));
|
|
11770
11770
|
return allowed.length ? allowed : org;
|
|
11771
11771
|
}
|
|
11772
|
+
function siteModulesForOrg(site, orgId) {
|
|
11773
|
+
const org = orgId?.toString() ?? "";
|
|
11774
|
+
if (!org)
|
|
11775
|
+
return site?.metadata?.modules;
|
|
11776
|
+
const owner = String(site?.orgId ?? site?.org ?? "");
|
|
11777
|
+
return owner && owner === org ? site?.metadata?.modules : void 0;
|
|
11778
|
+
}
|
|
11772
11779
|
function rejectedSiteModules(orgModules, requested) {
|
|
11773
11780
|
if (!narrows(orgModules))
|
|
11774
11781
|
return [];
|
|
@@ -21229,7 +21236,7 @@ async function moduleCeiling(org, site) {
|
|
|
21229
21236
|
]);
|
|
21230
21237
|
return effectiveSiteModules(
|
|
21231
21238
|
orgDoc?.modules,
|
|
21232
|
-
siteDoc
|
|
21239
|
+
siteModulesForOrg(siteDoc, orgId)
|
|
21233
21240
|
);
|
|
21234
21241
|
} catch {
|
|
21235
21242
|
return [];
|