fix: disable create flow button when user doesn't have permissions
This commit is contained in:
@@ -19,6 +19,7 @@ import AddIcon from '@mui/icons-material/Add';
|
|||||||
|
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import useAppConfig from 'hooks/useAppConfig.ee';
|
import useAppConfig from 'hooks/useAppConfig.ee';
|
||||||
|
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import SplitButton from 'components/SplitButton';
|
import SplitButton from 'components/SplitButton';
|
||||||
import ConditionalIconButton from 'components/ConditionalIconButton';
|
import ConditionalIconButton from 'components/ConditionalIconButton';
|
||||||
@@ -62,6 +63,8 @@ export default function Application() {
|
|||||||
const { data: appConfig } = useAppConfig(appKey);
|
const { data: appConfig } = useAppConfig(appKey);
|
||||||
const connectionId = searchParams.get('connectionId') || undefined;
|
const connectionId = searchParams.get('connectionId') || undefined;
|
||||||
|
|
||||||
|
const currentUserAbility = useCurrentUserAbility();
|
||||||
|
|
||||||
const goToApplicationPage = () => navigate('connections');
|
const goToApplicationPage = () => navigate('connections');
|
||||||
|
|
||||||
const connectionOptions = React.useMemo(() => {
|
const connectionOptions = React.useMemo(() => {
|
||||||
@@ -125,6 +128,7 @@ export default function Application() {
|
|||||||
)}
|
)}
|
||||||
fullWidth
|
fullWidth
|
||||||
icon={<AddIcon />}
|
icon={<AddIcon />}
|
||||||
|
disabled={!currentUserAbility.can('create', 'Flow')}
|
||||||
>
|
>
|
||||||
{formatMessage('app.createFlow')}
|
{formatMessage('app.createFlow')}
|
||||||
</ConditionalIconButton>
|
</ConditionalIconButton>
|
||||||
|
Reference in New Issue
Block a user