Skip to content

Commit

Permalink
Give add/edit usert access to test admin users for team detail
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnadeluy committed Mar 15, 2024
1 parent bf1b462 commit 3afa259
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pages/TeamDetail/TeamDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
Expand All @@ -410,7 +418,7 @@ const TeamDetail = () => {
}
content={renderContent()}
button={
tokenData?.email === teamManager ? (
tokenData?.email === teamManager || testAdminUsers ? (
<Button onClick={() => setOpenSidebar(true)}>+ Nytt medlem</Button>
) : undefined
}
Expand Down

0 comments on commit 3afa259

Please sign in to comment.