2022-06-03 08:14:47 +02:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import { ProjectAccessPage } from 'component/project/ProjectAccess/ProjectAccessPage';
|
2022-05-09 14:38:12 +02:00
|
|
|
import { PageContent } from 'component/common/PageContent/PageContent';
|
2022-03-07 09:26:31 +01:00
|
|
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
2022-06-03 08:14:47 +02:00
|
|
|
import { Alert } from '@mui/material';
|
2022-05-09 14:38:12 +02:00
|
|
|
import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
2022-06-03 08:14:47 +02:00
|
|
|
import AccessContext from 'contexts/AccessContext';
|
|
|
|
import { UPDATE_PROJECT } from 'component/providers/AccessProvider/permissions';
|
2022-05-05 13:42:18 +02:00
|
|
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
2021-10-12 13:21:45 +02:00
|
|
|
|
2022-02-09 12:25:02 +01:00
|
|
|
export const ProjectAccess = () => {
|
2022-05-05 13:42:18 +02:00
|
|
|
const projectId = useRequiredPathParam('projectId');
|
2022-06-03 08:14:47 +02:00
|
|
|
const { hasAccess } = useContext(AccessContext);
|
2021-10-12 13:21:45 +02:00
|
|
|
const { isOss } = useUiConfig();
|
2022-05-26 10:37:33 +02:00
|
|
|
|
|
|
|
if (isOss()) {
|
|
|
|
return (
|
2022-06-03 08:14:47 +02:00
|
|
|
<PageContent header={<PageHeader title="Project access" />}>
|
2022-05-26 10:37:33 +02:00
|
|
|
<Alert severity="error">
|
|
|
|
Controlling access to projects requires a paid version of
|
|
|
|
Unleash. Check out{' '}
|
2022-06-03 08:14:47 +02:00
|
|
|
<a
|
|
|
|
href="https://www.getunleash.io"
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
|
|
|
>
|
2022-05-26 10:37:33 +02:00
|
|
|
getunleash.io
|
|
|
|
</a>{' '}
|
|
|
|
to find out more.
|
|
|
|
</Alert>
|
|
|
|
</PageContent>
|
|
|
|
);
|
|
|
|
}
|
2022-02-09 12:25:02 +01:00
|
|
|
|
2022-06-03 08:14:47 +02:00
|
|
|
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>
|
|
|
|
);
|
|
|
|
}
|
2022-02-09 12:25:02 +01:00
|
|
|
|
2022-06-03 08:14:47 +02:00
|
|
|
return <ProjectAccessPage />;
|
2021-03-11 13:59:20 +01:00
|
|
|
};
|