@7365admin1/layer-common 4.34.1-staging.367 → 4.34.1-staging.368
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.
|
@@ -21,33 +21,6 @@
|
|
|
21
21
|
<div class="config-body">
|
|
22
22
|
<div class="section-label config-body__title">HID Configuration</div>
|
|
23
23
|
|
|
24
|
-
<div class="form-section identification-section">
|
|
25
|
-
<div class="section-label">Enable/disable reader identification method</div>
|
|
26
|
-
<p class="section-description">
|
|
27
|
-
Toggles multi-factor access methods, allowing users to authenticate via biometric, physical card, or credential inputs.
|
|
28
|
-
</p>
|
|
29
|
-
<div class="methods-grid">
|
|
30
|
-
<div
|
|
31
|
-
v-for="method in identificationMethodOptions"
|
|
32
|
-
:key="method.key"
|
|
33
|
-
class="method-control"
|
|
34
|
-
>
|
|
35
|
-
<span>{{ method.label }}</span>
|
|
36
|
-
<v-switch
|
|
37
|
-
v-model="form.identificationMethods[method.key]"
|
|
38
|
-
class="app-switch"
|
|
39
|
-
hide-details
|
|
40
|
-
density="compact"
|
|
41
|
-
:loading="savingSection === `method-${method.key}`"
|
|
42
|
-
:disabled="Boolean(savingSection) || !form.readerId"
|
|
43
|
-
@update:model-value="saveIdentificationMethod(method.key)"
|
|
44
|
-
/>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<v-divider />
|
|
50
|
-
|
|
51
24
|
<div class="form-section">
|
|
52
25
|
<div class="section-label">Printer Setup</div>
|
|
53
26
|
<div class="printer-grid">
|
|
@@ -224,14 +197,11 @@
|
|
|
224
197
|
|
|
225
198
|
|
|
226
199
|
<script setup lang="ts">
|
|
227
|
-
type HidIdentificationMethod = keyof NonNullable<THidQrCodePassConfig["identificationMethods"]>;
|
|
228
|
-
|
|
229
200
|
type HidQrConfig = Omit<
|
|
230
201
|
THidQrCodePassConfig,
|
|
231
202
|
"identificationMethods" | "onlineMode" | "updatedAt" | "qrGatePermissions"
|
|
232
203
|
> & {
|
|
233
204
|
onlineMode: boolean;
|
|
234
|
-
identificationMethods: Record<HidIdentificationMethod, boolean>;
|
|
235
205
|
qrGatePermissions: {
|
|
236
206
|
resident: string[];
|
|
237
207
|
propertyManagement: string[];
|
|
@@ -265,11 +235,7 @@ const runtimeConfig = useRuntimeConfig();
|
|
|
265
235
|
const isPermissionManager = computed(() => runtimeConfig.public.APP === "security_agency");
|
|
266
236
|
|
|
267
237
|
const { getSiteById, updateSitebyId } = useSiteSettings();
|
|
268
|
-
const {
|
|
269
|
-
getReaders,
|
|
270
|
-
getReaderConfiguration,
|
|
271
|
-
setReaderConfiguration,
|
|
272
|
-
} = useHidAmico();
|
|
238
|
+
const { getReaders } = useHidAmico();
|
|
273
239
|
const {
|
|
274
240
|
requestDevice: requestPrinterDevice,
|
|
275
241
|
testConnection: testPrinterConnection,
|
|
@@ -284,14 +250,6 @@ const defaultConfig: HidQrConfig = {
|
|
|
284
250
|
propertyManagement: [],
|
|
285
251
|
},
|
|
286
252
|
qrFormat: "0",
|
|
287
|
-
identificationMethods: {
|
|
288
|
-
facial: true,
|
|
289
|
-
card: true,
|
|
290
|
-
qrCode: false,
|
|
291
|
-
idPassword: true,
|
|
292
|
-
pin: false,
|
|
293
|
-
bluetooth: false,
|
|
294
|
-
},
|
|
295
253
|
printer: {
|
|
296
254
|
vendorId: "",
|
|
297
255
|
productId: "",
|
|
@@ -321,16 +279,6 @@ const visitorQrGateOptions = computed(() => readers.value
|
|
|
321
279
|
title: String(reader.name || reader.deviceId || reader._id) + " - " + String(reader.portalName || "Portal"),
|
|
322
280
|
value: reader._id,
|
|
323
281
|
})));
|
|
324
|
-
const identificationMethodOptions: Array<{
|
|
325
|
-
key: HidIdentificationMethod;
|
|
326
|
-
label: string;
|
|
327
|
-
}> = [
|
|
328
|
-
{ key: "facial", label: "Facial" },
|
|
329
|
-
{ key: "card", label: "Card" },
|
|
330
|
-
{ key: "qrCode", label: "QR Code" },
|
|
331
|
-
{ key: "idPassword", label: "ID Password" },
|
|
332
|
-
{ key: "pin", label: "PIN" },
|
|
333
|
-
];
|
|
334
282
|
const siteName = computed(() => siteData.value?.name || "Site");
|
|
335
283
|
const siteLabel = computed(() => siteData.value?.code || siteData.value?.block || props.site);
|
|
336
284
|
const primaryQrGateReaderId = computed(() => (
|
|
@@ -371,7 +319,6 @@ async function loadConfig() {
|
|
|
371
319
|
const readerList = readerResponse as HidReaderListResponse;
|
|
372
320
|
readers.value = readerList.items ?? readerList.data?.items ?? readerList.data?.readers ?? [];
|
|
373
321
|
const config = siteData.value?.metadata?.hidQrCodePass || {};
|
|
374
|
-
const configuredMethods = config.identificationMethods;
|
|
375
322
|
Object.assign(form, {
|
|
376
323
|
enabled: Boolean(config.enabled),
|
|
377
324
|
// Visitor QR is reader-local. Do not restore a legacy Online Mode value
|
|
@@ -392,14 +339,6 @@ async function loadConfig() {
|
|
|
392
339
|
|| "",
|
|
393
340
|
),
|
|
394
341
|
qrFormat: "0",
|
|
395
|
-
identificationMethods: {
|
|
396
|
-
facial: configuredMethods?.facial ?? true,
|
|
397
|
-
card: configuredMethods?.card ?? true,
|
|
398
|
-
qrCode: configuredMethods?.qrCode ?? Boolean(config.enabled),
|
|
399
|
-
idPassword: configuredMethods?.idPassword ?? true,
|
|
400
|
-
pin: configuredMethods?.pin ?? false,
|
|
401
|
-
bluetooth: false,
|
|
402
|
-
},
|
|
403
342
|
printer: {
|
|
404
343
|
vendorId: String(config.printer?.vendorId || ""),
|
|
405
344
|
productId: String(config.printer?.productId || ""),
|
|
@@ -410,57 +349,25 @@ async function loadConfig() {
|
|
|
410
349
|
},
|
|
411
350
|
validityMinutes: config.validityMinutes ? Number(config.validityMinutes) : null,
|
|
412
351
|
});
|
|
413
|
-
|
|
414
|
-
await loadReaderConfiguration();
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function isUnknownRecord(value: unknown): value is Record<string, unknown> {
|
|
418
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function getConfigurationData(response: unknown) {
|
|
422
|
-
if (!isUnknownRecord(response)) return {};
|
|
423
|
-
return isUnknownRecord(response.data) ? response.data : response;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function isEnabledConfiguration(value: unknown) {
|
|
427
|
-
return value === true || value === 1 || value === "1";
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
async function loadReaderConfiguration() {
|
|
431
|
-
if (!form.readerId) return;
|
|
432
|
-
|
|
433
|
-
try {
|
|
434
|
-
const response = await getReaderConfiguration(form.readerId, {
|
|
435
|
-
identifier: [
|
|
436
|
-
"card_identification_enabled",
|
|
437
|
-
"pin_identification_enabled",
|
|
438
|
-
"multi_factor_authentication",
|
|
439
|
-
],
|
|
440
|
-
});
|
|
441
|
-
const configuration = getConfigurationData(response);
|
|
442
|
-
const identifier = isUnknownRecord(configuration.identifier) ? configuration.identifier : {};
|
|
443
|
-
|
|
444
|
-
if (identifier.pin_identification_enabled !== undefined) {
|
|
445
|
-
const pinEnabled = isEnabledConfiguration(identifier.pin_identification_enabled);
|
|
446
|
-
form.identificationMethods.pin = pinEnabled;
|
|
447
|
-
form.identificationMethods.idPassword = !pinEnabled;
|
|
448
|
-
}
|
|
449
|
-
if (identifier.card_identification_enabled !== undefined) {
|
|
450
|
-
form.identificationMethods.card = isEnabledConfiguration(
|
|
451
|
-
identifier.card_identification_enabled,
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
} catch (error: unknown) {
|
|
455
|
-
console.warn("Unable to load HID reader configuration:", errorConverter(error));
|
|
456
|
-
}
|
|
457
352
|
}
|
|
458
353
|
|
|
459
354
|
function buildPayload() {
|
|
355
|
+
/*
|
|
356
|
+
* `enabled` and `identificationMethods` are passed through from what was
|
|
357
|
+
* loaded, never recomputed.
|
|
358
|
+
*
|
|
359
|
+
* Which credentials a reader accepts now lives on the READER record and is
|
|
360
|
+
* set from HID Readers > Identification Methods, because the device is what
|
|
361
|
+
* holds them. The toggles that used to derive these two values are gone from
|
|
362
|
+
* this screen, so deriving them again from a form that no longer has them
|
|
363
|
+
* would erase the stored copy and flip `enabled` every time somebody saved
|
|
364
|
+
* the printer settings.
|
|
365
|
+
*/
|
|
366
|
+
const storedQrPass = siteData.value?.metadata?.hidQrCodePass || {};
|
|
460
367
|
const metadata = {
|
|
461
368
|
...(siteData.value?.metadata || {}),
|
|
462
369
|
hidQrCodePass: {
|
|
463
|
-
enabled:
|
|
370
|
+
enabled: Boolean(storedQrPass.enabled),
|
|
464
371
|
onlineMode: false,
|
|
465
372
|
// Kept only for old background/mobile flows. Gate permissions, not this
|
|
466
373
|
// compatibility value, decide where a new Visitor QR may be scanned.
|
|
@@ -471,7 +378,9 @@ function buildPayload() {
|
|
|
471
378
|
},
|
|
472
379
|
// Visitor QR passes always use Amico alphanumeric qrcodes.
|
|
473
380
|
qrFormat: "0",
|
|
474
|
-
|
|
381
|
+
...(storedQrPass.identificationMethods
|
|
382
|
+
? { identificationMethods: storedQrPass.identificationMethods }
|
|
383
|
+
: {}),
|
|
475
384
|
printer: {
|
|
476
385
|
vendorId: form.printer.vendorId.trim(),
|
|
477
386
|
productId: form.printer.productId.trim(),
|
|
@@ -507,43 +416,6 @@ async function saveSection(section: string) {
|
|
|
507
416
|
}
|
|
508
417
|
}
|
|
509
418
|
|
|
510
|
-
async function saveIdentificationMethod(method: HidIdentificationMethod) {
|
|
511
|
-
if (!props.site) return;
|
|
512
|
-
|
|
513
|
-
form.enabled = form.identificationMethods.qrCode;
|
|
514
|
-
|
|
515
|
-
savingSection.value = `method-${method}`;
|
|
516
|
-
try {
|
|
517
|
-
if (method === "card") {
|
|
518
|
-
await setReaderConfiguration(form.readerId, {
|
|
519
|
-
identifier: {
|
|
520
|
-
card_identification_enabled: form.identificationMethods.card ? "1" : "0",
|
|
521
|
-
},
|
|
522
|
-
});
|
|
523
|
-
} else if (method === "pin" || method === "idPassword") {
|
|
524
|
-
if (method === "pin" && form.identificationMethods.pin) {
|
|
525
|
-
form.identificationMethods.idPassword = false;
|
|
526
|
-
} else if (method === "idPassword" && form.identificationMethods.idPassword) {
|
|
527
|
-
form.identificationMethods.pin = false;
|
|
528
|
-
}
|
|
529
|
-
await setReaderConfiguration(form.readerId, {
|
|
530
|
-
identifier: {
|
|
531
|
-
pin_identification_enabled: form.identificationMethods.pin ? "1" : "0",
|
|
532
|
-
// Mode 1: PIN is an alternative credential, never a second factor.
|
|
533
|
-
multi_factor_authentication: "0",
|
|
534
|
-
},
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
await updateSitebyId(props.site, buildPayload());
|
|
538
|
-
showMessage(`${identificationMethodOptions.find((item) => item.key === method)?.label || "Identification method"} updated.`, "success");
|
|
539
|
-
} catch (error: unknown) {
|
|
540
|
-
await loadConfig();
|
|
541
|
-
showMessage(errorConverter(error), "error");
|
|
542
|
-
} finally {
|
|
543
|
-
savingSection.value = "";
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
419
|
async function scanPrinter() {
|
|
548
420
|
if (!("usb" in navigator)) {
|
|
549
421
|
showMessage("USB printer scan is not available in this browser.", "error");
|
|
@@ -651,51 +523,6 @@ function showMessage(text: string, color: string) {
|
|
|
651
523
|
padding: 16px 0;
|
|
652
524
|
}
|
|
653
525
|
|
|
654
|
-
.identification-section {
|
|
655
|
-
padding-bottom: 20px;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
.methods-grid {
|
|
659
|
-
display: grid;
|
|
660
|
-
grid-template-columns: repeat(6, minmax(120px, 1fr));
|
|
661
|
-
gap: 18px;
|
|
662
|
-
margin-top: 16px;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
.method-control {
|
|
666
|
-
display: flex;
|
|
667
|
-
align-items: center;
|
|
668
|
-
justify-content: space-between;
|
|
669
|
-
min-width: 0;
|
|
670
|
-
min-height: 42px;
|
|
671
|
-
padding: 0 10px 0 14px;
|
|
672
|
-
border: 1px solid var(--border);
|
|
673
|
-
border-radius: var(--r-inner);
|
|
674
|
-
color: var(--text2);
|
|
675
|
-
font-family: var(--font-sans);
|
|
676
|
-
font-size: 12px;
|
|
677
|
-
font-weight: 700;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
.method-control span {
|
|
681
|
-
overflow: hidden;
|
|
682
|
-
text-overflow: ellipsis;
|
|
683
|
-
white-space: nowrap;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
.method-control--disabled {
|
|
687
|
-
background-color: var(--hover);
|
|
688
|
-
color: var(--muted);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
.method-control :deep(.v-switch) {
|
|
692
|
-
flex: 0 0 auto;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
.method-control :deep(.v-selection-control) {
|
|
696
|
-
min-height: 32px;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
526
|
/* The three `.hid-config-switch` rules are gone: `.app-switch` in
|
|
700
527
|
primitives.css is the handoff's toggle, and it is shared with the other two
|
|
701
528
|
HID panels that have one. */
|
|
@@ -867,10 +694,6 @@ function showMessage(text: string, color: string) {
|
|
|
867
694
|
}
|
|
868
695
|
|
|
869
696
|
@media (max-width: 1100px) {
|
|
870
|
-
.methods-grid {
|
|
871
|
-
grid-template-columns: repeat(3, minmax(140px, 1fr));
|
|
872
|
-
}
|
|
873
|
-
|
|
874
697
|
.printer-grid,
|
|
875
698
|
.reader-grid,
|
|
876
699
|
.template-grid,
|
|
@@ -891,7 +714,6 @@ function showMessage(text: string, color: string) {
|
|
|
891
714
|
.reader-grid,
|
|
892
715
|
.template-grid,
|
|
893
716
|
.validity-grid,
|
|
894
|
-
.methods-grid,
|
|
895
717
|
.permission-location,
|
|
896
718
|
.permission-row,
|
|
897
719
|
.permission-actions {
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
<v-list density="compact" min-width="180">
|
|
89
89
|
<v-list-item title="View" @click="openView(item)" />
|
|
90
90
|
<v-list-item title="Access Permissions" @click="openPermissions(item)" />
|
|
91
|
+
<v-list-item title="Identification Methods" @click="openIdentification(item)" />
|
|
91
92
|
<v-list-item title="Sync HID Reader" @click="openSyncConfirm(item)" />
|
|
92
93
|
<v-list-item title="Test Connection" @click="openTestConfirm(item)" />
|
|
93
94
|
<v-list-item title="Edit" @click="openEdit(item)" />
|
|
@@ -145,6 +146,108 @@
|
|
|
145
146
|
</v-card>
|
|
146
147
|
</v-dialog>
|
|
147
148
|
|
|
149
|
+
<!--
|
|
150
|
+
IDENTIFICATION METHODS - what this reader accepts at the door.
|
|
151
|
+
|
|
152
|
+
Per reader, not per site: the device's own `identifier` module is the
|
|
153
|
+
authority, and a site-wide copy could only ever describe one of them.
|
|
154
|
+
|
|
155
|
+
There is deliberately no Bluetooth control. The HID API has no Bluetooth
|
|
156
|
+
identification field; the old site-level toggle of that name referred to
|
|
157
|
+
the phone-as-a-card feature in the mobile app, which is a different thing.
|
|
158
|
+
-->
|
|
159
|
+
<v-dialog v-model="identificationDialog" max-width="430" persistent>
|
|
160
|
+
<v-card rounded="lg">
|
|
161
|
+
<v-card-title class="screen-card-title">Identification Methods</v-card-title>
|
|
162
|
+
|
|
163
|
+
<v-card-text v-if="identificationStage === 'edit'">
|
|
164
|
+
<p class="identification-lead">
|
|
165
|
+
Credentials {{ selectedReader?.name || "this HID Reader" }} will accept at the door.
|
|
166
|
+
</p>
|
|
167
|
+
|
|
168
|
+
<div class="identification-grid">
|
|
169
|
+
<div
|
|
170
|
+
v-for="method in identificationMethodRows"
|
|
171
|
+
:key="method.key"
|
|
172
|
+
class="identification-row"
|
|
173
|
+
>
|
|
174
|
+
<div class="identification-copy">
|
|
175
|
+
<span>{{ method.label }}</span>
|
|
176
|
+
<small v-if="!method.supported">Not supported by this reader</small>
|
|
177
|
+
</div>
|
|
178
|
+
<v-switch
|
|
179
|
+
v-model="identificationForm[method.key]"
|
|
180
|
+
class="app-switch"
|
|
181
|
+
hide-details
|
|
182
|
+
density="compact"
|
|
183
|
+
:disabled="!method.supported || identificationSaving"
|
|
184
|
+
/>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<!--
|
|
189
|
+
One reader setting with two modes, not two switches:
|
|
190
|
+
`pin_identification_enabled` is 1 for PIN and 0 for ID-and-password.
|
|
191
|
+
A reader without the PIN capability can be given neither.
|
|
192
|
+
-->
|
|
193
|
+
<div class="identification-credential">
|
|
194
|
+
<div class="identification-copy">
|
|
195
|
+
<span>Credential entry</span>
|
|
196
|
+
<small v-if="!credentialModeSupported">Not supported by this reader</small>
|
|
197
|
+
</div>
|
|
198
|
+
<v-radio-group
|
|
199
|
+
v-model="identificationForm.credentialMode"
|
|
200
|
+
hide-details
|
|
201
|
+
density="compact"
|
|
202
|
+
:disabled="!credentialModeSupported || identificationSaving"
|
|
203
|
+
>
|
|
204
|
+
<v-radio label="PIN" value="pin" />
|
|
205
|
+
<v-radio label="ID and password" value="idPassword" />
|
|
206
|
+
</v-radio-group>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<p class="identification-applied">
|
|
210
|
+
Confirmed on the reader:
|
|
211
|
+
<strong>{{ formatDate(selectedReader?.identificationMethodsAppliedAt) }}</strong>
|
|
212
|
+
</p>
|
|
213
|
+
</v-card-text>
|
|
214
|
+
|
|
215
|
+
<v-card-text v-else class="reader-action-content">
|
|
216
|
+
<v-icon icon="mdi-shield-key-outline" class="dialog-mark" size="48" />
|
|
217
|
+
<h3>Change what opens this door?</h3>
|
|
218
|
+
<p>
|
|
219
|
+
You are about to change the credentials {{ selectedReader?.name || "this HID Reader" }}
|
|
220
|
+
accepts.
|
|
221
|
+
</p>
|
|
222
|
+
<p v-if="identificationBeingDisabled.length" class="identification-warning">
|
|
223
|
+
Turning off: <strong>{{ identificationBeingDisabled.join(", ") }}</strong>.
|
|
224
|
+
Anyone relying on that credential will stop getting in at this reader.
|
|
225
|
+
</p>
|
|
226
|
+
</v-card-text>
|
|
227
|
+
|
|
228
|
+
<v-card-actions>
|
|
229
|
+
<v-spacer />
|
|
230
|
+
<AppButton
|
|
231
|
+
variant="ghost"
|
|
232
|
+
:disabled="identificationSaving"
|
|
233
|
+
@click="identificationStage === 'confirm' ? (identificationStage = 'edit') : (identificationDialog = false)"
|
|
234
|
+
>
|
|
235
|
+
{{ identificationStage === "confirm" ? "Back" : "Cancel" }}
|
|
236
|
+
</AppButton>
|
|
237
|
+
<AppButton
|
|
238
|
+
v-if="identificationStage === 'edit'"
|
|
239
|
+
:disabled="!identificationChanged"
|
|
240
|
+
@click="identificationStage = 'confirm'"
|
|
241
|
+
>
|
|
242
|
+
Save
|
|
243
|
+
</AppButton>
|
|
244
|
+
<AppButton v-else :disabled="identificationSaving" @click="saveIdentificationMethods">
|
|
245
|
+
{{ identificationSaving ? "Applying..." : "Apply to reader" }}
|
|
246
|
+
</AppButton>
|
|
247
|
+
</v-card-actions>
|
|
248
|
+
</v-card>
|
|
249
|
+
</v-dialog>
|
|
250
|
+
|
|
148
251
|
<v-dialog v-model="confirmDialog" max-width="390" persistent>
|
|
149
252
|
<v-card rounded="lg" class="reader-action-dialog">
|
|
150
253
|
<v-card-title class="screen-card-title">{{ confirmTitle }}</v-card-title>
|
|
@@ -297,6 +400,21 @@ type HidRecord = {
|
|
|
297
400
|
cardReadingMode?: "unconfigured" | "pacs" | "csn" | "csn_for_mifare";
|
|
298
401
|
csnByteOrder?: "msb" | "lsb";
|
|
299
402
|
pacsFormat?: "raw" | "wiegand";
|
|
403
|
+
capabilities?: {
|
|
404
|
+
card?: boolean;
|
|
405
|
+
facial?: boolean;
|
|
406
|
+
qr?: boolean;
|
|
407
|
+
pin?: boolean;
|
|
408
|
+
intercom?: boolean;
|
|
409
|
+
};
|
|
410
|
+
identificationMethods?: {
|
|
411
|
+
facial?: boolean;
|
|
412
|
+
card?: boolean;
|
|
413
|
+
qrCode?: boolean;
|
|
414
|
+
credentialMode?: "pin" | "idPassword";
|
|
415
|
+
};
|
|
416
|
+
/** When the READER confirmed the methods, not when they were saved here. */
|
|
417
|
+
identificationMethodsAppliedAt?: string;
|
|
300
418
|
};
|
|
301
419
|
|
|
302
420
|
type HidReaderFormPayload = {
|
|
@@ -353,6 +471,7 @@ const {
|
|
|
353
471
|
configureReaderIntegration,
|
|
354
472
|
setReaderMonitor,
|
|
355
473
|
setReaderOperatingMode,
|
|
474
|
+
setReaderIdentificationMethods,
|
|
356
475
|
getReaderUsers,
|
|
357
476
|
} = useHidAmico();
|
|
358
477
|
|
|
@@ -368,6 +487,18 @@ const confirmDialog = ref(false);
|
|
|
368
487
|
const resultDialog = ref(false);
|
|
369
488
|
const selectedReader = ref<HidRecord | null>(null);
|
|
370
489
|
const permissionsDialog = ref(false);
|
|
490
|
+
const identificationDialog = ref(false);
|
|
491
|
+
/* Two stages in one dialog, like the sync flow: the controls, then the
|
|
492
|
+
confirmation. Switching a credential off decides what stops opening a door,
|
|
493
|
+
so it is never one click away. */
|
|
494
|
+
const identificationStage = ref<"edit" | "confirm">("edit");
|
|
495
|
+
const identificationSaving = ref(false);
|
|
496
|
+
const identificationForm = ref<{
|
|
497
|
+
facial: boolean;
|
|
498
|
+
card: boolean;
|
|
499
|
+
qrCode: boolean;
|
|
500
|
+
credentialMode: "pin" | "idPassword";
|
|
501
|
+
}>({ facial: false, card: false, qrCode: false, credentialMode: "idPassword" });
|
|
371
502
|
const pendingAction = ref<"test" | "sync" | "delete" | null>(null);
|
|
372
503
|
const actionStage = ref<"confirm" | "review" | "loading">("confirm");
|
|
373
504
|
const resultSuccess = ref(true);
|
|
@@ -510,6 +641,104 @@ function openPermissions(reader: HidRecord) {
|
|
|
510
641
|
permissionsDialog.value = true;
|
|
511
642
|
}
|
|
512
643
|
|
|
644
|
+
/*
|
|
645
|
+
* The reader record is the source of truth, including for what is already on.
|
|
646
|
+
* A missing `identificationMethods` means nothing has been applied through this
|
|
647
|
+
* screen yet; the switches start off rather than guessing at the device.
|
|
648
|
+
*/
|
|
649
|
+
function openIdentification(reader: HidRecord) {
|
|
650
|
+
selectedReader.value = reader;
|
|
651
|
+
const current = reader.identificationMethods || {};
|
|
652
|
+
identificationForm.value = {
|
|
653
|
+
facial: current.facial === true,
|
|
654
|
+
card: current.card === true,
|
|
655
|
+
qrCode: current.qrCode === true,
|
|
656
|
+
credentialMode: current.credentialMode === "pin" ? "pin" : "idPassword",
|
|
657
|
+
};
|
|
658
|
+
identificationStage.value = "edit";
|
|
659
|
+
identificationDialog.value = true;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/*
|
|
663
|
+
* A reader saved before capabilities were recorded has none. Those are treated
|
|
664
|
+
* as capable rather than having every control disabled on an older record —
|
|
665
|
+
* the backend gate makes the same allowance, and it is the one that decides.
|
|
666
|
+
*/
|
|
667
|
+
function readerSupports(key: "facial" | "card" | "qr" | "pin") {
|
|
668
|
+
const capabilities = selectedReader.value?.capabilities;
|
|
669
|
+
if (!capabilities) return true;
|
|
670
|
+
return capabilities[key] === true;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
const identificationMethodRows = computed(() => [
|
|
674
|
+
{ key: "facial" as const, label: "Facial", supported: readerSupports("facial") },
|
|
675
|
+
{ key: "card" as const, label: "Card", supported: readerSupports("card") },
|
|
676
|
+
{ key: "qrCode" as const, label: "QR code", supported: readerSupports("qr") },
|
|
677
|
+
]);
|
|
678
|
+
|
|
679
|
+
/* Both modes ride the reader's single PIN switch, so the pair stands or falls
|
|
680
|
+
together on that one capability. */
|
|
681
|
+
const credentialModeSupported = computed(() => readerSupports("pin"));
|
|
682
|
+
|
|
683
|
+
const identificationChanged = computed(() => {
|
|
684
|
+
const current = selectedReader.value?.identificationMethods || {};
|
|
685
|
+
const form = identificationForm.value;
|
|
686
|
+
return (
|
|
687
|
+
form.facial !== (current.facial === true)
|
|
688
|
+
|| form.card !== (current.card === true)
|
|
689
|
+
|| form.qrCode !== (current.qrCode === true)
|
|
690
|
+
|| form.credentialMode !== (current.credentialMode === "pin" ? "pin" : "idPassword")
|
|
691
|
+
);
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
/* Named in the confirmation, because switching a credential OFF is the change
|
|
695
|
+
that locks somebody out. */
|
|
696
|
+
const identificationBeingDisabled = computed(() => {
|
|
697
|
+
const current = selectedReader.value?.identificationMethods || {};
|
|
698
|
+
const form = identificationForm.value;
|
|
699
|
+
const disabled: string[] = [];
|
|
700
|
+
if (current.facial === true && !form.facial) disabled.push("Facial");
|
|
701
|
+
if (current.card === true && !form.card) disabled.push("Card");
|
|
702
|
+
if (current.qrCode === true && !form.qrCode) disabled.push("QR code");
|
|
703
|
+
if (current.credentialMode === "pin" && form.credentialMode !== "pin") disabled.push("PIN");
|
|
704
|
+
return disabled;
|
|
705
|
+
});
|
|
706
|
+
|
|
707
|
+
/*
|
|
708
|
+
* Reload after BOTH outcomes.
|
|
709
|
+
*
|
|
710
|
+
* The confirmed time and the stored methods must come from the server, which
|
|
711
|
+
* only writes them once the reader has echoed the values back. Assuming them
|
|
712
|
+
* here would let the screen claim a door accepts something it refused. On
|
|
713
|
+
* failure the reload matters just as much: the API names the credential the
|
|
714
|
+
* reader would not take, and the controls must go back to what the device
|
|
715
|
+
* actually holds rather than keeping the rejected choice on screen.
|
|
716
|
+
*/
|
|
717
|
+
async function saveIdentificationMethods() {
|
|
718
|
+
const readerId = String(selectedReader.value?._id || "");
|
|
719
|
+
if (!readerId) return;
|
|
720
|
+
|
|
721
|
+
const readerName = String(selectedReader.value?.name || "HID Reader");
|
|
722
|
+
identificationSaving.value = true;
|
|
723
|
+
try {
|
|
724
|
+
await setReaderIdentificationMethods(readerId, { ...identificationForm.value });
|
|
725
|
+
identificationDialog.value = false;
|
|
726
|
+
await loadReaders();
|
|
727
|
+
selectedReader.value = readers.value.find((reader) => String(reader._id) === readerId) || null;
|
|
728
|
+
showResult(true, "Identification Methods Updated", `${readerName} now accepts the credentials you selected.`, {
|
|
729
|
+
readerName,
|
|
730
|
+
});
|
|
731
|
+
} catch (error: unknown) {
|
|
732
|
+
console.error("Unable to set HID identification methods:", error);
|
|
733
|
+
identificationDialog.value = false;
|
|
734
|
+
await loadReaders();
|
|
735
|
+
showResult(false, "Identification Methods Not Applied", getFriendlyHidError(error), { readerName });
|
|
736
|
+
} finally {
|
|
737
|
+
identificationSaving.value = false;
|
|
738
|
+
identificationStage.value = "edit";
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
513
742
|
function openTestConfirm(reader?: HidRecord | null) {
|
|
514
743
|
if (reader) selectedReader.value = reader;
|
|
515
744
|
pendingAction.value = "test";
|
|
@@ -945,6 +1174,57 @@ function formatCallback(reader?: HidRecord | null) {
|
|
|
945
1174
|
margin-top: 20px;
|
|
946
1175
|
}
|
|
947
1176
|
|
|
1177
|
+
.identification-lead {
|
|
1178
|
+
margin: 0 0 14px;
|
|
1179
|
+
color: var(--muted);
|
|
1180
|
+
font-size: 13px;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
.identification-grid {
|
|
1184
|
+
display: grid;
|
|
1185
|
+
gap: 4px;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.identification-row,
|
|
1189
|
+
.identification-credential {
|
|
1190
|
+
display: flex;
|
|
1191
|
+
align-items: center;
|
|
1192
|
+
justify-content: space-between;
|
|
1193
|
+
gap: 16px;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
.identification-credential {
|
|
1197
|
+
align-items: flex-start;
|
|
1198
|
+
margin-top: 12px;
|
|
1199
|
+
padding-top: 12px;
|
|
1200
|
+
border-top: 1px solid var(--border);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
.identification-copy {
|
|
1204
|
+
display: grid;
|
|
1205
|
+
gap: 2px;
|
|
1206
|
+
font-size: 13px;
|
|
1207
|
+
color: var(--text);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/* The reason a control is dead, next to the control rather than in a tooltip
|
|
1211
|
+
nobody opens. */
|
|
1212
|
+
.identification-copy small {
|
|
1213
|
+
color: var(--muted);
|
|
1214
|
+
font-size: 11px;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
.identification-applied {
|
|
1218
|
+
margin: 16px 0 0;
|
|
1219
|
+
color: var(--muted);
|
|
1220
|
+
font-size: 12px;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
.identification-warning {
|
|
1224
|
+
color: var(--text);
|
|
1225
|
+
font-size: 13px;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
948
1228
|
.reader-action-dialog {
|
|
949
1229
|
overflow: hidden;
|
|
950
1230
|
}
|
|
@@ -910,8 +910,20 @@ const hidQrReaderId = computed(() => (
|
|
|
910
910
|
hidQrConfiguredReaderId.value || String(hidQrReader.value?._id || "")
|
|
911
911
|
));
|
|
912
912
|
|
|
913
|
+
/*
|
|
914
|
+
* Visitor QR passes are hidden at the manager's request (2026-09-23).
|
|
915
|
+
*
|
|
916
|
+
* A flag rather than a deletion: issuing, the preview dialog, printing and the
|
|
917
|
+
* regenerate handler below are all intact and untouched, so bringing the
|
|
918
|
+
* feature back is this one line. Every surface that offers a Visitor QR reads
|
|
919
|
+
* `hidQrCodePassAllowed`, which is why the switch belongs here and not in each
|
|
920
|
+
* of them.
|
|
921
|
+
*/
|
|
922
|
+
const HID_VISITOR_QR_ENABLED = false;
|
|
923
|
+
|
|
913
924
|
const hidQrCodePassAllowed = computed(() => {
|
|
914
925
|
return (
|
|
926
|
+
HID_VISITOR_QR_ENABLED &&
|
|
915
927
|
hidQrCodePassEnabled.value &&
|
|
916
928
|
["guest", "contractor", "walk-in"].includes(prop.type)
|
|
917
929
|
);
|
|
@@ -315,6 +315,22 @@ export default function useHidAmico() {
|
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Which credentials a reader accepts at the door.
|
|
320
|
+
*
|
|
321
|
+
* Separate from `setReaderConfiguration` on purpose. That one is the generic
|
|
322
|
+
* configuration endpoint, gated by an allowlist of writable objects; this is
|
|
323
|
+
* a dedicated route that validates the four methods against the reader's own
|
|
324
|
+
* `capabilities` and confirms the write by reading the device back, so a
|
|
325
|
+
* refusal here names the credential the hardware would not take.
|
|
326
|
+
*/
|
|
327
|
+
function setReaderIdentificationMethods(readerId: string, payload: HidApiRecord) {
|
|
328
|
+
return useNuxtApp().$api<HidApiRecord>(
|
|
329
|
+
`${basePath}/readers/${readerId}/identification-methods`,
|
|
330
|
+
{ method: "PUT", body: payload },
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
318
334
|
function getIdentities(readerId: string, query: HidApiRecord = {}) {
|
|
319
335
|
return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers/${readerId}/identities`, {
|
|
320
336
|
method: "GET",
|
|
@@ -631,6 +647,7 @@ export default function useHidAmico() {
|
|
|
631
647
|
issueVisitorQr,
|
|
632
648
|
getReaderConfiguration,
|
|
633
649
|
setReaderConfiguration,
|
|
650
|
+
setReaderIdentificationMethods,
|
|
634
651
|
getLogs,
|
|
635
652
|
setUserImage,
|
|
636
653
|
deleteUserImage,
|
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.34.1-staging.
|
|
5
|
+
"version": "4.34.1-staging.368",
|
|
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.",
|