-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FSADT1-1261): adding rbac to submission list/review (#889)
Co-authored-by: Maria Martinez <[email protected]>
- Loading branch information
1 parent
458fbea
commit 2ab8d1a
Showing
8 changed files
with
115 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,18 @@ import "@carbon/web-components/es/components/tooltip/index"; | |
// Composables | ||
import { useFetchTo } from "@/composables/useFetch"; | ||
import { useRouter } from "vue-router"; | ||
import { useEventBus } from "@vueuse/core"; | ||
// Types | ||
import type { SubmissionList } from "@/dto/CommonTypesDto"; | ||
import { formatDistanceToNow, format } from "date-fns"; | ||
import { toTitleCase } from "@/services/ForestClientService"; | ||
// Session | ||
import ForestClientUserSession from "@/helpers/ForestClientUserSession"; | ||
// @ts-ignore | ||
import Approved16 from "@carbon/icons-vue/es/task--complete/16"; | ||
// @ts-ignore | ||
import Review16 from "@carbon/icons-vue/es/data--view--alt/16"; | ||
import { toTitleCase } from "@/services/ForestClientService"; | ||
const router = useRouter(); | ||
|
@@ -108,11 +112,13 @@ onMounted(() => { | |
disableSkelleton(); | ||
watch(skeletonReference, disableSkelleton); | ||
}); | ||
const userhasAuthority = ["CLIENT_VIEWER", "CLIENT_EDITOR", "CLIENT_ADMIN"].some(authority => ForestClientUserSession.authorities.includes(authority)); | ||
</script> | ||
|
||
<template> | ||
<div id="screen" class="submission-list"> | ||
<div id="title"> | ||
<div id="title" v-if="userhasAuthority"> | ||
<div> | ||
<div class="form-header-title mg-sd-25"> | ||
<h1>Submissions</h1> | ||
|
@@ -121,7 +127,7 @@ onMounted(() => { | |
</div> | ||
</div> | ||
|
||
<div id="datatable"> | ||
<div id="datatable" v-if="userhasAuthority"> | ||
<cds-table use-zebra-styles v-if="!loading"> | ||
<cds-table-head> | ||
<cds-table-header-row> | ||
|
@@ -159,7 +165,8 @@ onMounted(() => { | |
:headers="['Client name', 'Client type', 'District', 'Submitted on', 'Submission status']" | ||
/> | ||
</div> | ||
<div class="paginator" v-if="totalItems"> | ||
|
||
<div class="paginator" v-if="totalItems && userhasAuthority"> | ||
<cds-pagination | ||
items-per-page-text="Submissions per page" | ||
:page-size="pageSize" | ||
|
@@ -173,6 +180,20 @@ onMounted(() => { | |
<cds-select-item :value="50">50</cds-select-item> | ||
</cds-pagination> | ||
</div> | ||
|
||
<cds-actionable-notification | ||
v-if="!userhasAuthority" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
open="true" | ||
kind="error" | ||
title="You are not authorized to access this page" | ||
> | ||
<div> | ||
Please email [email protected] for help | ||
</div> | ||
</cds-actionable-notification> | ||
</div> | ||
|
||
</template> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,6 +290,13 @@ const renderListItem = (label, clientNumbers) => { | |
finalLabel | ||
); | ||
}; | ||
const userhasAuthority = ["CLIENT_VIEWER", "CLIENT_EDITOR", "CLIENT_ADMIN"].some(authority => ForestClientUserSession.authorities.includes(authority)); | ||
const isNotEditor = !ForestClientUserSession.authorities.includes('CLIENT_EDITOR') && !ForestClientUserSession.authorities.includes('CLIENT_ADMIN'); | ||
if(isNotEditor){ | ||
submitDisabled.value = true; | ||
} | ||
</script> | ||
|
||
<template> | ||
|
@@ -303,21 +310,23 @@ const renderListItem = (label, clientNumbers) => { | |
|
||
</cds-breadcrumb> | ||
|
||
<h1 class="submission-details--title"> | ||
<h1 class="submission-details--title" v-if="userhasAuthority"> | ||
<span> | ||
{{ toTitleCase(data.business.organizationName) }} | ||
</span> | ||
</h1> | ||
<div v-if="userhasAuthority"> | ||
<p class="body-02 light-theme-text-text-secondary" data-testid="subtitle" v-if="data.submissionType === 'Auto approved client'">Check this new client data</p> | ||
<p class="body-02 light-theme-text-text-secondary" data-testid="subtitle" v-else>Check and manage this submission for a new client number</p> | ||
</div> | ||
</div> | ||
|
||
<div class="hide-when-less-than-two-children"><!-- | ||
This div is necessary to avoid the div.header-offset below from interfering in the flex flow. | ||
--> | ||
<div data-scroll="top-notification" class="header-offset"></div> | ||
<cds-actionable-notification | ||
v-if="networkErrorMsg !== ''" | ||
v-if="networkErrorMsg !== '' && userhasAuthority" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
|
@@ -331,7 +340,7 @@ const renderListItem = (label, clientNumbers) => { | |
</cds-actionable-notification> | ||
|
||
<cds-actionable-notification | ||
v-if="reviewConflictError" | ||
v-if="reviewConflictError && userhasAuthority" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
|
@@ -346,7 +355,7 @@ const renderListItem = (label, clientNumbers) => { | |
</div> | ||
|
||
<cds-actionable-notification | ||
v-if="data.submissionType === 'Auto approved client'" | ||
v-if="data.submissionType === 'Auto approved client' && userhasAuthority" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
|
@@ -363,7 +372,7 @@ const renderListItem = (label, clientNumbers) => { | |
</cds-actionable-notification> | ||
|
||
<cds-inline-notification | ||
v-if="data.submissionType === 'Review new client' && data.submissionStatus === 'Approved'" | ||
v-if="data.submissionType === 'Review new client' && data.submissionStatus === 'Approved' && userhasAuthority" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
|
@@ -378,7 +387,8 @@ const renderListItem = (label, clientNumbers) => { | |
v-if=" | ||
data.submissionType === 'Review new client' && | ||
data.matchers.goodStanding === 'Value not found' && | ||
data.submissionStatus !== 'Approved' | ||
data.submissionStatus !== 'Approved' && | ||
userhasAuthority | ||
" | ||
v-shadow="true" | ||
low-contrast="true" | ||
|
@@ -398,7 +408,12 @@ const renderListItem = (label, clientNumbers) => { | |
</cds-actionable-notification> | ||
|
||
<cds-actionable-notification | ||
v-if="data.submissionType === 'Review new client' && matchingData.length > 0 && data.submissionStatus !== 'Approved'" | ||
v-if=" | ||
data.submissionType === 'Review new client' && | ||
matchingData.length > 0 && | ||
data.submissionStatus !== 'Approved' && | ||
userhasAuthority | ||
" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
|
@@ -424,7 +439,36 @@ const renderListItem = (label, clientNumbers) => { | |
</div> | ||
</cds-actionable-notification> | ||
|
||
<div class="grouping-14"> | ||
<cds-actionable-notification | ||
v-if="!userhasAuthority" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
open="true" | ||
kind="error" | ||
title="You are not authorized to access this page" | ||
> | ||
<div> | ||
Please email [email protected] for help | ||
</div> | ||
</cds-actionable-notification> | ||
|
||
<cds-actionable-notification | ||
v-if="isNotEditor" | ||
v-shadow="true" | ||
low-contrast="true" | ||
hide-close-button="true" | ||
open="true" | ||
kind="warning" | ||
title="You are not authorized to modify client information" | ||
> | ||
<div> | ||
<p>To change your role please contact Client Admin through email [email protected] for help | ||
</p> | ||
</div> | ||
</cds-actionable-notification> | ||
|
||
<div class="grouping-14" v-if="userhasAuthority"> | ||
<div class="grouping-05-short"> | ||
<div> | ||
<h2 class="mg-tl-2 heading-06">Client summary</h2> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters