1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: add admin guard to groups (#4069)

Adds an admin guard to groups: It is an admin feature and should be
guarded on the UI the same way other admin features are.
This commit is contained in:
Nuno Góis 2023-06-22 15:37:02 +01:00 committed by GitHub
parent bd45a268ce
commit 40a4451818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,20 @@
import { AdminAlert } from 'component/common/AdminAlert/AdminAlert';
import { GroupsList } from './GroupsList/GroupsList';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { useContext } from 'react';
import AccessContext from 'contexts/AccessContext';
import { ADMIN } from '@server/types/permissions';
export const GroupsAdmin = () => {
const { hasAccess } = useContext(AccessContext);
return (
<div>
<GroupsList />
<ConditionallyRender
condition={hasAccess(ADMIN)}
show={<GroupsList />}
elseShow={<AdminAlert />}
/>
</div>
);
};