@7365admin1/core 3.99.1-staging.385 → 3.99.1-staging.386
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/hid-sip-account-list-site-scope.md +23 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Scope the HID SIP account list to the site alone.
|
|
6
|
+
|
|
7
|
+
`GET /sites/:siteId/intercom/sip-accounts` required an `orgId` query parameter
|
|
8
|
+
and filtered the accounts by it. That organisation never decided access — the
|
|
9
|
+
handler's `authorizeSite` resolves the caller's right to the site from their
|
|
10
|
+
own memberships — so all `orgId` did was narrow the rows, and it did so wrongly
|
|
11
|
+
in two places:
|
|
12
|
+
|
|
13
|
+
- a screen mounted without an organisation in scope could not call the endpoint
|
|
14
|
+
at all, leaving the intercom contact dialog with an empty name picker;
|
|
15
|
+
- on a customer site, accounts provisioned by a managing agent carry that
|
|
16
|
+
agent's `orgId`, so the site's own operators could not see them — although
|
|
17
|
+
the door station behind the contact list rings those people regardless.
|
|
18
|
+
|
|
19
|
+
`listSipAccounts` now takes only `siteId`, both in the service and the
|
|
20
|
+
repository, and the controller no longer validates the query. An older client
|
|
21
|
+
that still sends `orgId` is ignored rather than refused, so the endpoint stays
|
|
22
|
+
backward compatible. `ensureSipAccount` is unchanged: it provisions an account
|
|
23
|
+
and still records the organisation it was created under.
|
package/dist/index.d.ts
CHANGED
|
@@ -17140,7 +17140,7 @@ declare function useHidAmicoRepo(): {
|
|
|
17140
17140
|
pageRange: string;
|
|
17141
17141
|
}>;
|
|
17142
17142
|
getSipAccount: (orgIdValue: string | ObjectId, siteValue: string | ObjectId, userValue: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
|
|
17143
|
-
listSipAccounts: (
|
|
17143
|
+
listSipAccounts: (siteValue: string | ObjectId) => Promise<{
|
|
17144
17144
|
_id: string;
|
|
17145
17145
|
userId: string;
|
|
17146
17146
|
name: string;
|
|
@@ -17870,7 +17870,7 @@ declare function useHidAmicoService(): {
|
|
|
17870
17870
|
status: "active" | "failed" | "disabled" | "provisioning" | undefined;
|
|
17871
17871
|
provisionedAt: string | Date;
|
|
17872
17872
|
}>;
|
|
17873
|
-
listSipAccounts: (
|
|
17873
|
+
listSipAccounts: (siteId: string) => Promise<{
|
|
17874
17874
|
_id: string;
|
|
17875
17875
|
userId: string;
|
|
17876
17876
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -49404,10 +49404,9 @@ function useHidAmicoRepo() {
|
|
|
49404
49404
|
}
|
|
49405
49405
|
return labels;
|
|
49406
49406
|
}
|
|
49407
|
-
async function listSipAccounts(
|
|
49407
|
+
async function listSipAccounts(siteValue) {
|
|
49408
49408
|
const siteId = toId4(siteValue, "site ID");
|
|
49409
49409
|
const accounts = await sipAccounts().find({
|
|
49410
|
-
orgId: toId4(orgIdValue, "organization ID"),
|
|
49411
49410
|
site: siteId,
|
|
49412
49411
|
status: { $ne: "disabled" }
|
|
49413
49412
|
}, {
|
|
@@ -55432,9 +55431,8 @@ function useHidAmicoService() {
|
|
|
55432
55431
|
}
|
|
55433
55432
|
return sipAccountResponse(account);
|
|
55434
55433
|
}
|
|
55435
|
-
async function listSipAccounts(
|
|
55436
|
-
|
|
55437
|
-
return repo.listSipAccounts(orgId, siteId);
|
|
55434
|
+
async function listSipAccounts(siteId) {
|
|
55435
|
+
return repo.listSipAccounts(siteId);
|
|
55438
55436
|
}
|
|
55439
55437
|
return {
|
|
55440
55438
|
authorizeReader,
|
|
@@ -101906,15 +101904,14 @@ function useHidAmicoController() {
|
|
|
101906
101904
|
}
|
|
101907
101905
|
async function listSipAccounts(req, res, next) {
|
|
101908
101906
|
const params = schemaHidAmicoSiteIdParams.validate(req.params);
|
|
101909
|
-
|
|
101910
|
-
|
|
101911
|
-
next(new import_node_server_utils316.BadRequestError(params.error?.message || query2.error?.message));
|
|
101907
|
+
if (params.error) {
|
|
101908
|
+
next(new import_node_server_utils316.BadRequestError(params.error.message));
|
|
101912
101909
|
return;
|
|
101913
101910
|
}
|
|
101914
101911
|
try {
|
|
101915
101912
|
await authorizeSite(req, params.value.siteId);
|
|
101916
101913
|
res.json({
|
|
101917
|
-
data: await service.listSipAccounts(
|
|
101914
|
+
data: await service.listSipAccounts(params.value.siteId)
|
|
101918
101915
|
});
|
|
101919
101916
|
} catch (error) {
|
|
101920
101917
|
next(error);
|