@7365admin1/core 3.65.0 → 3.65.2

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.65.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fcd2f1e: `GET /api/members/users/:id` no longer shows anybody's memberships to any signed-in account. The person and Seven365 staff still get the full list; anyone else gets only the memberships in organisations they belong to, were invited to or own (an empty list, not an error, when there are none).
8
+
9
+ ## 3.65.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 69714b4: 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.
14
+
3
15
  ## 3.65.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.js CHANGED
@@ -11758,6 +11758,13 @@ function effectiveSiteModules(orgModules, siteModules) {
11758
11758
  const allowed = site.filter((key) => org.includes(key));
11759
11759
  return allowed.length ? allowed : org;
11760
11760
  }
11761
+ function siteModulesForOrg(site, orgId) {
11762
+ const org = orgId?.toString() ?? "";
11763
+ if (!org)
11764
+ return site?.metadata?.modules;
11765
+ const owner = String(site?.orgId ?? site?.org ?? "");
11766
+ return owner && owner === org ? site?.metadata?.modules : void 0;
11767
+ }
11761
11768
  function rejectedSiteModules(orgModules, requested) {
11762
11769
  if (!narrows(orgModules))
11763
11770
  return [];
@@ -21037,7 +21044,7 @@ async function moduleCeiling(org, site) {
21037
21044
  ]);
21038
21045
  return effectiveSiteModules(
21039
21046
  orgDoc?.modules,
21040
- siteDoc?.metadata?.modules
21047
+ siteModulesForOrg(siteDoc, orgId)
21041
21048
  );
21042
21049
  } catch {
21043
21050
  return [];
@@ -28771,6 +28778,31 @@ async function requireMemberOrg(req, org) {
28771
28778
  }
28772
28779
  await requireOrgAccess(req, orgId);
28773
28780
  }
28781
+ async function membershipsInReach(req, items) {
28782
+ const warn = (error) => {
28783
+ import_node_server_utils65.logger.log({ level: "warn", message: `members/users reach check: ${error?.message}` });
28784
+ return false;
28785
+ };
28786
+ if (!await callerAccountApproved(callerId(req)).catch(warn)) {
28787
+ return { items: [], total: 0 };
28788
+ }
28789
+ const orgs = new Set(
28790
+ items.map((m) => m?.org?.toString?.() ?? "").filter(Boolean)
28791
+ );
28792
+ const own = new Set(
28793
+ await resolveInviteActor(callerId(req)).then((actor) => actor.orgIds.map(String)).catch((error) => (warn(error), []))
28794
+ );
28795
+ const reached = new Set([...orgs].filter((org) => own.has(org)));
28796
+ for (const org of orgs) {
28797
+ if (reached.has(org))
28798
+ continue;
28799
+ const ok = await requireOrgReach(req, org).then(() => true, () => false);
28800
+ if (ok)
28801
+ reached.add(org);
28802
+ }
28803
+ const kept = items.filter((m) => reached.has(m?.org?.toString?.() ?? ""));
28804
+ return { items: kept, total: kept.length };
28805
+ }
28774
28806
  function memberModulesHandlers({
28775
28807
  requireSelfOrPlatformStaff: requireSelfOrPlatformStaff2,
28776
28808
  gateData
@@ -28874,7 +28906,11 @@ function useMemberController() {
28874
28906
  }
28875
28907
  try {
28876
28908
  const data = await _getAllByUser(userId);
28877
- res.json(data);
28909
+ const whole = await requireSelfOrPlatformStaff(req, userId, {
28910
+ resource: "members",
28911
+ action: "view-members"
28912
+ }).then(() => true, () => false);
28913
+ res.json(whole ? data : await membershipsInReach(req, data.items));
28878
28914
  return;
28879
28915
  } catch (error2) {
28880
28916
  import_node_server_utils65.logger.log({