@7365admin1/core 3.65.1 → 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 +6 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/console-permission.test.mjs +3 -2
- package/test/e2e/member-by-user-reach.e2e.test.mjs +135 -0
- package/test/resident-ownership-scope.test.mjs +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 3.65.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -28778,6 +28778,31 @@ async function requireMemberOrg(req, org) {
|
|
|
28778
28778
|
}
|
|
28779
28779
|
await requireOrgAccess(req, orgId);
|
|
28780
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
|
+
}
|
|
28781
28806
|
function memberModulesHandlers({
|
|
28782
28807
|
requireSelfOrPlatformStaff: requireSelfOrPlatformStaff2,
|
|
28783
28808
|
gateData
|
|
@@ -28881,7 +28906,11 @@ function useMemberController() {
|
|
|
28881
28906
|
}
|
|
28882
28907
|
try {
|
|
28883
28908
|
const data = await _getAllByUser(userId);
|
|
28884
|
-
|
|
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));
|
|
28885
28914
|
return;
|
|
28886
28915
|
} catch (error2) {
|
|
28887
28916
|
import_node_server_utils65.logger.log({
|