@7365admin1/core 3.64.3-staging.287 → 3.64.3-staging.288
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Use the organisation the app asks for when loading a user's membership.
|
|
6
|
+
|
|
7
|
+
Every mobile app loads its user's role through
|
|
8
|
+
`GET /api/members/user/:id/app/:type?org=<org>`, and `getByUserIdType` ignored
|
|
9
|
+
`org`, answering with the first membership of that app type it found. A person
|
|
10
|
+
in more than one organisation could therefore be handed another organisation's
|
|
11
|
+
membership in the app they were using.
|
|
12
|
+
|
|
13
|
+
It now prefers a LIVE membership in the requested organisation. When there is
|
|
14
|
+
none there (or only a removed one), or no valid `org` is sent, it answers exactly
|
|
15
|
+
as before, so no caller that received a membership now receives "not found", and
|
|
16
|
+
a removed membership never wins over a live one. Login and the other internal
|
|
17
|
+
uses of the repository lookup are unchanged.
|
package/dist/index.js
CHANGED
|
@@ -27949,9 +27949,12 @@ function useMemberController() {
|
|
|
27949
27949
|
}
|
|
27950
27950
|
const user = req.params.id;
|
|
27951
27951
|
const type = req.params.type;
|
|
27952
|
+
const org = typeof req.query.org === "string" && /^[0-9a-fA-F]{24}$/.test(req.query.org) ? req.query.org : "";
|
|
27952
27953
|
try {
|
|
27953
27954
|
await requireSelfOrPlatformStaff(req, user, { resource: "members", action: "view-members" });
|
|
27954
|
-
const
|
|
27955
|
+
const inOrg = org ? await _getByUserIdTypeOrg(user, type, org).catch(() => null) : null;
|
|
27956
|
+
const liveInOrg = inOrg && inOrg.status !== "deleted" && !inOrg.deletedAt ? inOrg : null;
|
|
27957
|
+
const data = liveInOrg ?? await _getByUserIdType(user, type);
|
|
27955
27958
|
res.json(data);
|
|
27956
27959
|
return;
|
|
27957
27960
|
} catch (error2) {
|