diff --git a/client/pages/config/email.vue b/client/pages/config/email.vue index 4792fc9f..0073790f 100644 --- a/client/pages/config/email.vue +++ b/client/pages/config/email.vue @@ -70,6 +70,7 @@ {{ $strings.LabelName }} {{ $strings.LabelEmail }} + {{ $strings.LabelAccessibleBy }} @@ -79,6 +80,9 @@

{{ device.email }}

+ +

{{ getAccessibleBy(device) }}

+
@@ -105,6 +109,7 @@ export default { }, data() { return { + users: [], loading: false, savingSettings: false, sendingTest: false, @@ -146,6 +151,29 @@ export default { ...this.settings } }, + async loadUsers() { + this.users = await this.$axios + .$get('/api/users') + .then((res) => { + return res.users.sort((a, b) => { + return a.createdAt - b.createdAt + }) + }) + .catch((error) => { + console.error('Failed', error) + return [] + }) + }, + getAccessibleBy(device) { + const user = device.availabilityOption + if (user === 'userOrUp') return 'Users (excluding Guests)' + if (user === 'guestOrUp') return 'Users (including Guests)' + if (user === 'specificUsers') { + this.loadUsers() + return device.users.map((id) => this.users.find((u) => u.id === id)?.username).join(', ') + } + return 'Admins Only' + }, editDeviceClick(device) { this.selectedEReaderDevice = device this.showEReaderDeviceModal = true diff --git a/client/strings/en-us.json b/client/strings/en-us.json index 6cbd5bf0..d7fb715b 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -191,6 +191,7 @@ "LabelAbridged": "Abridged", "LabelAbridgedChecked": "Abridged (checked)", "LabelAbridgedUnchecked": "Unabridged (unchecked)", + "LabelAccessibleBy": "Accessible by", "LabelAccountType": "Account Type", "LabelAccountTypeAdmin": "Admin", "LabelAccountTypeGuest": "Guest",