@7365admin1/core 3.47.1-staging.133 → 3.47.1-staging.134
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/people-read-scope.md +40 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +2265 -2237
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/people-scope.e2e.test.mjs +230 -0
- package/test/people-scope.test.mjs +90 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Scope `GET /api/people` to a site the caller can actually reach.
|
|
6
|
+
|
|
7
|
+
The endpoint returns resident and visitor records — name, NRIC, contact number,
|
|
8
|
+
unit, plate numbers — and filters on NRIC, contact and plate number. It carried
|
|
9
|
+
`requireAuth` and nothing more, and took its `org` and `site` from the query
|
|
10
|
+
string (`person.controller.ts:79-80, 93`). So any signed-in account on the
|
|
11
|
+
platform could page through another estate's residents, or look a person up by
|
|
12
|
+
NRIC across every client at once.
|
|
13
|
+
|
|
14
|
+
The caller is now resolved from the session and the scope decided before
|
|
15
|
+
anything is read:
|
|
16
|
+
|
|
17
|
+
- a named `site` is checked with `entitleSite` — the same site-reach rule the
|
|
18
|
+
camera and HID modules already use: a membership at the site, an org-wide
|
|
19
|
+
membership at the site's owning organisation, or an ACTIVE `customer.sites`
|
|
20
|
+
engagement. Reusing it matters rather than being tidy: an agency contracted to
|
|
21
|
+
an estate holds no membership in that estate's organisation, so an
|
|
22
|
+
org-membership check would have locked every guard out of the site they work
|
|
23
|
+
at. A site the caller cannot reach answers exactly as a site that does not
|
|
24
|
+
exist, so site ids cannot be enumerated.
|
|
25
|
+
- a named `org` is checked against the caller's own memberships.
|
|
26
|
+
- naming neither — the NRIC, contact and plate lookups — is narrowed to the
|
|
27
|
+
caller's own organisations instead of searching the whole platform.
|
|
28
|
+
- Seven365 staff keep cross-tenant reach, unchanged.
|
|
29
|
+
|
|
30
|
+
Every live caller passes a site: `layer-common` `VisitorForm.vue`,
|
|
31
|
+
`MemberInformation.vue` and `VehicleForm.vue` all pass the site the screen is
|
|
32
|
+
open on, and the People list passes org and site from its route. The two
|
|
33
|
+
composable functions that pass neither — `usePeople().findPersonByContact` and
|
|
34
|
+
`findUsersByPlateNumber` — have no caller in any repository.
|
|
35
|
+
|
|
36
|
+
`person.repo.getAll` gains an optional `orgs` filter for the last case. It
|
|
37
|
+
applies only when no explicit `org` was given, so it cannot fight one, and its
|
|
38
|
+
absence means "no restriction", which is what staff get.
|
|
39
|
+
|
|
40
|
+
No response shape, status code or field changed for a permitted caller.
|
package/dist/index.d.ts
CHANGED
|
@@ -4570,7 +4570,7 @@ declare function useGuestManagementController(): {
|
|
|
4570
4570
|
declare const site_people_namespace_collection = "site.people";
|
|
4571
4571
|
declare function usePersonRepo(): {
|
|
4572
4572
|
add: (value: TPerson, session?: ClientSession) => Promise<ObjectId>;
|
|
4573
|
-
getAll: ({ search, page, limit, sort, status, dateFrom, dateTo, org, site, type, nric, contact, plateNumber, }: {
|
|
4573
|
+
getAll: ({ search, page, limit, sort, status, dateFrom, dateTo, org, orgs, site, type, nric, contact, plateNumber, }: {
|
|
4574
4574
|
search?: string | undefined;
|
|
4575
4575
|
page?: number | undefined;
|
|
4576
4576
|
limit?: number | undefined;
|
|
@@ -4579,6 +4579,13 @@ declare function usePersonRepo(): {
|
|
|
4579
4579
|
dateFrom?: string | undefined;
|
|
4580
4580
|
dateTo?: string | undefined;
|
|
4581
4581
|
org?: string | undefined;
|
|
4582
|
+
/**
|
|
4583
|
+
* The organisations the CALLER may see, when they have named neither an
|
|
4584
|
+
* organisation nor a site. Resolved from the session by the controller,
|
|
4585
|
+
* never from the request. Absent means "no restriction" — which is what
|
|
4586
|
+
* Seven365 staff get.
|
|
4587
|
+
*/
|
|
4588
|
+
orgs?: string[] | undefined;
|
|
4582
4589
|
site?: string | undefined;
|
|
4583
4590
|
type?: string | undefined;
|
|
4584
4591
|
nric?: string | undefined;
|