From d6cdf094046540e19fabbc55e680e39d1442d790 Mon Sep 17 00:00:00 2001 From: ibolton336 Date: Thu, 14 Dec 2023 19:57:24 -0500 Subject: [PATCH] :bug: Address required manage credential scopes Signed-off-by: ibolton336 --- .../applications-table/applications-table.tsx | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/client/src/app/pages/applications/applications-table/applications-table.tsx b/client/src/app/pages/applications/applications-table/applications-table.tsx index 96ab5b594d..d0f6e06544 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -59,6 +59,7 @@ import { applicationsWriteScopes, assessmentReadScopes, assessmentWriteScopes, + credentialsReadScopes, credentialsWriteScopes, dependenciesWriteScopes, importsWriteScopes, @@ -547,6 +548,7 @@ export const ApplicationsTable: React.FC = () => { assessmentWriteAccess = checkAccess(userScopes, assessmentWriteScopes), analysisWriteAccess = checkAccess(userScopes, analysisWriteScopes), assessmentReadAccess = checkAccess(userScopes, assessmentReadScopes), + credentialsReadAccess = checkAccess(userScopes, credentialsReadScopes), credentialsWriteAccess = checkAccess(userScopes, credentialsWriteScopes), dependenciesWriteAccess = checkAccess(userScopes, dependenciesWriteScopes), analysisReadAccess = checkAccess(userScopes, analysisReadScopes), @@ -578,6 +580,7 @@ export const ApplicationsTable: React.FC = () => { , ] : []; + const applicationDropdownItems = applicationWriteAccess ? [ { {t("actions.delete")} , - { - setSaveApplicationsCredentialsModalState(selectedRows); - }} - > - {t("actions.manageCredentials")} - , + ...(credentialsReadAccess + ? [ + { + setSaveApplicationsCredentialsModalState(selectedRows); + }} + > + {t("actions.manageCredentials")} + , + ] + : []), ] : []; + const dropdownItems = [...importDropdownItems, ...applicationDropdownItems]; const isAnalyzingAllowed = () => { @@ -1011,7 +1019,7 @@ export const ApplicationsTable: React.FC = () => { ] : []), - ...(credentialsWriteAccess + ...(credentialsReadAccess && applicationWriteAccess ? [ { title: t("actions.manageCredentials"),