From 2cfc18ee318fdff5a8dddb9ba7422b3af725ec5e Mon Sep 17 00:00:00 2001 From: Kyle Morel Date: Wed, 9 Oct 2024 12:46:36 -0700 Subject: [PATCH] Disabling forms/buttons on Nav side if permissions not met --- frontend/src/components/file/DocumentCard.vue | 10 +++++-- .../housing/enquiry/EnquiryListNavigator.vue | 4 ++- .../housing/submission/SubmissionForm.vue | 2 +- .../submission/SubmissionListNavigator.vue | 1 + frontend/src/components/note/NoteCard.vue | 3 ++ frontend/src/components/permit/PermitCard.vue | 4 ++- frontend/src/components/roadmap/Roadmap.vue | 14 ++++++++-- frontend/src/store/authzStore.ts | 2 +- .../src/views/housing/enquiry/EnquiryView.vue | 8 ++++-- .../housing/submission/SubmissionView.vue | 28 +++++++++++++++---- 10 files changed, 59 insertions(+), 17 deletions(-) diff --git a/frontend/src/components/file/DocumentCard.vue b/frontend/src/components/file/DocumentCard.vue index 85423ee4..6388eb64 100644 --- a/frontend/src/components/file/DocumentCard.vue +++ b/frontend/src/components/file/DocumentCard.vue @@ -13,7 +13,8 @@ import spreadsheet from '@/assets/images/spreadsheet.svg'; import DeleteDocument from '@/components/file/DeleteDocument.vue'; import { Card } from '@/lib/primevue'; -import { FileCategory } from '@/utils/enums/application'; +import { useAuthZStore } from '@/store'; +import { Action, FileCategory, Initiative, Resource } from '@/utils/enums/application'; import { formatDateLong } from '@/utils/formatters'; import { getFileCategory } from '@/utils/utils'; @@ -58,7 +59,7 @@ const displayIcon = (mimeType = '') => { }; function onClick() { - if (selectable) { + if (selectable && useAuthZStore().can(Initiative.HOUSING, Resource.DOCUMENT, Action.READ)) { isSelected.value = !isSelected.value; emit('document:clicked', { document: document, selected: isSelected.value }); } @@ -100,7 +101,10 @@ function onClick() {
{{ filesize(document.filesize) }}
- + diff --git a/frontend/src/components/housing/enquiry/EnquiryListNavigator.vue b/frontend/src/components/housing/enquiry/EnquiryListNavigator.vue index 4a01a722..ce409d1a 100644 --- a/frontend/src/components/housing/enquiry/EnquiryListNavigator.vue +++ b/frontend/src/components/housing/enquiry/EnquiryListNavigator.vue @@ -15,7 +15,8 @@ import { useToast } from '@/lib/primevue'; import { enquiryService } from '@/services'; -import { RouteName } from '@/utils/enums/application'; +import { useAuthZStore } from '@/store'; +import { Action, Initiative, Resource, RouteName } from '@/utils/enums/application'; import { IntakeStatus } from '@/utils/enums/housing'; import { formatDate } from '@/utils/formatters'; import { toNumber } from '@/utils/utils'; @@ -241,6 +242,7 @@ function updateQueryParams() {