mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
* fix: group project access inconsistencies * fix relative path * wip * refactor: make project tabs work as routes * refactor: finish refactoring project assign forms * fix: update snaps * fix: update snaps * add some basic cypress e2e tests to groups * add remaining cypress e2e tests for group CRUD * add groups e2e to gh workflows * refactor: simplify useMemo usage * add GO_BACK navigate const * fix: remove trailing slash on user creation request Co-authored-by: olav <mail@olav.io> Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
import { useContext } from 'react';
|
||
import { PageContent } from 'component/common/PageContent/PageContent';
|
||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||
import { Alert } from '@mui/material';
|
||
import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
||
import AccessContext from 'contexts/AccessContext';
|
||
import { UPDATE_PROJECT } from 'component/providers/AccessProvider/permissions';
|
||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||
import { usePageTitle } from 'hooks/usePageTitle';
|
||
import { ProjectAccessTable } from 'component/project/ProjectAccess/ProjectAccessTable/ProjectAccessTable';
|
||
import { useProjectNameOrId } from 'hooks/api/getters/useProject/useProject';
|
||
|
||
export const ProjectAccess = () => {
|
||
const projectId = useRequiredPathParam('projectId');
|
||
const projectName = useProjectNameOrId(projectId);
|
||
const { hasAccess } = useContext(AccessContext);
|
||
const { isOss } = useUiConfig();
|
||
usePageTitle(`Project access – ${projectName}`);
|
||
|
||
if (isOss()) {
|
||
return (
|
||
<PageContent header={<PageHeader title="Project access" />}>
|
||
<Alert severity="error">
|
||
Controlling access to projects requires a paid version of
|
||
Unleash. Check out{' '}
|
||
<a
|
||
href="https://www.getunleash.io"
|
||
target="_blank"
|
||
rel="noreferrer"
|
||
>
|
||
getunleash.io
|
||
</a>{' '}
|
||
to find out more.
|
||
</Alert>
|
||
</PageContent>
|
||
);
|
||
}
|
||
|
||
if (!hasAccess(UPDATE_PROJECT, projectId)) {
|
||
return (
|
||
<PageContent header={<PageHeader title="Project access" />}>
|
||
<Alert severity="error">
|
||
You need project owner permissions to access this section.
|
||
</Alert>
|
||
</PageContent>
|
||
);
|
||
}
|
||
|
||
return <ProjectAccessTable />;
|
||
};
|