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 useAppConfig from 'hooks/useAppConfig.ee';
|
||||
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
||||
import * as URLS from 'config/urls';
|
||||
import SplitButton from 'components/SplitButton';
|
||||
import ConditionalIconButton from 'components/ConditionalIconButton';
|
||||
@@ -62,6 +63,8 @@ export default function Application() {
|
||||
const { data: appConfig } = useAppConfig(appKey);
|
||||
const connectionId = searchParams.get('connectionId') || undefined;
|
||||
|
||||
const currentUserAbility = useCurrentUserAbility();
|
||||
|
||||
const goToApplicationPage = () => navigate('connections');
|
||||
|
||||
const connectionOptions = React.useMemo(() => {
|
||||
@@ -125,6 +128,7 @@ export default function Application() {
|
||||
)}
|
||||
fullWidth
|
||||
icon={<AddIcon />}
|
||||
disabled={!currentUserAbility.can('create', 'Flow')}
|
||||
>
|
||||
{formatMessage('app.createFlow')}
|
||||
</ConditionalIconButton>
|
||||
|
Reference in New Issue
Block a user