From 80e52689e8461b33ca0efdcc8cb992ad669ec500 Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Wed, 18 Oct 2023 10:17:23 +0100 Subject: [PATCH] SecuredByRole fails if app roles are not loaded (#3753) Fixes #3752 --- CHANGELOG.md | 1 + ui/app/package.json | 2 +- ui/app/src/components/shared/SecuredByRole.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96d2231b44..3dc9263972 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ENHANCEMENTS: BUG FIXES: * Upgrade porter version to v1.0.15 and on error getting porter outputs return dict ([#3744](https://github.com/microsoft/AzureTRE/issues/3744)) * Fix notifications displaying workspace name rather than actual resource ([#3746](https://github.com/microsoft/AzureTRE/issues/3746)) +* Fix SecuredByRole fails if app roles are not loaded ([#3752](https://github.com/microsoft/AzureTRE/issues/3752)) COMPONENTS: diff --git a/ui/app/package.json b/ui/app/package.json index 6680a1f389..3659d79274 100644 --- a/ui/app/package.json +++ b/ui/app/package.json @@ -1,6 +1,6 @@ { "name": "tre-ui", - "version": "0.5.12", + "version": "0.5.14", "private": true, "dependencies": { "@azure/msal-browser": "^2.35.0", diff --git a/ui/app/src/components/shared/SecuredByRole.tsx b/ui/app/src/components/shared/SecuredByRole.tsx index 197ff213df..2c1e8cb343 100644 --- a/ui/app/src/components/shared/SecuredByRole.tsx +++ b/ui/app/src/components/shared/SecuredByRole.tsx @@ -47,7 +47,7 @@ export const SecuredByRole: React.FunctionComponent = (props }, [apiCall, workspaceCtx.workspace.id, props.workspaceId, workspaceCtx.roles]); return ( - ((workspaceRoles && workspaceRoles.some(x => props.allowedWorkspaceRoles?.includes(x))) || (appRoles && appRoles.roles.some(x => props.allowedAppRoles?.includes(x)))) + (workspaceRoles?.some(x => props.allowedWorkspaceRoles?.includes(x)) || appRoles?.roles?.some(x => props.allowedAppRoles?.includes(x))) ? props.element : (props.errorString && (workspaceRoles.length > 0 || appRoles.roles.length > 0) ?