@7365admin1/layer-common 4.185.1 → 4.185.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 +11 -4
- package/components/HidUserEnrollment.vue +67 -9
- package/composables/useHidAmico.ts +18 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.185.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a1d99d6: HID Reader Users: link an Unmapped user to the person it is from Edit (record only, nothing sent to the reader), so their access shows in their Service365 app.
|
|
8
|
+
- 62dbba1: HID Reader Users: warn on edit and on save that a user linked to nobody in iService365 will not show in their Service365 app.
|
|
9
|
+
|
|
3
10
|
## 4.185.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -4034,11 +4041,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
|
|
|
4034
4041
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
4035
4042
|
own rule from two endpoints the console already calls, unprojected:
|
|
4036
4043
|
|
|
4037
|
-
|
|
4038
|
-
|
|
4044
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
4045
|
+
GET /api/roles/id/:role that membership's role document
|
|
4039
4046
|
|
|
4040
|
-
|
|
4041
|
-
|
|
4047
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
4048
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
4042
4049
|
|
|
4043
4050
|
`role.default` is the marker because it is the only property of a platform
|
|
4044
4051
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -291,13 +291,25 @@
|
|
|
291
291
|
it. -->
|
|
292
292
|
<div class="field-label">Enrolling <span>*</span></div>
|
|
293
293
|
<AppSelect
|
|
294
|
-
v-if="
|
|
294
|
+
v-if="pickingSubject && subjectCategoryOptions.length"
|
|
295
295
|
v-model="form.subjectCategory"
|
|
296
296
|
:items="subjectCategoryOptions"
|
|
297
297
|
klass="mb-3"
|
|
298
298
|
@update:model-value="onSubjectCategoryChanged"
|
|
299
299
|
/>
|
|
300
300
|
<p v-else-if="selectedUser" class="field-hint mb-3">{{ subjectCategoryLabel }}</p>
|
|
301
|
+
<!-- An UNMAPPED user (created on the reader itself, or enrolled before
|
|
302
|
+
enrolment linked a person) belongs to nobody in iService365, so no
|
|
303
|
+
Service365 / member app can show it. An edit cannot add the link -
|
|
304
|
+
the subject is chosen at enrolment - so say so before the save,
|
|
305
|
+
not after the person asks why their access is missing. -->
|
|
306
|
+
<p
|
|
307
|
+
v-if="selectedUser && !hasMappedRecord(selectedUser)"
|
|
308
|
+
class="field-hint field-hint--error mb-3"
|
|
309
|
+
data-test="hid-unlinked-warning"
|
|
310
|
+
>
|
|
311
|
+
{{ UNLINKED_HID_USER_WARNING }} {{ LINK_HID_USER_PROMPT }}
|
|
312
|
+
</p>
|
|
301
313
|
<!-- WHY THERE IS NOTHING TO PICK. Drawn in place of the dropdown when
|
|
302
314
|
the reader serves nobody, and beneath it when only some types were
|
|
303
315
|
removed. Without it, a missing option reads as a screen that failed
|
|
@@ -305,7 +317,7 @@
|
|
|
305
317
|
Nothing extra is needed to stop the save: with no type there is no
|
|
306
318
|
subject, and the save already refuses that. -->
|
|
307
319
|
<p
|
|
308
|
-
v-if="
|
|
320
|
+
v-if="pickingSubject && subjectCategoryNote"
|
|
309
321
|
class="field-hint mb-3"
|
|
310
322
|
:class="{ 'field-hint--error': enrolmentSubjects.emptied }"
|
|
311
323
|
>
|
|
@@ -327,7 +339,7 @@
|
|
|
327
339
|
asked for. A row that never had one keeps not having one; that
|
|
328
340
|
is not a reason to make somebody fill in a location before they
|
|
329
341
|
can change a PIN. -->
|
|
330
|
-
<template v-if="
|
|
342
|
+
<template v-if="pickingSubject && isResidentSubject">
|
|
331
343
|
<div class="field-label">Block <span>*</span></div>
|
|
332
344
|
<!-- The listener sits on a wrapper, NOT on AppSelect: AppSelect
|
|
333
345
|
spreads `$attrs` over its v-menu activator AFTER the activator's
|
|
@@ -372,7 +384,7 @@
|
|
|
372
384
|
with no unit has no candidates to show, and the dialog is then
|
|
373
385
|
purely the reader's own credentials - photo, PIN, password -
|
|
374
386
|
which is exactly the edit that must not be blocked. -->
|
|
375
|
-
<template v-if="isResidentSubject && (
|
|
387
|
+
<template v-if="isResidentSubject && (pickingSubject || form.unit)">
|
|
376
388
|
<div class="field-label">Resident <span>*</span></div>
|
|
377
389
|
<AppSelect
|
|
378
390
|
v-model="form.subjectId"
|
|
@@ -393,7 +405,7 @@
|
|
|
393
405
|
access is bound by user id, so there is nothing to bind. The note
|
|
394
406
|
below says how many were left out rather than letting a missing
|
|
395
407
|
colleague read as a bug. -->
|
|
396
|
-
<template v-if="
|
|
408
|
+
<template v-if="pickingSubject && isMemberSubject">
|
|
397
409
|
<div class="field-label">Member <span>*</span></div>
|
|
398
410
|
<AppSelect
|
|
399
411
|
v-model="form.subjectId"
|
|
@@ -428,7 +440,7 @@
|
|
|
428
440
|
so the two screens cannot disagree about who works here.
|
|
429
441
|
Unpaged - the endpoint returns the site's people in one response -
|
|
430
442
|
so searching and filtering cost no request. -->
|
|
431
|
-
<template v-if="
|
|
443
|
+
<template v-if="pickingSubject && isProviderSubject">
|
|
432
444
|
<div class="field-label">Service</div>
|
|
433
445
|
<AppSelect
|
|
434
446
|
v-model="providerService"
|
|
@@ -452,7 +464,7 @@
|
|
|
452
464
|
else: it is the one subject type that arrives a shift at a time,
|
|
453
465
|
and the people it adds fill in their own credentials from their
|
|
454
466
|
app afterwards. -->
|
|
455
|
-
<div class="hid-bulk-cta mb-3">
|
|
467
|
+
<div v-if="!selectedUser" class="hid-bulk-cta mb-3">
|
|
456
468
|
<AppButton
|
|
457
469
|
variant="ghost"
|
|
458
470
|
icon="mdi-account-multiple-plus-outline"
|
|
@@ -495,7 +507,7 @@
|
|
|
495
507
|
whatever the reader already holds. -->
|
|
496
508
|
<!-- A mirror of the chosen member's role, on the same rule as Name:
|
|
497
509
|
restated from the record, never collected. -->
|
|
498
|
-
<template v-if="
|
|
510
|
+
<template v-if="pickingSubject && isPersonSubject">
|
|
499
511
|
<div class="field-label">{{ subjectMirrorLabel }}</div>
|
|
500
512
|
<AppField
|
|
501
513
|
v-model="form.subjectRole"
|
|
@@ -1303,6 +1315,7 @@ const {
|
|
|
1303
1315
|
runObjectOperation,
|
|
1304
1316
|
createIdentity,
|
|
1305
1317
|
updateIdentity,
|
|
1318
|
+
linkReaderUser,
|
|
1306
1319
|
deleteIdentity,
|
|
1307
1320
|
pushStoredFace,
|
|
1308
1321
|
getSitePermissions,
|
|
@@ -1423,6 +1436,16 @@ const deleteSummary = computed(() =>
|
|
|
1423
1436
|
);
|
|
1424
1437
|
const cardDialog = ref(false);
|
|
1425
1438
|
const selectedUser = ref<HidUser | null>(null);
|
|
1439
|
+
/**
|
|
1440
|
+
* LINK FROM EDIT. An Unmapped user (created on the reader, or enrolled before
|
|
1441
|
+
* enrolment linked a person) can be linked to the person it is: the same
|
|
1442
|
+
* pickers as enrolment are drawn in the edit dialog, and the save writes OUR
|
|
1443
|
+
* record only (`linkReaderUser`) - nothing is sent to the reader, nobody is
|
|
1444
|
+
* removed from it - so their existing access shows in their Service365 app.
|
|
1445
|
+
*/
|
|
1446
|
+
const linkingUnmapped = computed(() => Boolean(selectedUser.value) && !hasMappedRecord(selectedUser.value as HidUser));
|
|
1447
|
+
/** The subject pickers are drawn while enrolling, and while linking an Unmapped user. */
|
|
1448
|
+
const pickingSubject = computed(() => !selectedUser.value || linkingUnmapped.value);
|
|
1426
1449
|
const cardUser = ref<HidUser | null>(null);
|
|
1427
1450
|
const physicalCards = ref<HidCard[]>([]);
|
|
1428
1451
|
const physicalCardsByUserId = ref<Record<string, HidCard[]>>({});
|
|
@@ -3273,6 +3296,26 @@ async function saveUser() {
|
|
|
3273
3296
|
},
|
|
3274
3297
|
};
|
|
3275
3298
|
|
|
3299
|
+
if (selectedUser.value && linkingUnmapped.value && form.subjectId) {
|
|
3300
|
+
/*
|
|
3301
|
+
* LINK ONLY. Our record gets the person (and the account behind them);
|
|
3302
|
+
* the reader is not written - the user, face, card, PIN and door access
|
|
3303
|
+
* it already holds stay as they are. Anything else edited in the same
|
|
3304
|
+
* save is left for a second save, so the link never rides on a reader
|
|
3305
|
+
* write that could fail half way.
|
|
3306
|
+
*/
|
|
3307
|
+
const linkReaderId = String(selectedUser.value.reader || readerId);
|
|
3308
|
+
await linkReaderUser(linkReaderId, String(selectedUser.value.hidUserId || form.hidUserId), {
|
|
3309
|
+
...subjectLinkOf(form.subjectCategory, form.subjectId),
|
|
3310
|
+
name: form.name,
|
|
3311
|
+
registration: form.registration,
|
|
3312
|
+
});
|
|
3313
|
+
formDialog.value = false;
|
|
3314
|
+
await loadUsers();
|
|
3315
|
+
showToast("Linked. This person's HID access now shows in their Service365 app.", "success");
|
|
3316
|
+
return;
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3276
3319
|
if (selectedUser.value) {
|
|
3277
3320
|
/*
|
|
3278
3321
|
* AN EDIT REACHES EVERY READER THIS PERSON IS ON.
|
|
@@ -3339,9 +3382,15 @@ async function saveUser() {
|
|
|
3339
3382
|
fanOutRunning.value = false;
|
|
3340
3383
|
|
|
3341
3384
|
const summary = editFanOutSummary(readerOutcomes.value, Boolean(form.accessPin));
|
|
3385
|
+
const savedUnlinked = !hasMappedRecord(selectedUser.value as HidUser);
|
|
3342
3386
|
await loadUsers();
|
|
3343
3387
|
if (summary.tone === "success") formDialog.value = false;
|
|
3344
|
-
showToast(
|
|
3388
|
+
showToast(
|
|
3389
|
+
summary.tone === "success" && savedUnlinked
|
|
3390
|
+
? `${summary.message} ${UNLINKED_HID_USER_WARNING}`
|
|
3391
|
+
: summary.message,
|
|
3392
|
+
summary.tone !== "success" ? "error" : savedUnlinked ? "warning" : "success",
|
|
3393
|
+
);
|
|
3345
3394
|
return;
|
|
3346
3395
|
} else {
|
|
3347
3396
|
/*
|
|
@@ -4542,6 +4591,15 @@ function getMappingStatus(user: HidUser) {
|
|
|
4542
4591
|
return hasMappedRecord(user) ? "Mapped" : "Unmapped";
|
|
4543
4592
|
}
|
|
4544
4593
|
|
|
4594
|
+
/** Shown on an edit of, and after saving, a HID user linked to nobody. */
|
|
4595
|
+
const LINK_HID_USER_PROMPT =
|
|
4596
|
+
"Pick who this is below and save to link them; nothing is changed on the reader.";
|
|
4597
|
+
|
|
4598
|
+
const UNLINKED_HID_USER_WARNING =
|
|
4599
|
+
"Not linked to anyone in iService365, so this access will not show in their"
|
|
4600
|
+
+ " Service365 app. To give the person app access, delete this HID user and"
|
|
4601
|
+
+ " enroll them again with their name selected.";
|
|
4602
|
+
|
|
4545
4603
|
function hasMappedRecord(user: HidUser) {
|
|
4546
4604
|
// Reader-user rows carry the link flag on `identity` (API `linked`).
|
|
4547
4605
|
if (toRecord(user?.identity).linked === true) return true;
|
|
@@ -589,6 +589,23 @@ export default function useHidAmico() {
|
|
|
589
589
|
});
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Link a user that exists only on the reader to the person it is. OUR record
|
|
594
|
+
* only - the server sends nothing to the reader - so the person's existing
|
|
595
|
+
* access shows in their Service365 app. Body from `subjectLinkOf`.
|
|
596
|
+
*/
|
|
597
|
+
function linkReaderUser(
|
|
598
|
+
readerId: string,
|
|
599
|
+
hidUserId: string | number,
|
|
600
|
+
payload: { person?: string; member?: string; serviceProvider?: string; type?: string; name?: string; registration?: string },
|
|
601
|
+
) {
|
|
602
|
+
const body = Object.fromEntries(Object.entries(payload).filter(([, value]) => value !== "" && value !== undefined));
|
|
603
|
+
return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers/${readerId}/users/${hidUserId}/link`, {
|
|
604
|
+
method: "POST",
|
|
605
|
+
body,
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
592
609
|
function deleteIdentity(identityId: string) {
|
|
593
610
|
return useNuxtApp().$api<HidApiRecord>(`${basePath}/identities/${identityId}`, {
|
|
594
611
|
method: "DELETE",
|
|
@@ -735,6 +752,7 @@ export default function useHidAmico() {
|
|
|
735
752
|
getReaderAccessLogs,
|
|
736
753
|
createIdentity,
|
|
737
754
|
updateIdentity,
|
|
755
|
+
linkReaderUser,
|
|
738
756
|
deleteIdentity,
|
|
739
757
|
getIntercomStatus,
|
|
740
758
|
makeIntercomCall,
|
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.185.
|
|
5
|
+
"version": "4.185.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.",
|