Skip to content

Commit

Permalink
🐛 Address required manage credential scopes (#1627)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Dec 15, 2023
1 parent 86ac8ac commit 61235d2
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
applicationsWriteScopes,
assessmentReadScopes,
assessmentWriteScopes,
credentialsReadScopes,
credentialsWriteScopes,
dependenciesWriteScopes,
importsWriteScopes,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -578,6 +580,7 @@ export const ApplicationsTable: React.FC = () => {
</DropdownItem>,
]
: [];

const applicationDropdownItems = applicationWriteAccess
? [
<ConditionalTooltip
Expand All @@ -597,17 +600,22 @@ export const ApplicationsTable: React.FC = () => {
{t("actions.delete")}
</DropdownItem>
</ConditionalTooltip>,
<DropdownItem
key="manage-applications-credentials"
isDisabled={selectedRows.length < 1}
onClick={() => {
setSaveApplicationsCredentialsModalState(selectedRows);
}}
>
{t("actions.manageCredentials")}
</DropdownItem>,
...(credentialsReadAccess
? [
<DropdownItem
key="manage-applications-credentials"
isDisabled={selectedRows.length < 1}
onClick={() => {
setSaveApplicationsCredentialsModalState(selectedRows);
}}
>
{t("actions.manageCredentials")}
</DropdownItem>,
]
: []),
]
: [];

const dropdownItems = [...importDropdownItems, ...applicationDropdownItems];

const isAnalyzingAllowed = () => {
Expand Down Expand Up @@ -1011,7 +1019,7 @@ export const ApplicationsTable: React.FC = () => {
]
: []),

...(credentialsWriteAccess
...(credentialsReadAccess && applicationWriteAccess
? [
{
title: t("actions.manageCredentials"),
Expand Down

0 comments on commit 61235d2

Please sign in to comment.