diff --git a/packages/manager/.changeset/pr-11094-fixed-1728923124356.md b/packages/manager/.changeset/pr-11094-fixed-1728923124356.md new file mode 100644 index 00000000000..e08a8954220 --- /dev/null +++ b/packages/manager/.changeset/pr-11094-fixed-1728923124356.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Fixed +--- + +Disable Create Firewall button with tooltip text on Landing Page for restricted users ([#11094](https://github.com/linode/manager/pull/11094)) diff --git a/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLanding.tsx b/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLanding.tsx index 415f3ed482a..96b3bef8dba 100644 --- a/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLanding.tsx +++ b/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLanding.tsx @@ -19,8 +19,10 @@ import { useFlags } from 'src/hooks/useFlags'; import { useOrder } from 'src/hooks/useOrder'; import { usePagination } from 'src/hooks/usePagination'; import { useSecureVMNoticesEnabled } from 'src/hooks/useSecureVMNoticesEnabled'; +import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck'; import { useFirewallsQuery } from 'src/queries/firewalls'; import { getAPIErrorOrDefault } from 'src/utilities/errorUtils'; +import { getRestrictedResourceText } from 'src/features/Account/utils'; import { CreateFirewallDrawer } from './CreateFirewallDrawer'; import { FirewallDialog } from './FirewallDialog'; @@ -73,6 +75,10 @@ const FirewallLanding = () => { (firewall) => firewall.id === selectedFirewallId ); + const isFirewallsCreationRestricted = useRestrictedGlobalGrantCheck({ + globalGrantType: 'add_firewalls', + }); + const openModal = (mode: Mode, id: number) => { setSelectedFirewallId(id); setDialogMode(mode); @@ -148,8 +154,16 @@ const FirewallLanding = () => { breadcrumbProps={{ pathname: '/firewalls' }} docsLink="https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-cloud-firewalls" entity="Firewall" + disabledCreateButton={isFirewallsCreationRestricted} onButtonClick={onOpenCreateDrawer} title="Firewalls" + buttonDataAttrs={{ + tooltipText: getRestrictedResourceText({ + action: 'create', + isSingular: false, + resourceType: 'Firewalls', + }), + }} />