Skip to content

Commit bd4464e

Browse files
committed
Show updater tab only to grp-toska members
1 parent 424470d commit bd4464e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/client/components/Admin/index.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import ChatInstances from './ChatInstances'
1515
import Usage from './Usage'
1616
import Updater from './Updater'
1717
import EditTexts from './EditTexts'
18+
import useCurrentUser from '../../hooks/useCurrentUser'
1819

1920
const stripSearch = (path: string) => path.split('?')[0]
2021

@@ -30,6 +31,9 @@ const RouterTabs = ({ children }: { children: React.ReactElement[] }) => {
3031

3132
const Admin = () => {
3233
const { t } = useTranslation()
34+
const { user, isLoading } = useCurrentUser()
35+
36+
if (isLoading) return null
3337

3438
return (
3539
<Box>
@@ -41,11 +45,13 @@ const Admin = () => {
4145
component={Link}
4246
/>
4347
<Tab label={t('admin:usage')} to="/admin/usage" component={Link} />
44-
<Tab
45-
label={t('admin:updater')}
46-
to="/admin/updater"
47-
component={Link}
48-
/>
48+
{user.iamGroups.includes('grp-toska') && (
49+
<Tab
50+
label={t('admin:updater')}
51+
to="/admin/updater"
52+
component={Link}
53+
/>
54+
)}
4955
<Tab
5056
label={t('admin:editTexts')}
5157
to="/admin/edit-texts"
@@ -57,7 +63,9 @@ const Admin = () => {
5763
<Route path="/" element={<Navigate to="/admin/chatinstances" />} />
5864
<Route path="/chatinstances" element={<ChatInstances />} />
5965
<Route path="/usage" element={<Usage />} />
60-
<Route path="/updater" element={<Updater />} />
66+
{user.iamGroups.includes('grp-toska') && (
67+
<Route path="/updater" element={<Updater />} />
68+
)}
6169
<Route path="/edit-texts" element={<EditTexts />} />
6270
</Routes>
6371
</Box>

0 commit comments

Comments
 (0)