Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement: revamp access restricted display
Scott Wilson577ae27ba114
diff --git a/frontend/src/components/permissions/OrgPermissionCan.tsx b/frontend/src/components/permissions/OrgPermissionCan.tsxindex bdb39ba1b8..3537b2c27c 100644--- a/frontend/src/components/permissions/OrgPermissionCan.tsx+++ b/frontend/src/components/permissions/OrgPermissionCan.tsx@@ -3,17 +3,22 @@ import { AbilityTuple, MongoAbility } from "@casl/ability";import { Can } from "@casl/react";import { TooltipProps } from "@app/components/v2/Tooltip/Tooltip";+import {+ AccessRestrictedDialog,+ TAccessRestrictedRequirement,+ toPermissionRequirement+} from "@app/components/v3";import { useOrgPermission } from "@app/context/OrgPermissionContext";import { OrgPermissionSet } from "@app/context/OrgPermissionContext/types";-import { AccessRestrictedBanner, Tooltip } from "../v2";+import { Tooltip } from "../v2";-export const OrgPermissionGuardBanner = () => {- return (- <div className="container mx-auto flex h-full items-center justify-center">- <AccessRestrictedBanner />- </div>- );+export const OrgPermissionGuardBanner = ({+ requirement+}: {+ requirement?: TAccessRestrictedRequirement;+}) => {+ return <AccessRestrictedDialog requirement={requirement} />;};type Props<T extends AbilityTuple> = {@@ -71,7 +76,11 @@ export const OrgPermissionCan: FunctionComponent<Props<OrgPermissionSet>> = ({}if (!isAllowed && renderGuardBanner) {- return <OrgPermissionGuardBanner />;+ return (+ <OrgPermissionGuardBanner+ requirement={toPermissionRequirement(props.I, "a" in props ? props.a : props.an)}+ />+ );}if (!isAllowed) return null;diff --git a/frontend/src/components/permissions/PermissionDeniedBanner.tsx b/frontend/src/components/permissions/PermissionDeniedBanner.tsxindex 3f86a7257e..ea423bf612 100644--- a/frontend/src/components/permissions/PermissionDeniedBanner.tsx+++ b/frontend/src/components/permissions/PermissionDeniedBanner.tsx@@ -1,20 +1,9 @@-import { twMerge } from "tailwind-merge";--import { AccessRestrictedBanner } from "@app/components/v2";+import { AccessRestrictedNotice } from "@app/components/v3";type Props = {containerClassName?: string;};export const PermissionDeniedBanner = ({ containerClassName }: Props) => {- return (- <div- className={twMerge(- "container mx-auto flex h-full items-center justify-center",- containerClassName- )}- >- <AccessRestrictedBanner />- </div>- );+ return <AccessRestrictedNotice className={containerClassName} />;};diff --git a/frontend/src/components/permissions/ProjectPermissionCan.tsx b/frontend/src/components/permissions/ProjectPermissionCan.tsxindex 88a8c6ad9f..c4c266d2da 100644--- a/frontend/src/components/permissions/ProjectPermissionCan.tsx+++ b/frontend/src/components/permissions/ProjectPermissionCan.tsx@@ -2,17 +2,21 @@ import { FunctionComponent, ReactNode } from "react";import { AbilityTuple, MongoAbility } from "@casl/ability";import { Can } from "@casl/react";-import { AccessRestrictedBanner } from "@app/components/v2";+import {+ AccessRestrictedDialog,+ TAccessRestrictedRequirement,+ toPermissionRequirement+} from "@app/components/v3";import { ProjectPermissionSet, useProjectPermission } from "@app/context/ProjectPermissionContext";import { Tooltip } from "../v2/Tooltip";-export const ProjectPermissionGuardBanner = () => {- return (- <div className="container mx-auto flex h-full items-center justify-center">- <AccessRestrictedBanner />- </div>- );+export const ProjectPermissionGuardBanner = ({+ requirement+}: {+ requirement?: TAccessRestrictedRequirement;+}) => {+ return <AccessRestrictedDialog requirement={requirement} />;};type Props<T extends AbilityTuple> = {@@ -47,7 +51,9 @@ export const ProjectPermissionCan: FunctionComponent<Props<ProjectPermissionSet>typeof children === "function" ? children(isAllowed, ability as any) : children;if (!isAllowed && renderGuardBanner) {- return <ProjectPermissionGuardBanner />;+ return (+ <ProjectPermissionGuardBanner requirement={toPermissionRequirement(props.I, props.a)} />+ );}if (!isAllowed && passThrough) {diff --git a/frontend/src/components/v2/AccessRestrictedBanner/AccessRestrictedBanner.tsx b/frontend/src/components/v2/AccessRestrictedBanner/AccessRestrictedBanner.tsxdeleted file mode 100644index 5e4b8af932..0000000000--- a/frontend/src/components/v2/AccessRestrictedBanner/AccessRestrictedBanner.tsx+++ /dev/null@@ -1,25 +0,0 @@-import { ReactNode } from "react";-import { LockIcon } from "lucide-react";--import { Badge, Card } from "@app/components/v3";--type Props = {- title?: string;- body?: ReactNode;-};--export const AccessRestrictedBanner = ({- title = "Access Restricted",- body = "Your current role doesn't provide access to this feature. Contact your administrator to request access."-}: Props) => {- return (- <Card className="w-full max-w-lg items-start gap-4 p-8">- <Badge variant="warning" className="h-6 px-2">- <LockIcon />- {title}- </Badge>- <div className="text-2xl font-semibold">This section is locked.</div>- <div className="text-sm leading-relaxed text-accent">{body}</div>- </Card>- );-};diff --git a/frontend/src/components/v2/AccessRestrictedBanner/index.ts b/frontend/src/components/v2/AccessRestrictedBanner/index.tsdeleted file mode 100644index d60468572d..0000000000--- a/frontend/src/components/v2/AccessRestrictedBanner/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./AccessRestrictedBanner";diff --git a/frontend/src/components/v2/index.tsx b/frontend/src/components/v2/index.tsxindex cb4430aa43..fb680827e9 100644--- a/frontend/src/components/v2/index.tsx+++ b/frontend/src/components/v2/index.tsx@@ -1,5 +1,4 @@/* eslint-disable react-refresh/only-export-components */-export * from "./AccessRestrictedBanner";export * from "./Accordion";export * from "./Alert";export * from "./Breadcrumb";diff --git a/frontend/src/components/v3/platform/AccessRestricted/AccessRestrictedDialog.tsx b/frontend/src/components/v3/platform/AccessRestricted/AccessRestrictedDialog.tsxnew file mode 100644index 0000000000..f9ca72ed08--- /dev/null+++ b/frontend/src/components/v3/platform/AccessRestricted/AccessRestrictedDialog.tsx@@ -0,0 +1,156 @@+import { ReactNode } from "react";+import { Link } from "@tanstack/react-router";+import { ArrowLeftIcon, ExternalLinkIcon, HouseIcon, InfoIcon, LockIcon } from "lucide-react";++import { Badge } from "../../generic/Badge";+import { Button } from "../../generic/Button";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle+} from "../../generic/Dialog";+import { cn } from "../../utils";++const RBAC_DOCS_URL =+ "https://infisical.com/docs/documentation/platform/access-controls/role-based-access-controls";++// Fixed widths, not randomized ones, so the backdrop reads as a uniform redaction pattern+// rather than implying a specific number or shape of records the viewer is missing.+const REDACTED_ROW_WIDTHS = ["w-48", "w-64", "w-40", "w-56", "w-44", "w-60", "w-52", "w-36"];++// The gated page can't be rendered behind the dialog — its queries would 403, and the suspense+// ones would escalate into the router error boundary — so the region keeps page-shaped volume+// with inert bars instead.+const RedactedBackdrop = () => (+ <div+ aria-hidden+ className="pointer-events-none w-full [mask-image:linear-gradient(to_bottom,black_65%,transparent_100%)] select-none"+ >+ <div className="flex flex-col gap-4 rounded-lg border border-border bg-card p-5 blur-[2px]">+ <div className="flex items-center justify-between gap-3">+ <div className="h-4 w-44 rounded-xs bg-foreground/25" />+ <div className="h-8 w-28 rounded-md bg-foreground/10" />+ </div>+ <div className="h-9 w-full rounded-md bg-container" />+ <div className="flex flex-col">+ {REDACTED_ROW_WIDTHS.map((width) => (+ <div key={width} className="flex items-center gap-4 border-t border-border py-4">+ <div className="size-3.5 shrink-0 rounded-xs bg-foreground/15" />+ <div className={cn("h-3 rounded-xs bg-foreground/20", width)} />+ <div className="ml-auto h-3 w-16 rounded-xs bg-foreground/12" />+ </div>+ ))}+ </div>+ </div>+ </div>+);++export type TAccessRestrictedRequirement = {+ action: string;+ subject: string;+};++// CASL allows non-string subjects (class refs, tagged objects), and permission gates are typed+// loosely enough to pass one through. Only render the requirement when both halves are printable.+export const toPermissionRequirement = (+ action: unknown,+ subject: unknown+): TAccessRestrictedRequirement | undefined =>+ typeof action === "string" && typeof subject === "string" ? { action, subject } : undefined;++type Props = {+ // First line of the two-line heading, matching the error-page family.+ title?: string;+ subtitle?: string;+ description?: ReactNode;+ // The CASL action/subject the viewer is missing. Shown verbatim so an operator can hand it to+ // whoever edits their role.+ requirement?: TAccessRestrictedRequirement;+ docsUrl?: string;+ // Extra call to action rendered after "Back to Home" — e.g. a request-access flow on the+ // surfaces that have one.+ action?: ReactNode;+ className?: string;+};++/**+ * Page- and tab-level permission gate, styled to the ErrorPage/ForbiddenPage family. Leaves the+ * surrounding page chrome visible and interactive (the dialog is deliberately non-modal, so the+ * sidebar and sibling tabs still work) and floats the explanation over a redacted stand-in for+ * the content.+ *+ * For a single section inside an otherwise usable page, use AccessRestrictedNotice instead.+ */+export const AccessRestrictedDialog = ({+ title = "You're one permission away.",+ subtitle = "An admin can grant it.",+ description = "Your role doesn't include the permission this page requires.",+ requirement,+ docsUrl = RBAC_DOCS_URL,+ action,+ className+}: Props) => {+ const monoRows: [string, string][] = [+ ...(requirement+ ? ([["requires", `${requirement.action} on ${requirement.subject}`]] as [string, string][])+ : []),+ ["route", window.location.pathname]+ ];++ return (+ <div className={cn("relative w-full py-2", className)}>+ <RedactedBackdrop />+ {/* Held open with no onOpenChange: this is a page state, not a dismissible dialog. */}+ <Dialog open modal={false}>+ <DialogContent showCloseButton={false} className="max-w-2xl gap-5">+ <DialogHeader className="items-start gap-5">+ <Badge variant="warning" className="h-6 px-2">+ <LockIcon />+ Access Restricted+ </Badge>+ <DialogTitle className="text-3xl leading-tight font-semibold">+ {title}+ <br />+ <span className="text-2xl">{subtitle}</span>+ </DialogTitle>+ <DialogDescription className="leading-relaxed">{description}</DialogDescription>+ </DialogHeader>+ <div className="flex flex-col gap-1.5 rounded-md border border-border bg-bunker-800/50 px-4 py-3">+ {monoRows.map(([key, value]) => (+ <div key={key} className="flex gap-4 font-mono text-xs">+ <span className="w-16 shrink-0 text-muted">{key}</span>+ <span className="break-all text-label">{value}</span>+ </div>+ ))}+ </div>+ <a+ href={docsUrl}+ target="_blank"+ rel="noopener noreferrer"+ className="flex w-fit items-center gap-1.5 text-xs text-info transition-colors hover:text-info/75"+ >+ <InfoIcon className="size-3.5" />+ Access control documentation+ <ExternalLinkIcon className="size-3" />+ </a>+ <DialogFooter>+ <Button variant="outline" onClick={() => window.history.back()}>+ <ArrowLeftIcon />+ Go Back+ </Button>+ <Button variant="neutral" asChild>+ <Link to="/">+ <HouseIcon />+ Back to Home+ </Link>+ </Button>+ {action}+ </DialogFooter>+ </DialogContent>+ </Dialog>+ </div>+ );+};diff --git a/frontend/src/components/v3/platform/AccessRestricted/AccessRestrictedNotice.tsx b/frontend/src/components/v3/platform/AccessRestricted/AccessRestrictedNotice.tsxnew file mode 100644index 0000000000..295705fc10--- /dev/null+++ b/frontend/src/components/v3/platform/AccessRestricted/AccessRestrictedNotice.tsx@@ -0,0 +1,37 @@+import { ReactNode } from "react";+import { LockIcon } from "lucide-react";++import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../../generic/Empty";+import { cn } from "../../utils";++type Props = {+ title?: string;+ description?: ReactNode;+ className?: string;+};++/**+ * Section-level restriction notice: sits where the section's content would go while the rest of+ * the page stays usable. Page- and tab-level gates use AccessRestrictedDialog instead.+ */+export const AccessRestrictedNotice = ({+ title = "Access Restricted",+ description = (+ <>+ Your role doesn't include permission to view this section.+ <br />+ An administrator can grant it.+ </>+ ),+ className+}: Props) => (+ <Empty className={cn("border", className)}>+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <LockIcon />+ </EmptyMedia>+ <EmptyTitle>{title}</EmptyTitle>+ <EmptyDescription>{description}</EmptyDescription>+ </EmptyHeader>+ </Empty>+);diff --git a/frontend/src/components/v3/platform/AccessRestricted/index.ts b/frontend/src/components/v3/platform/AccessRestricted/index.tsnew file mode 100644index 0000000000..088ea95ea9--- /dev/null+++ b/frontend/src/components/v3/platform/AccessRestricted/index.ts@@ -0,0 +1,2 @@+export * from "./AccessRestrictedDialog";+export * from "./AccessRestrictedNotice";diff --git a/frontend/src/components/v3/platform/index.ts b/frontend/src/components/v3/platform/index.tsindex 41952fa441..a430afa207 100644--- a/frontend/src/components/v3/platform/index.ts+++ b/frontend/src/components/v3/platform/index.ts@@ -1,3 +1,4 @@+export * from "./AccessRestricted";export * from "./DateRangeFilter";export * from "./DeleteConfirmDialog";export * from "./DocumentationLinkBadge";diff --git a/frontend/src/hoc/withPermission/withPermission.tsx b/frontend/src/hoc/withPermission/withPermission.tsxindex 762b067c22..7c5ad83328 100644--- a/frontend/src/hoc/withPermission/withPermission.tsx+++ b/frontend/src/hoc/withPermission/withPermission.tsx@@ -1,8 +1,7 @@import { ComponentType } from "react";import { Abilities, AbilityTuple, Generics, SubjectType } from "@casl/ability";-import { twMerge } from "tailwind-merge";-import { AccessRestrictedBanner } from "@app/components/v2";+import { AccessRestrictedDialog, toPermissionRequirement } from "@app/components/v3";import { TOrgPermission, useOrgPermission } from "@app/context";type Props<T extends Abilities> = (T extends AbilityTuple@@ -26,14 +25,10 @@ export const withPermission = <T extends object, J extends TOrgPermission>(// REASON: casl due to its type checking can't seem to union even if union intersection is appliedif (permission.cannot(action as any, subject as any)) {return (- <div- className={twMerge(- "container mx-auto flex h-full items-center justify-center",- containerClassName- )}- >- <AccessRestrictedBanner />- </div>+ <AccessRestrictedDialog+ className={containerClassName}+ requirement={toPermissionRequirement(action, subject)}+ />);}diff --git a/frontend/src/hoc/withProjectPermission/withProjectPermission.tsx b/frontend/src/hoc/withProjectPermission/withProjectPermission.tsxindex 7ba6efc57d..43e2015576 100644--- a/frontend/src/hoc/withProjectPermission/withProjectPermission.tsx+++ b/frontend/src/hoc/withProjectPermission/withProjectPermission.tsx@@ -1,8 +1,7 @@import { ComponentType } from "react";import { AbilityTuple } from "@casl/ability";-import { twMerge } from "tailwind-merge";-import { AccessRestrictedBanner } from "@app/components/v2";+import { AccessRestrictedDialog, toPermissionRequirement } from "@app/components/v3";import { useProjectPermission } from "@app/context";import { ProjectPermissionSet } from "@app/context/ProjectPermissionContext";@@ -23,14 +22,10 @@ export const withProjectPermission = <T extends object>(// REASON: casl due to its type checking can't seem to union even if union intersection is appliedif (permission.cannot(action as any, subject as any)) {return (- <div- className={twMerge(- "container mx-auto flex h-full items-center justify-center",- containerClassName- )}- >- <AccessRestrictedBanner />- </div>+ <AccessRestrictedDialog+ className={containerClassName}+ requirement={toPermissionRequirement(action, subject)}+ />);}diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsxindex a213a8bde4..70d0571230 100644--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx@@ -12,8 +12,9 @@ import {} from "lucide-react";import { createNotification } from "@app/components/notifications";-import { AccessRestrictedBanner, PageHeader } from "@app/components/v2";+import { PageHeader } from "@app/components/v2";import {+ AccessRestrictedDialog,Button,DeleteConfirmDialog,DocumentationLinkBadge,@@ -175,9 +176,7 @@ export const ApplicationDetailsByIDPage = () => {if (isAccessForbidden) {return (- <div className="container mx-auto flex h-full items-center justify-center p-16">- <AccessRestrictedBanner body="You do not have access to this application. Reach out to an administrator to request access." />- </div>+ <AccessRestrictedDialog description="You don't have access to this application. An administrator can grant it." />);}diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/CodeSigningPolicyTab.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/CodeSigningPolicyTab.tsxindex e406c29fc7..a58ca62838 100644--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/CodeSigningPolicyTab.tsx+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/CodeSigningPolicyTab.tsx@@ -1,9 +1,9 @@import { PlusIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";-import { PermissionDeniedBanner } from "@app/components/permissions";import { DeleteActionModal } from "@app/components/v2";import {+ AccessRestrictedDialog,Button,Card,CardAction,@@ -38,7 +38,9 @@ export const CodeSigningPolicyTab = () => {] as const);if (!isAdmin) {- return <PermissionDeniedBanner />;+ return (+ <AccessRestrictedDialog description="Only project admins can view and manage code signing approval policies." />+ );}const handleDeletePolicy = async () => {diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/PolicyTab.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/PolicyTab.tsxindex 48cb373911..da693be364 100644--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/PolicyTab.tsx+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/PolicyTab.tsx@@ -1,6 +1,6 @@import { createNotification } from "@app/components/notifications";-import { PermissionDeniedBanner } from "@app/components/permissions";import { DeleteActionModal } from "@app/components/v2";+import { AccessRestrictedDialog } from "@app/components/v3";import { useProject, useProjectPermission } from "@app/context";import { usePopUp } from "@app/hooks";import { ApprovalPolicyType, useDeleteApprovalPolicy } from "@app/hooks/api/approvalPolicies";@@ -25,7 +25,9 @@ export const PolicyTab = () => {] as const);if (!isAdmin) {- return <PermissionDeniedBanner />;+ return (+ <AccessRestrictedDialog description="Only project admins can view and manage certificate approval policies." />+ );}const handleDeletePolicy = async () => {diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsxindex c38b9dcd42..0328d393ea 100644--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx@@ -7,7 +7,7 @@ import { EllipsisIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";-import { AccessRestrictedBanner, DeleteActionModal, PageHeader } from "@app/components/v2";+import { DeleteActionModal, PageHeader } from "@app/components/v2";import {Button,DropdownMenu,@@ -106,6 +106,7 @@ const Page = () => {<div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">{data && (<ProjectPermissionCan+ renderGuardBannerI={ProjectPermissionCertificateAuthorityActions.Read}a={subject(ProjectPermissionSub.CertificateAuthorities, {name: data.name@@ -194,11 +195,7 @@ const Page = () => {</div></div></div>- ) : (- <div className="container mx-auto flex h-full items-center justify-center">- <AccessRestrictedBanner />- </div>- )+ ) : null}</ProjectPermissionCan>)}diff --git a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsxindex 5d1e096d78..85558652bf 100644--- a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx@@ -5,13 +5,9 @@ import { ChevronLeftIcon, EllipsisIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";import { getCertificateDisplayName } from "@app/components/utilities/certificateDisplayUtils";+import { DeleteActionModal, EmptyState, PageHeader } from "@app/components/v2";import {- AccessRestrictedBanner,- DeleteActionModal,- EmptyState,- PageHeader-} from "@app/components/v2";-import {+ AccessRestrictedDialog,Button,DropdownMenu,DropdownMenuContent,@@ -261,9 +257,12 @@ const Page = () => {pageBody = <EmptyState title="Error: Unable to find the certificate." className="py-12" />;} else if (!canReadCertificate) {pageBody = (- <div className="container mx-auto flex h-full items-center justify-center">- <AccessRestrictedBanner />- </div>+ <AccessRestrictedDialog+ requirement={{+ action: ProjectPermissionCertificateActions.Read,+ subject: ProjectPermissionSub.Certificates+ }}+ />);} else {pageBody = (diff --git a/frontend/src/pages/cert-manager/CertificatePolicyDetailsByIDPage/CertificatePolicyDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertificatePolicyDetailsByIDPage/CertificatePolicyDetailsByIDPage.tsxindex 3b46e4202d..5f60764b4e 100644--- a/frontend/src/pages/cert-manager/CertificatePolicyDetailsByIDPage/CertificatePolicyDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/CertificatePolicyDetailsByIDPage/CertificatePolicyDetailsByIDPage.tsx@@ -7,7 +7,7 @@ import { Link, useNavigate, useParams, useSearch } from "@tanstack/react-router"import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";-import { AccessRestrictedBanner, DeleteActionModal, PageHeader } from "@app/components/v2";+import { DeleteActionModal, PageHeader } from "@app/components/v2";import { ROUTE_PATHS } from "@app/const/routes";import { useOrganization, useProject } from "@app/context";import {@@ -105,6 +105,7 @@ const Page = () => {<div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">{policy && (<ProjectPermissionCan+ renderGuardBannerI={ProjectPermissionCertificatePolicyActions.Read}a={subject(ProjectPermissionSub.CertificatePolicies, { name: policy.name })}>@@ -184,11 +185,7 @@ const Page = () => {onDeleteApproved={handleDeleteConfirm}/></div>- ) : (- <div className="container mx-auto flex h-full items-center justify-center">- <AccessRestrictedBanner />- </div>- )+ ) : null}</ProjectPermissionCan>)}diff --git a/frontend/src/pages/cert-manager/CertificateProfileDetailsByIDPage/CertificateProfileDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertificateProfileDetailsByIDPage/CertificateProfileDetailsByIDPage.tsxindex 466a8c6da4..5339b64a99 100644--- a/frontend/src/pages/cert-manager/CertificateProfileDetailsByIDPage/CertificateProfileDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/CertificateProfileDetailsByIDPage/CertificateProfileDetailsByIDPage.tsx@@ -7,7 +7,7 @@ import { Link, useNavigate, useParams, useSearch } from "@tanstack/react-router"import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";-import { AccessRestrictedBanner, DeleteActionModal, PageHeader } from "@app/components/v2";+import { DeleteActionModal, PageHeader } from "@app/components/v2";import { ROUTE_PATHS } from "@app/const/routes";import { useOrganization, useProject } from "@app/context";import {@@ -92,6 +92,7 @@ const Page = () => {<div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">{profile && (<ProjectPermissionCan+ renderGuardBannerI={ProjectPermissionCertificateProfileActions.Read}a={subject(ProjectPermissionSub.CertificateProfiles, { slug: profile.slug })}>@@ -161,11 +162,7 @@ const Page = () => {onDeleteApproved={handleDeleteConfirm}/></div>- ) : (- <div className="container mx-auto flex h-full items-center justify-center">- <AccessRestrictedBanner />- </div>- )+ ) : null}</ProjectPermissionCan>)}diff --git a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsxindex 1a14b3078b..272b3af81e 100644--- a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsx@@ -5,7 +5,7 @@ import { ChevronLeftIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";-import { AccessRestrictedBanner, PageHeader } from "@app/components/v2";+import { PageHeader } from "@app/components/v2";import { ROUTE_PATHS } from "@app/const/routes";import { useOrganization, useProject } from "@app/context";import {@@ -74,6 +74,7 @@ const Page = () => {<div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">{connector && (<ProjectPermissionCan+ renderGuardBannerI={ProjectPermissionHsmConnectorActions.Read}a={ProjectPermissionSub.HsmConnectors}>@@ -120,11 +121,7 @@ const Page = () => {onDeleted={navigateBackToList}/></div>- ) : (- <div className="container mx-auto flex h-full items-center justify-center">- <AccessRestrictedBanner />- </div>- )+ ) : null}</ProjectPermissionCan>)}diff --git a/frontend/src/pages/cert-manager/InventoryPage/InventoryPage.tsx b/frontend/src/pages/cert-manager/InventoryPage/InventoryPage.tsxindex bb21ab69b8..cc2052d69e 100644--- a/frontend/src/pages/cert-manager/InventoryPage/InventoryPage.tsx+++ b/frontend/src/pages/cert-manager/InventoryPage/InventoryPage.tsx@@ -3,9 +3,8 @@ import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";import { useSearch } from "@tanstack/react-router";-import { PermissionDeniedBanner } from "@app/components/permissions";import { PageHeader } from "@app/components/v2";-import { PageLoader } from "@app/components/v3";+import { AccessRestrictedDialog, PageLoader } from "@app/components/v3";import { useProject, useProjectPermission } from "@app/context";import {ProjectPermissionCertificateActions,@@ -111,7 +110,12 @@ export const InventoryPage = () => {dashboardViewId={searchParams.viewId}/>) : (- <PermissionDeniedBanner />+ <AccessRestrictedDialog+ requirement={{+ action: ProjectPermissionCertificateActions.Read,+ subject: ProjectPermissionSub.Certificates+ }}+ />)}</CertManagerAdminOnly></div>diff --git a/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx b/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsxindex 1a48e96c4b..bf37a7456e 100644--- a/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx+++ b/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx@@ -3,9 +3,8 @@ import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";import { useNavigate, useSearch } from "@tanstack/react-router";-import { PermissionDeniedBanner } from "@app/components/permissions";import { PageHeader } from "@app/components/v2";-import { PageLoader } from "@app/components/v3";+import { AccessRestrictedDialog, PageLoader } from "@app/components/v3";import { useProject, useProjectPermission } from "@app/context";import {ProjectPermissionCertificateActions,@@ -123,6 +122,10 @@ export const PoliciesPage = () => {ProjectPermissionCertificateActions.Read,ProjectPermissionSub.Certificates);+ const certificateRequirement = {+ action: ProjectPermissionCertificateActions.Read,+ subject: ProjectPermissionSub.Certificates+ };if (!currentProject) {return <PageLoader />;@@ -148,7 +151,7 @@ export const PoliciesPage = () => {dashboardViewId={searchParams.viewId}/>) : (- <PermissionDeniedBanner />+ <AccessRestrictedDialog requirement={certificateRequirement} />))}{activeTab === TabSections.CertificateRequests &&(canReadCertificates ? (@@ -156,12 +159,30 @@ export const PoliciesPage = () => {onViewCertificateFromRequest={handleViewCertificateFromRequest}/>) : (- <PermissionDeniedBanner />+ <AccessRestrictedDialog requirement={certificateRequirement} />))}{activeTab === TabSections.CertificateProfiles &&- (canReadCertificateProfiles ? <CertificateProfilesTab /> : <PermissionDeniedBanner />)}+ (canReadCertificateProfiles ? (+ <CertificateProfilesTab />+ ) : (+ <AccessRestrictedDialog+ requirement={{+ action: ProjectPermissionCertificateProfileActions.Read,+ subject: ProjectPermissionSub.CertificateProfiles+ }}+ />+ ))}{activeTab === TabSections.CertificatePolicies &&- (canReadCertificatePolicies ? <CertificatePoliciesTab /> : <PermissionDeniedBanner />)}+ (canReadCertificatePolicies ? (+ <CertificatePoliciesTab />+ ) : (+ <AccessRestrictedDialog+ requirement={{+ action: ProjectPermissionCertificatePolicyActions.Read,+ subject: ProjectPermissionSub.CertificatePolicies+ }}+ />+ ))}</div></div></div>diff --git a/frontend/src/pages/organization/AccessManagementPage/AccessManagementPage.tsx b/frontend/src/pages/organization/AccessManagementPage/AccessManagementPage.tsxindex 1fc3aaa844..6a30ba7274 100644--- a/frontend/src/pages/organization/AccessManagementPage/AccessManagementPage.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/AccessManagementPage.tsx@@ -50,6 +50,10 @@ export const AccessManagementPage = () => {key: OrgAccessControlTabSections.Member,label: "Users",isHidden: permission.cannot(OrgPermissionActions.Read, OrgPermissionSubjects.Member),+ requirement: {+ action: OrgPermissionActions.Read,+ subject: OrgPermissionSubjects.Member+ },component: OrgMembersTab},{@@ -59,18 +63,30 @@ export const AccessManagementPage = () => {OrgPermissionIdentityActions.Read,OrgPermissionSubjects.Identity),+ requirement: {+ action: OrgPermissionIdentityActions.Read,+ subject: OrgPermissionSubjects.Identity+ },component: OrgIdentityTab},{key: OrgAccessControlTabSections.Groups,label: "Groups",isHidden: permission.cannot(OrgPermissionGroupActions.Read, OrgPermissionSubjects.Groups),+ requirement: {+ action: OrgPermissionGroupActions.Read,+ subject: OrgPermissionSubjects.Groups+ },component: OrgGroupsTab},{key: OrgAccessControlTabSections.Roles,label: "Roles",isHidden: permission.cannot(OrgPermissionActions.Read, OrgPermissionSubjects.Role),+ requirement: {+ action: OrgPermissionActions.Read,+ subject: OrgPermissionSubjects.Role+ },component: OrgRoleTabSection}];@@ -142,7 +158,7 @@ export const AccessManagementPage = () => {))}</TabsList>{isSelectedTabRestricted ? (- <OrgPermissionGuardBanner />+ <OrgPermissionGuardBanner requirement={selectedTabSection?.requirement} />) : (visibleTabSections.map(({ key, component: Component }) => (<TabsContent value={key} key={`org-access-tab-panel-${key}`}>diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsxindex 52b69a3f3a..53447547f1 100644--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx@@ -304,6 +304,18 @@ const LogsSectionComponent = ({);};+// Built once at module scope: creating them inside the render makes a new component type on every+// render, which remounts the whole log table (and replays the permission gate) each time.+const ProjectLogsSectionWithPermission = withProjectPermission(LogsSectionComponent, {+ action: ProjectPermissionAuditLogsActions.Read,+ subject: ProjectPermissionSub.AuditLogs+});++const OrgLogsSectionWithPermission = withPermission(LogsSectionComponent, {+ action: OrgPermissionAuditLogsActions.Read,+ subject: OrgPermissionSubjects.AuditLogs+});+export const LogsSection = (props: Props) => {const { project } = props;@@ -314,16 +326,8 @@ export const LogsSection = (props: Props) => {return <LogsSectionComponent {...props} />;}- const ProjectLogsSectionWithPermission = withProjectPermission(LogsSectionComponent, {- action: ProjectPermissionAuditLogsActions.Read,- subject: ProjectPermissionSub.AuditLogs- });return <ProjectLogsSectionWithPermission {...props} />;}- const OrgLogsSectionWithPermission = withPermission(LogsSectionComponent, {- action: OrgPermissionAuditLogsActions.Read,- subject: OrgPermissionSubjects.AuditLogs- });return <OrgLogsSectionWithPermission {...props} />;};diff --git a/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsx b/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsxindex 4cf9e2b22e..ba6b275668 100644--- a/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsx+++ b/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsx@@ -1,6 +1,7 @@import { faBan } from "@fortawesome/free-solid-svg-icons";-import { AccessRestrictedBanner, ContentLoader, EmptyState } from "@app/components/v2";+import { ContentLoader, EmptyState } from "@app/components/v2";+import { AccessRestrictedNotice } from "@app/components/v3";import { useProject, useSubscription } from "@app/context";import { useGetSecretScanningConfig } from "@app/hooks/api/secretScanningV2";@@ -16,17 +17,10 @@ export const ProjectScanningConfigTab = () => {if (!subscription.secretScanning) {return (- <div className="mt-60 flex h-full w-full items-center justify-center px-20">- <AccessRestrictedBanner- body={- <>- Your current plan doesn't support Secret Scanning.- <br /> Please contact Infisical Support or reach out through our Slack channel for- assistance.- </>- }- />- </div>+ <AccessRestrictedNotice+ title="Secret Scanning Not Available"+ description="Your current plan doesn't include Secret Scanning. Contact Infisical support or reach out on Slack to enable it."+ />);}