diff --git a/ui/CHANGELOG.md b/ui/CHANGELOG.md index a6ecb2d728..080d67c917 100644 --- a/ui/CHANGELOG.md +++ b/ui/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the **Prowler UI** are documented in this file. ### 🐞 Added - Handle API responses and errors consistently across the app [(#8621)](https://github.com/prowler-cloud/prowler/pull/8621) +- No-permission message on the scan page [(#8624)](https://github.com/prowler-cloud/prowler/pull/8624) ### 🔄 Changed diff --git a/ui/app/(prowler)/scans/page.tsx b/ui/app/(prowler)/scans/page.tsx index 623836673c..a364f7b494 100644 --- a/ui/app/(prowler)/scans/page.tsx +++ b/ui/app/(prowler)/scans/page.tsx @@ -3,6 +3,7 @@ import { Suspense } from "react"; import { getProviders } from "@/actions/providers"; import { getScans, getScansByState } from "@/actions/scans"; +import { auth } from "@/auth.config"; import { MutedFindingsConfigButton } from "@/components/providers"; import { AutoRefresh, @@ -14,6 +15,7 @@ import { LaunchScanWorkflow } from "@/components/scans/launch-workflow"; import { SkeletonTableScans } from "@/components/scans/table"; import { ColumnGetScans } from "@/components/scans/table/scans"; import { ContentLayout } from "@/components/ui"; +import { CustomBanner } from "@/components/ui/custom/custom-banner"; import { DataTable } from "@/components/ui/table"; import { createProviderDetailsMapping, @@ -26,6 +28,7 @@ export default async function Scans({ }: { searchParams: SearchParamsProps; }) { + const session = await auth(); const filteredParams = { ...searchParams }; delete filteredParams.scanId; const searchParamsKey = JSON.stringify(filteredParams); @@ -55,6 +58,8 @@ export default async function Scans({ (provider: ProviderProps) => !provider.attributes.connection.connected, ); + const hasManageScansPermission = session?.user?.permissions?.manage_scans; + // Get scans data to check for executing scans const scansData = await getScansByState(); @@ -82,7 +87,12 @@ export default async function Scans({ <> - {thereIsNoProvidersConnected ? ( + {!hasManageScansPermission ? ( + + ) : thereIsNoProvidersConnected ? ( <> @@ -91,6 +101,7 @@ export default async function Scans({ ) : ( )} + { + return ( +
+
+
+
+ +

+ {title} +

+
+

{message}

+
+
+ + {buttonLabel} + +
+
+
+ ); +};