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:
parent
bd45a268ce
commit
40a4451818
@ -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>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user