From bcaed9bed9de957aa25e2b75296e101eadf7950d Mon Sep 17 00:00:00 2001 From: Brett Kolodny Date: Fri, 21 Feb 2025 21:54:57 +0000 Subject: [PATCH 1/2] feat: show dialog if permissions required --- site/src/contexts/auth/RequirePermission.tsx | 30 ++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/site/src/contexts/auth/RequirePermission.tsx b/site/src/contexts/auth/RequirePermission.tsx index 50dbd0232ab88..06d35e6a52328 100644 --- a/site/src/contexts/auth/RequirePermission.tsx +++ b/site/src/contexts/auth/RequirePermission.tsx @@ -1,5 +1,13 @@ +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "components/Dialog/Dialog"; +import { Link } from "components/Link/Link"; import type { FC, ReactNode } from "react"; -import { Navigate } from "react-router-dom"; export interface RequirePermissionProps { children?: ReactNode; @@ -14,7 +22,25 @@ export const RequirePermission: FC = ({ isFeatureVisible, }) => { if (!isFeatureVisible) { - return ; + // return ; + return ( + + + + + You don't have permission to view this page + + + + If you believe this is a mistake, please contact your administrator + or try signing in with different credentials. + + + Go to workspaces + + + + ); } return <>{children}; From 4a1bcbd49f5f3e3c8a169515dd90a9bd65f7f1aa Mon Sep 17 00:00:00 2001 From: Brett Kolodny Date: Fri, 21 Feb 2025 22:33:46 +0000 Subject: [PATCH 2/2] fix: remove unused comment --- site/src/contexts/auth/RequirePermission.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/site/src/contexts/auth/RequirePermission.tsx b/site/src/contexts/auth/RequirePermission.tsx index 06d35e6a52328..6e4b0f3aac186 100644 --- a/site/src/contexts/auth/RequirePermission.tsx +++ b/site/src/contexts/auth/RequirePermission.tsx @@ -22,7 +22,6 @@ export const RequirePermission: FC = ({ isFeatureVisible, }) => { if (!isFeatureVisible) { - // return ; return (