@7365admin1/layer-common 4.90.2-staging.490 → 4.90.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 +10 -4
- package/assets/css/primitives.css +0 -57
- package/assets/css/screens.css +4 -8
- package/components/AccessCardDetailsDialog.vue +6 -59
- package/components/AccessCardPreviewDialog.vue +53 -371
- package/components/AppSelect.vue +4 -143
- package/components/BuildingUnitFormEdit.vue +0 -6
- package/components/Dialog/UpdateMoreAction.vue +1 -11
- package/components/DocumentForm.vue +112 -407
- package/components/DocumentManagement.vue +12 -213
- package/components/Facility/BookingSetup.vue +0 -63
- package/components/HidAccessLogDashboard.vue +17 -74
- package/components/HidIntercomManagement.vue +14 -183
- package/components/HidQrCodeConfiguration.vue +195 -17
- package/components/HidReaderManagement.vue +0 -398
- package/components/HidReaderUserRoster.vue +3 -44
- package/components/HidUserEnrollment.vue +292 -2255
- package/components/InvitationClientForm.vue +1 -19
- package/components/InvitationForm.vue +4 -31
- package/components/InvitationMain.vue +22 -124
- package/components/MemberInformation.vue +4 -4
- package/components/PassInformation.vue +2 -2
- package/components/SiteSettings.vue +0 -48
- package/components/TableMain.vue +7 -22
- package/components/VehicleManagement.vue +5 -80
- package/components/VisitorForm.vue +19 -65
- package/components/VisitorManagement.vue +5 -267
- package/composables/useAccessManagement.ts +1 -17
- package/composables/useDocument.ts +0 -7
- package/composables/useFacility.ts +0 -11
- package/composables/useHidAmico.ts +0 -165
- package/composables/useHidNavigation.ts +1 -25
- package/composables/useMember.ts +0 -12
- package/composables/useNFCPatrolReportFilters.ts +3 -21
- package/composables/useNFCPatrolRoute.ts +1 -8
- package/composables/usePeople.ts +0 -19
- package/composables/useServiceProvider.ts +2 -45
- package/composables/useSettingsPermission.ts +0 -14
- package/composables/useUser.ts +2 -6
- package/composables/useVehicle.ts +1 -40
- package/composables/useVerification.ts +0 -3
- package/middleware/01.auth.ts +7 -3
- package/package.json +1 -1
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/types/document.d.ts +0 -14
- package/types/facility.d.ts +0 -4
- package/types/member.d.ts +0 -4
- package/types/people.d.ts +1 -28
- package/types/service-provider.d.ts +0 -5
- package/types/site.d.ts +1 -7
- package/components/BuildingUnitManagement.vue +0 -298
- package/components/HidAccessPermissions.vue +0 -424
- package/components/HidProfileQrCode.vue +0 -332
- package/components/VehicleQrStickerDialog.vue +0 -249
- package/composables/useHidReaderSelection.ts +0 -50
- package/composables/useSiteCategory.ts +0 -45
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
- package/utils/hid-enrolment-subject.ts +0 -344
- package/utils/hid-permission-assignments.ts +0 -198
- package/utils/hid-reader-selection.ts +0 -52
- package/utils/invite-group.ts +0 -61
- package/utils/invite-sites.ts +0 -25
- package/utils/occupancy-role.ts +0 -109
- package/utils/service-type.ts +0 -30
- package/utils/vehicle-qr-sticker.ts +0 -184
|
@@ -28,22 +28,6 @@ export type HidReaderPayload = {
|
|
|
28
28
|
lastCallbackType?: string;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export type HidProfileQr = {
|
|
32
|
-
readerId: string;
|
|
33
|
-
userId: string;
|
|
34
|
-
memberId: string;
|
|
35
|
-
hidUserId: string;
|
|
36
|
-
registration: string;
|
|
37
|
-
readerName: string;
|
|
38
|
-
portalName: string;
|
|
39
|
-
qrEnabled: boolean;
|
|
40
|
-
issued: boolean;
|
|
41
|
-
qrValue: string;
|
|
42
|
-
issuedAt: string;
|
|
43
|
-
/** null when the permission lookup itself failed, so "unknown" stays distinct from "no". */
|
|
44
|
-
assigned: boolean | null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
31
|
type HidIdentityPayload = {
|
|
48
32
|
site?: string;
|
|
49
33
|
hidUserId?: string | number;
|
|
@@ -155,28 +139,6 @@ export type HidSipAccountData = {
|
|
|
155
139
|
provisionedAt: string;
|
|
156
140
|
};
|
|
157
141
|
|
|
158
|
-
/** One row of the site's SIP account list - who owns the extension, never its password. */
|
|
159
|
-
export type HidSipAccountListItem = {
|
|
160
|
-
_id: string;
|
|
161
|
-
userId: string;
|
|
162
|
-
name: string;
|
|
163
|
-
email: string;
|
|
164
|
-
/**
|
|
165
|
-
* What the owner is called after their name on the contact list: their
|
|
166
|
-
* "Blk 1/Level 1/Unit 1" when they live here, and their membership type -
|
|
167
|
-
* "Security Agency" - when they do not. "" only when the site knows neither.
|
|
168
|
-
*
|
|
169
|
-
* Optional because an API still on the `@7365admin1/core` release that
|
|
170
|
-
* predates it answers without the field; the contact picker falls back to the
|
|
171
|
-
* bare name rather than showing a dangling separator.
|
|
172
|
-
*/
|
|
173
|
-
unitLabel?: string;
|
|
174
|
-
extension: string;
|
|
175
|
-
username: string;
|
|
176
|
-
status: string;
|
|
177
|
-
provisionedAt: string;
|
|
178
|
-
};
|
|
179
|
-
|
|
180
142
|
/**
|
|
181
143
|
* True only for the specific validation error an API that predates core #1878
|
|
182
144
|
* returns when the discover body carries `site`. Deliberately narrow: after
|
|
@@ -204,36 +166,6 @@ export default function useHidAmico() {
|
|
|
204
166
|
});
|
|
205
167
|
}
|
|
206
168
|
|
|
207
|
-
/**
|
|
208
|
-
* The signed-in member's own QR code on one reader.
|
|
209
|
-
*
|
|
210
|
-
* No user id in the path: the server takes the caller from the session, so
|
|
211
|
-
* these cannot be pointed at somebody else. `assigned` in the response says
|
|
212
|
-
* whether the HID permissions screen actually admits this member to the
|
|
213
|
-
* reader - issuing a code does not grant access, and the screen has to be
|
|
214
|
-
* able to say so.
|
|
215
|
-
*/
|
|
216
|
-
function getProfileQr(readerId: string) {
|
|
217
|
-
return useNuxtApp().$api<{ data: HidProfileQr }>(
|
|
218
|
-
`${basePath}/readers/${readerId}/profile-qr`,
|
|
219
|
-
{ method: "GET" },
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function issueProfileQr(readerId: string) {
|
|
224
|
-
return useNuxtApp().$api<{ data: HidProfileQr }>(
|
|
225
|
-
`${basePath}/readers/${readerId}/profile-qr`,
|
|
226
|
-
{ method: "POST" },
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function deleteProfileQr(readerId: string) {
|
|
231
|
-
return useNuxtApp().$api<{ data: HidProfileQr }>(
|
|
232
|
-
`${basePath}/readers/${readerId}/profile-qr`,
|
|
233
|
-
{ method: "DELETE" },
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
169
|
function createReader(payload: HidReaderPayload) {
|
|
238
170
|
return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers`, {
|
|
239
171
|
method: "POST",
|
|
@@ -325,36 +257,6 @@ export default function useHidAmico() {
|
|
|
325
257
|
});
|
|
326
258
|
}
|
|
327
259
|
|
|
328
|
-
/**
|
|
329
|
-
* Which credentials a reader accepts at the door.
|
|
330
|
-
*
|
|
331
|
-
* Separate from `setReaderConfiguration` on purpose. That one is the generic
|
|
332
|
-
* configuration endpoint, gated by an allowlist of writable objects; this is
|
|
333
|
-
* a dedicated route that validates the four methods against the reader's own
|
|
334
|
-
* `capabilities` and confirms the write by reading the device back, so a
|
|
335
|
-
* refusal here names the credential the hardware would not take.
|
|
336
|
-
*/
|
|
337
|
-
function setReaderIdentificationMethods(readerId: string, payload: HidApiRecord) {
|
|
338
|
-
return useNuxtApp().$api<HidApiRecord>(
|
|
339
|
-
`${basePath}/readers/${readerId}/identification-methods`,
|
|
340
|
-
{ method: "PUT", body: payload },
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Put a reader back to the settings iService holds for it.
|
|
346
|
-
*
|
|
347
|
-
* A POST rather than a GET because it WRITES: reading the reader's
|
|
348
|
-
* configuration is only the first half, and anything that drifted is
|
|
349
|
-
* re-applied before this returns.
|
|
350
|
-
*/
|
|
351
|
-
function reconcileReaderIdentificationMethods(readerId: string) {
|
|
352
|
-
return useNuxtApp().$api<HidApiRecord>(
|
|
353
|
-
`${basePath}/readers/${readerId}/identification-methods/reconcile`,
|
|
354
|
-
{ method: "POST" },
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
260
|
function getIdentities(readerId: string, query: HidApiRecord = {}) {
|
|
359
261
|
return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers/${readerId}/identities`, {
|
|
360
262
|
method: "GET",
|
|
@@ -512,27 +414,6 @@ export default function useHidAmico() {
|
|
|
512
414
|
);
|
|
513
415
|
}
|
|
514
416
|
|
|
515
|
-
function getUserPasswordStatus(readerId: string, hidUserId: string | number) {
|
|
516
|
-
return useNuxtApp().$api<HidApiRecord>(
|
|
517
|
-
`${basePath}/readers/${readerId}/users/${hidUserId}/password`,
|
|
518
|
-
{ method: "GET" },
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
function setUserPassword(readerId: string, hidUserId: string | number, password: string) {
|
|
523
|
-
return useNuxtApp().$api<HidApiRecord>(
|
|
524
|
-
`${basePath}/readers/${readerId}/users/${hidUserId}/password`,
|
|
525
|
-
{ method: "PUT", body: { password } },
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
function deleteUserPassword(readerId: string, hidUserId: string | number) {
|
|
530
|
-
return useNuxtApp().$api<HidApiRecord>(
|
|
531
|
-
`${basePath}/readers/${readerId}/users/${hidUserId}/password`,
|
|
532
|
-
{ method: "DELETE" },
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
417
|
function deleteUserPin(readerId: string, hidUserId: string | number) {
|
|
537
418
|
return useNuxtApp().$api<{ data: { pinEnrolled: boolean } }>(
|
|
538
419
|
`${basePath}/readers/${readerId}/users/${hidUserId}/pin`,
|
|
@@ -593,42 +474,6 @@ export default function useHidAmico() {
|
|
|
593
474
|
);
|
|
594
475
|
}
|
|
595
476
|
|
|
596
|
-
/**
|
|
597
|
-
* The site's SIP accounts for the intercom contact picker. Site-scoped only:
|
|
598
|
-
* the organisation never decided who may read this — the site guard does —
|
|
599
|
-
* and sending one narrowed the list on a customer site whose accounts were
|
|
600
|
-
* provisioned by a managing agent.
|
|
601
|
-
*/
|
|
602
|
-
function getSipAccounts(siteId: string) {
|
|
603
|
-
return useNuxtApp().$api<{ data: HidSipAccountListItem[] }>(
|
|
604
|
-
`${basePath}/sites/${siteId}/intercom/sip-accounts`,
|
|
605
|
-
{ method: "GET" },
|
|
606
|
-
);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Wake the resident's phone for a call the web phone has just placed.
|
|
611
|
-
*
|
|
612
|
-
* The SIP INVITE is the call and travels over the WebSocket, not through the
|
|
613
|
-
* API; this only rings the resident's mobile so somebody is there to answer
|
|
614
|
-
* it. It is therefore fired after the INVITE and never awaited in a way that
|
|
615
|
-
* could fail the call — see `startWebCall` in `HidIntercomManagement.vue`.
|
|
616
|
-
*
|
|
617
|
-
* `notified: false` with a reason is a normal response, not an error: staff
|
|
618
|
-
* extensions and external SIP addresses have no resident behind them.
|
|
619
|
-
*/
|
|
620
|
-
function notifyIntercomCall(
|
|
621
|
-
siteId: string,
|
|
622
|
-
payload: { orgId: string; destination: string; callId: string; readerId?: string },
|
|
623
|
-
) {
|
|
624
|
-
return useNuxtApp().$api<{
|
|
625
|
-
data: { notified: boolean; delivered?: number; reason?: string };
|
|
626
|
-
}>(
|
|
627
|
-
`${basePath}/sites/${siteId}/intercom/notify-call`,
|
|
628
|
-
{ method: "POST", body: payload },
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
477
|
function getPermissionCandidates(
|
|
633
478
|
siteId: string,
|
|
634
479
|
query: {
|
|
@@ -660,9 +505,6 @@ export default function useHidAmico() {
|
|
|
660
505
|
|
|
661
506
|
return {
|
|
662
507
|
getReaders,
|
|
663
|
-
getProfileQr,
|
|
664
|
-
issueProfileQr,
|
|
665
|
-
deleteProfileQr,
|
|
666
508
|
discoverReader,
|
|
667
509
|
createReader,
|
|
668
510
|
updateReader,
|
|
@@ -677,8 +519,6 @@ export default function useHidAmico() {
|
|
|
677
519
|
issueVisitorQr,
|
|
678
520
|
getReaderConfiguration,
|
|
679
521
|
setReaderConfiguration,
|
|
680
|
-
setReaderIdentificationMethods,
|
|
681
|
-
reconcileReaderIdentificationMethods,
|
|
682
522
|
getLogs,
|
|
683
523
|
setUserImage,
|
|
684
524
|
deleteUserImage,
|
|
@@ -690,9 +530,6 @@ export default function useHidAmico() {
|
|
|
690
530
|
getUserPinStatus,
|
|
691
531
|
setUserPin,
|
|
692
532
|
deleteUserPin,
|
|
693
|
-
getUserPasswordStatus,
|
|
694
|
-
setUserPassword,
|
|
695
|
-
deleteUserPassword,
|
|
696
533
|
getIdentities,
|
|
697
534
|
getReaderUsers,
|
|
698
535
|
getReaderAccessLogs,
|
|
@@ -703,8 +540,6 @@ export default function useHidAmico() {
|
|
|
703
540
|
makeIntercomCall,
|
|
704
541
|
finalizeIntercomCall,
|
|
705
542
|
ensureSipAccount,
|
|
706
|
-
getSipAccounts,
|
|
707
|
-
notifyIntercomCall,
|
|
708
543
|
getSitePermissions,
|
|
709
544
|
getPermissionCandidates,
|
|
710
545
|
updateSitePermissions,
|
|
@@ -46,33 +46,9 @@ export default function useHidNavigation() {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
// "HID Reader Users" now points at `access-mgmt/administrator`, not at
|
|
50
|
-
// `access-mgmt/hid-users`.
|
|
51
|
-
//
|
|
52
|
-
// Both routes mount a roster of the reader's users, but only this one
|
|
53
|
-
// can act on them. `administrator` renders HidUserEnrollment WITHOUT
|
|
54
|
-
// `card-management`, and that prop is what gates the Enroll action:
|
|
55
|
-
// <template v-if="!props.cardManagement" #actions>
|
|
56
|
-
// `hid-users` renders HidReaderUserRoster, which is read-only apart
|
|
57
|
-
// from PIN management. So the menu entry with this name used to lead
|
|
58
|
-
// to the screen that cannot enrol, while the screen that can was
|
|
59
|
-
// reachable only by typing the URL.
|
|
60
|
-
//
|
|
61
|
-
// `hid-users` is left in place and simply unlisted - the same state
|
|
62
|
-
// `administrator` was in - so any existing link to it still resolves.
|
|
63
49
|
title: "HID Reader Users",
|
|
64
50
|
route: {
|
|
65
|
-
name: "org-site-access-mgmt-
|
|
66
|
-
params: { org, site },
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
// The signed-in member's own pass, not somebody else's. Every other
|
|
71
|
-
// entry in this group acts on a resident or a visitor; this one has
|
|
72
|
-
// no subject but the caller.
|
|
73
|
-
title: "HID QR Code",
|
|
74
|
-
route: {
|
|
75
|
-
name: "org-site-access-mgmt-hid-qr-code",
|
|
51
|
+
name: "org-site-access-mgmt-hid-users",
|
|
76
52
|
params: { org, site },
|
|
77
53
|
},
|
|
78
54
|
},
|
package/composables/useMember.ts
CHANGED
|
@@ -70,8 +70,6 @@ export default function useMember() {
|
|
|
70
70
|
status = "active",
|
|
71
71
|
siteId = "",
|
|
72
72
|
roleState = "",
|
|
73
|
-
/** A building unit id, or "none": members on no unit yet. */
|
|
74
|
-
unit = "",
|
|
75
73
|
people = false,
|
|
76
74
|
} = {}) {
|
|
77
75
|
const query: Record<string, any> = { page, limit, type, status };
|
|
@@ -85,7 +83,6 @@ export default function useMember() {
|
|
|
85
83
|
if (user) query.user = user;
|
|
86
84
|
if (org) query.org = org;
|
|
87
85
|
if (siteId) query.siteId = siteId;
|
|
88
|
-
if (unit) query.unit = unit;
|
|
89
86
|
return useNuxtApp().$api<Record<string, any>>("/api/members", {
|
|
90
87
|
method: "GET",
|
|
91
88
|
query,
|
|
@@ -161,14 +158,6 @@ export default function useMember() {
|
|
|
161
158
|
});
|
|
162
159
|
}
|
|
163
160
|
|
|
164
|
-
/** Attach a member to a building unit, or detach them (`unit` ""). */
|
|
165
|
-
function updateMemberUnit(id: string, unit: string) {
|
|
166
|
-
return useNuxtApp().$api<Record<string, any>>("/api/members/unit", {
|
|
167
|
-
method: "PUT",
|
|
168
|
-
body: { id, unit },
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
161
|
function getByUserTypeOrg(user: string, type: string, org: string) {
|
|
173
162
|
return useNuxtApp().$api<TMember>(
|
|
174
163
|
`/api/members/user/${user}/app/${type}/org`,
|
|
@@ -237,7 +226,6 @@ export default function useMember() {
|
|
|
237
226
|
undoCrossSiteRoleFix,
|
|
238
227
|
getSiteAccess,
|
|
239
228
|
saveSiteAccess,
|
|
240
|
-
updateMemberUnit,
|
|
241
229
|
members,
|
|
242
230
|
member,
|
|
243
231
|
page,
|
|
@@ -31,27 +31,9 @@ export function useNFCPatrolReportFilters(site: string) {
|
|
|
31
31
|
loading.value = true;
|
|
32
32
|
|
|
33
33
|
try {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const response = await getPatrolRoutes({
|
|
38
|
-
site,
|
|
39
|
-
page: 1,
|
|
40
|
-
limit: 100,
|
|
41
|
-
includeDeleted: true,
|
|
42
|
-
}).catch((error: any) => {
|
|
43
|
-
const status = Number(error?.statusCode ?? error?.response?.status ?? 0);
|
|
44
|
-
if (status !== 400) throw error;
|
|
45
|
-
return getPatrolRoutes({ site, page: 1, limit: 100 });
|
|
46
|
-
});
|
|
47
|
-
const items: Array<Record<string, any>> = response.items ?? [];
|
|
48
|
-
const isDeleted = (route: Record<string, any>) => route.status === "Deleted";
|
|
49
|
-
// Routes still in use first, so the report opens on one of them.
|
|
50
|
-
const routes = [
|
|
51
|
-
...items.filter((route) => !isDeleted(route)),
|
|
52
|
-
...items.filter(isDeleted),
|
|
53
|
-
].map((route) => ({
|
|
54
|
-
title: isDeleted(route) ? `${route.name} (deleted)` : route.name,
|
|
34
|
+
const response = await getPatrolRoutes({ site, page: 1, limit: 100 });
|
|
35
|
+
const routes = (response.items ?? []).map((route: Record<string, any>) => ({
|
|
36
|
+
title: route.name,
|
|
55
37
|
value: route._id,
|
|
56
38
|
startTimes: route.startTimes ?? [],
|
|
57
39
|
}));
|
|
@@ -4,24 +4,17 @@ export default function useNFCPatrolRoute() {
|
|
|
4
4
|
limit = 20,
|
|
5
5
|
site = "",
|
|
6
6
|
search = "",
|
|
7
|
-
includeDeleted = false,
|
|
8
7
|
} = {}) {
|
|
9
8
|
const query: Record<string, any> = {
|
|
10
9
|
page,
|
|
11
10
|
limit,
|
|
12
11
|
site,
|
|
13
12
|
};
|
|
14
|
-
|
|
13
|
+
|
|
15
14
|
// Only include search parameter if it has a value
|
|
16
15
|
if (search) {
|
|
17
16
|
query.search = search;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
// Deleted routes are left out unless asked for; only the patrol log
|
|
21
|
-
// report's route picker asks, so their past patrols stay reachable.
|
|
22
|
-
if (includeDeleted) {
|
|
23
|
-
query.includeDeleted = true;
|
|
24
|
-
}
|
|
25
18
|
|
|
26
19
|
return useNuxtApp().$api<Record<string, any>>(`/api/nfc-patrol-route`, {
|
|
27
20
|
method: "GET",
|
package/composables/usePeople.ts
CHANGED
|
@@ -115,24 +115,6 @@ export default function () {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
/**
|
|
119
|
-
* The blocks, levels and units at a site that actually have an occupant.
|
|
120
|
-
* The other half of the unit picker: this narrows the cascade, then
|
|
121
|
-
* `getPeopleByUnit` answers "which person in this unit?".
|
|
122
|
-
*/
|
|
123
|
-
async function getOccupiedStructure(
|
|
124
|
-
site: string,
|
|
125
|
-
{ type = "", status = "active", block = "", level = "" } = {}
|
|
126
|
-
) {
|
|
127
|
-
return await useNuxtApp().$api<Record<string, any>>(
|
|
128
|
-
`/api/people/site/${site}/occupied-structure`,
|
|
129
|
-
{
|
|
130
|
-
method: "GET",
|
|
131
|
-
query: { type, status, block, level },
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
118
|
async function getPeopleByUnit(
|
|
137
119
|
_id: string,
|
|
138
120
|
{ status = "active", type = "" } = {}
|
|
@@ -166,7 +148,6 @@ export default function () {
|
|
|
166
148
|
findPersonByPlateNumberMultipleResult,
|
|
167
149
|
findPersonByContact,
|
|
168
150
|
getPeopleByUnit,
|
|
169
|
-
getOccupiedStructure,
|
|
170
151
|
searchCompanyList,
|
|
171
152
|
findUsersByPlateNumber,
|
|
172
153
|
reviewResidentPerson,
|
|
@@ -15,21 +15,6 @@ export type TSiteProviderMember = {
|
|
|
15
15
|
lastLoginAt?: string | null;
|
|
16
16
|
/** a subcontractor: the provider that brought its company onto the site */
|
|
17
17
|
invitedVia?: string;
|
|
18
|
-
/** The building unit this person is attached to (a unit's Management tab). */
|
|
19
|
-
unit?: string | null;
|
|
20
|
-
unitName?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The person's user account. Anything acting on the PERSON needs this rather
|
|
23
|
-
* than `_id`, which identifies the membership: an access card carries it as
|
|
24
|
-
* `userId`, and HID reader access is bound by it -
|
|
25
|
-
* `resolvePermissionUserBindings` drops every subject without one.
|
|
26
|
-
*
|
|
27
|
-
* Returned from core 3.130. Before that the repository projected it and the
|
|
28
|
-
* service layer dropped it, so against an older API it is absent on every
|
|
29
|
-
* row - `providerAccountsKnown` is how the HID enrolment screen tells the two
|
|
30
|
-
* apart rather than reading an absence as "nobody has an account".
|
|
31
|
-
*/
|
|
32
|
-
user?: string | null;
|
|
33
18
|
};
|
|
34
19
|
|
|
35
20
|
export type TSiteProviderCompany = {
|
|
@@ -105,8 +90,6 @@ export default function useServiceProvider() {
|
|
|
105
90
|
status = "",
|
|
106
91
|
/** "engagements": also providers engaged through an accepted invitation. */
|
|
107
92
|
include = "",
|
|
108
|
-
/** A building unit id, or "none": providers on no unit yet. */
|
|
109
|
-
unit = "",
|
|
110
93
|
} = {}) {
|
|
111
94
|
return useNuxtApp().$api<Record<string, any>>("/api/service-providers", {
|
|
112
95
|
method: "GET",
|
|
@@ -119,7 +102,6 @@ export default function useServiceProvider() {
|
|
|
119
102
|
siteId,
|
|
120
103
|
...(status ? { status } : {}),
|
|
121
104
|
...(include ? { include } : {}),
|
|
122
|
-
...(unit ? { unit } : {}),
|
|
123
105
|
},
|
|
124
106
|
});
|
|
125
107
|
}
|
|
@@ -287,17 +269,6 @@ export default function useServiceProvider() {
|
|
|
287
269
|
);
|
|
288
270
|
}
|
|
289
271
|
|
|
290
|
-
/** Attach a provider to a building unit, or detach it (`unit` ""). */
|
|
291
|
-
async function updateUnit(id: string, unit: string) {
|
|
292
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
293
|
-
`/api/service-providers/${id}/unit`,
|
|
294
|
-
{
|
|
295
|
-
method: "PATCH",
|
|
296
|
-
body: { unit },
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
272
|
async function getByEmail({
|
|
302
273
|
email = "",
|
|
303
274
|
orgId = "",
|
|
@@ -322,29 +293,17 @@ export default function useServiceProvider() {
|
|
|
322
293
|
* Members > Service Providers: the provider people with access to this
|
|
323
294
|
* site, and one entry per provider company with its head count. The
|
|
324
295
|
* site's own organisation only - the server refuses anyone else.
|
|
325
|
-
* `unit`: a building unit id, or "none" (people on no unit yet).
|
|
326
296
|
*/
|
|
327
|
-
function getSiteMembers(siteId: string
|
|
297
|
+
function getSiteMembers(siteId: string): Promise<{
|
|
328
298
|
items: TSiteProviderMember[];
|
|
329
299
|
companies: TSiteProviderCompany[];
|
|
330
300
|
}> {
|
|
331
301
|
return useNuxtApp().$api("/api/service-providers/site-members", {
|
|
332
302
|
method: "GET",
|
|
333
|
-
query: { siteId
|
|
303
|
+
query: { siteId },
|
|
334
304
|
});
|
|
335
305
|
}
|
|
336
306
|
|
|
337
|
-
/** Attach one of those people to a building unit, or detach them (`unit` ""). */
|
|
338
|
-
function updateSiteMemberUnit(id: string, unit: string) {
|
|
339
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
340
|
-
`/api/service-providers/site-members/${id}/unit`,
|
|
341
|
-
{
|
|
342
|
-
method: "PATCH",
|
|
343
|
-
body: { unit },
|
|
344
|
-
}
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
307
|
/** The same list as an Excel file, under the same filters. */
|
|
349
308
|
function exportSiteMembers(
|
|
350
309
|
siteId: string,
|
|
@@ -361,7 +320,6 @@ export default function useServiceProvider() {
|
|
|
361
320
|
|
|
362
321
|
return {
|
|
363
322
|
getSiteMembers,
|
|
364
|
-
updateSiteMemberUnit,
|
|
365
323
|
exportSiteMembers,
|
|
366
324
|
serviceProviders,
|
|
367
325
|
serviceProvider,
|
|
@@ -380,7 +338,6 @@ export default function useServiceProvider() {
|
|
|
380
338
|
add,
|
|
381
339
|
addViaInvite,
|
|
382
340
|
updateStatus,
|
|
383
|
-
updateUnit,
|
|
384
341
|
getByEmail,
|
|
385
342
|
};
|
|
386
343
|
}
|
|
@@ -122,19 +122,6 @@ export function useSettingsPermission() {
|
|
|
122
122
|
);
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
// Vehicle QR stickers switch: whoever may update vehicles (same grant the
|
|
126
|
-
// server checks on PUT /api/vehicles/qr/settings/site/:site).
|
|
127
|
-
const vehiclePermissions: TPermissions = {
|
|
128
|
-
"vehicle-mgmt": {
|
|
129
|
-
"update-vehicle": { check: true, description: "Allows the user to update vehicle details." },
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
const canManageVehicleQr = computed(() => {
|
|
133
|
-
if (!userAppRole.value) return false;
|
|
134
|
-
if (userAppRole.value.permissions.includes("*")) return true;
|
|
135
|
-
return hasPermission(userAppRole.value, vehiclePermissions, "vehicle-mgmt", "update-vehicle");
|
|
136
|
-
});
|
|
137
|
-
|
|
138
125
|
const canManageSiteSettings = computed(() => {
|
|
139
126
|
return canManageSiteInformation.value || canManageANPRCamera.value || canManageCCTVCamera.value || canManageDeliveryCompanies.value || canManageResidentVisitors.value || canManageWorkOrderSettings.value || canManageBillingAndSOAConfiguration.value || canManageNFCManagement.value || canManageNFCPatrolSettings.value || canManageEntryPass.value || canManageRedDotSettings.value
|
|
140
127
|
})
|
|
@@ -151,7 +138,6 @@ export function useSettingsPermission() {
|
|
|
151
138
|
canManageNFCPatrolSettings,
|
|
152
139
|
canManageEntryPass,
|
|
153
140
|
canManageRedDotSettings,
|
|
154
|
-
canManageVehicleQr,
|
|
155
141
|
canManageSiteSettings
|
|
156
142
|
|
|
157
143
|
};
|
package/composables/useUser.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { inviteSitePayload } from "../utils/invite-sites";
|
|
2
|
-
|
|
3
1
|
export default function useUser() {
|
|
4
2
|
function inviteUser({
|
|
5
3
|
email = "",
|
|
@@ -67,10 +65,7 @@ export default function useUser() {
|
|
|
67
65
|
org = "",
|
|
68
66
|
site = "",
|
|
69
67
|
siteName = "",
|
|
70
|
-
sites = [] as string[],
|
|
71
68
|
} = {}) {
|
|
72
|
-
// `sites` = the several chosen sites; the old single `site` still works.
|
|
73
|
-
const chosen = sites.length ? sites : site ? [site] : [];
|
|
74
69
|
return useNuxtApp().$api<Record<string, any>>("/api/auth/invite/member", {
|
|
75
70
|
method: "POST",
|
|
76
71
|
body: {
|
|
@@ -79,7 +74,8 @@ export default function useUser() {
|
|
|
79
74
|
role,
|
|
80
75
|
name,
|
|
81
76
|
org,
|
|
82
|
-
...
|
|
77
|
+
...(site && { siteId: site }),
|
|
78
|
+
...(siteName && { siteName }),
|
|
83
79
|
},
|
|
84
80
|
});
|
|
85
81
|
}
|
|
@@ -272,41 +272,6 @@ function getSpecificVehicleById(id: string){
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
|
|
275
|
-
// Vehicle QR stickers (core vehicle-qr). Per-site switch, bulk sticker data,
|
|
276
|
-
// and re-issue (the old sticker stops working).
|
|
277
|
-
function getVehicleQrSettings(site: string) {
|
|
278
|
-
return useNuxtApp().$api<{ site: string; enabled: boolean }>(
|
|
279
|
-
`/api/vehicles/qr/settings/site/${site}`,
|
|
280
|
-
{ method: "GET" },
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function setVehicleQrSettings(site: string, enabled: boolean) {
|
|
285
|
-
return useNuxtApp().$api<{ site: string; enabled: boolean }>(
|
|
286
|
-
`/api/vehicles/qr/settings/site/${site}`,
|
|
287
|
-
{ method: "PUT", body: { enabled } },
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function getVehicleQrStickers(site: string, vehicleIds: string[]) {
|
|
292
|
-
return useNuxtApp().$api<{
|
|
293
|
-
site: { _id: string; name: string };
|
|
294
|
-
items: Array<Record<string, any>>;
|
|
295
|
-
missing: string[];
|
|
296
|
-
}>("/api/vehicles/qr/stickers", {
|
|
297
|
-
method: "POST",
|
|
298
|
-
body: { site, vehicleIds },
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function regenerateVehicleQr(id: string) {
|
|
303
|
-
return useNuxtApp().$api<{ vehicleId: string; qr: string; token: string }>(
|
|
304
|
-
`/api/vehicles/qr/regenerate/id/${id}`,
|
|
305
|
-
{ method: "PUT" },
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
275
|
return {
|
|
311
276
|
getVehicles,
|
|
312
277
|
addVehicle,
|
|
@@ -325,10 +290,6 @@ function getSpecificVehicleById(id: string){
|
|
|
325
290
|
getActiveCameraCounts,
|
|
326
291
|
syncVehicle,
|
|
327
292
|
searchMultipleVehiclesByUnitId,
|
|
328
|
-
getSpecificVehicleById
|
|
329
|
-
getVehicleQrSettings,
|
|
330
|
-
setVehicleQrSettings,
|
|
331
|
-
getVehicleQrStickers,
|
|
332
|
-
regenerateVehicleQr,
|
|
293
|
+
getSpecificVehicleById
|
|
333
294
|
};
|
|
334
295
|
}
|
|
@@ -11,8 +11,6 @@ export default function useVerification() {
|
|
|
11
11
|
limit = 20,
|
|
12
12
|
// "seven365": only the invitations Seven365 sent (the console's lists).
|
|
13
13
|
origin = "",
|
|
14
|
-
// true: one entry per multi-site invitation group, with its `sites`.
|
|
15
|
-
group = false,
|
|
16
14
|
} = {}): Promise<{
|
|
17
15
|
items: TMiniVerification[];
|
|
18
16
|
pages: number;
|
|
@@ -24,7 +22,6 @@ export default function useVerification() {
|
|
|
24
22
|
status, search, page, type, email, app, siteId, orgId, limit,
|
|
25
23
|
// Sent only when asked for: an older API refuses a key it does not know.
|
|
26
24
|
...(origin && { origin }),
|
|
27
|
-
...(group && { group: "true" }),
|
|
28
25
|
},
|
|
29
26
|
});
|
|
30
27
|
}
|
package/middleware/01.auth.ts
CHANGED
|
@@ -4,9 +4,13 @@ export default defineNuxtRouteMiddleware(async (route) => {
|
|
|
4
4
|
// Get access token from cookies
|
|
5
5
|
const sid = useCookie("sid", cookieConfig).value;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const serviceProviderEmail = (route.query.email as string) ?? "";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if (serviceProviderEmail) {
|
|
11
|
+
useCookie("service-provider-email", cookieConfig).value =
|
|
12
|
+
serviceProviderEmail;
|
|
13
|
+
}
|
|
10
14
|
|
|
11
15
|
if (!sid) {
|
|
12
16
|
// Redirect to login page if no access token
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.90.2
|
|
5
|
+
"version": "4.90.2",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:org="orgId"
|
|
6
6
|
message="Enable HID as a service for this site before managing physical HID cards."
|
|
7
7
|
>
|
|
8
|
-
<HidUserEnrollment :site="siteId"
|
|
8
|
+
<HidUserEnrollment :site="siteId" card-management />
|
|
9
9
|
</HidEnabledGate>
|
|
10
10
|
</v-container>
|
|
11
11
|
</template>
|