From 3afa259affc74b6649eeef06daccced2f80b3d19 Mon Sep 17 00:00:00 2001 From: johnnadeluy Date: Fri, 15 Mar 2024 12:59:36 +0100 Subject: [PATCH] Give add/edit usert access to test admin users for team detail --- src/pages/TeamDetail/TeamDetail.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/TeamDetail/TeamDetail.tsx b/src/pages/TeamDetail/TeamDetail.tsx index cc0b8f46..c45550ce 100644 --- a/src/pages/TeamDetail/TeamDetail.tsx +++ b/src/pages/TeamDetail/TeamDetail.tsx @@ -397,6 +397,14 @@ const TeamDetail = () => { } const teamManager = teamDetailData ? (teamDetailData?.team as Team).manager?.principal_name : '' + const testAdminUsersConditionals: boolean[] = [] + const DAPLA_CTRL_TEST_ADMIN_USERS = import.meta.env.VITE_DAPLA_CTRL_TEST_ADMIN_USERS + if (!import.meta.env.PROD && DAPLA_CTRL_TEST_ADMIN_USERS) { + DAPLA_CTRL_TEST_ADMIN_USERS.split(';').map((testAdminUser: string) => + testAdminUsersConditionals.push(tokenData?.email === testAdminUser) + ) + } + const testAdminUsers = testAdminUsersConditionals.length ? eval(testAdminUsersConditionals.join(' || ')) : '' return ( <> {renderSidebarModal()} @@ -410,7 +418,7 @@ const TeamDetail = () => { } content={renderContent()} button={ - tokenData?.email === teamManager ? ( + tokenData?.email === teamManager || testAdminUsers ? ( ) : undefined }