Skip to content

Commit

Permalink
fix: add admin guard to groups (#4069)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nunogois committed Jun 22, 2023
1 parent bd45a26 commit 40a4451
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/src/component/admin/groups/GroupsAdmin.tsx
@@ -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>
);
};

0 comments on commit 40a4451

Please sign in to comment.