From d20dcee9d66b29a9ec3383cc38c0ae909de45f23 Mon Sep 17 00:00:00 2001 From: Ashley McEntee <123661468+ashley-o0o@users.noreply.github.com> Date: Wed, 4 Dec 2024 09:48:37 -0500 Subject: [PATCH 1/2] ValidateISV Endpoint Update --- backend/src/routes/api/validate-isv/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/routes/api/validate-isv/index.ts b/backend/src/routes/api/validate-isv/index.ts index 4f8e2c1698..4e913e4bd4 100644 --- a/backend/src/routes/api/validate-isv/index.ts +++ b/backend/src/routes/api/validate-isv/index.ts @@ -1,12 +1,12 @@ import { FastifyReply, FastifyRequest } from 'fastify'; import { getValidateISVResults, validateISV } from './validateISV'; -import { secureRoute } from '../../../utils/route-security'; +import { secureAdminRoute } from '../../../utils/route-security'; import { KubeFastifyInstance } from '../../../types'; export default async (fastify: KubeFastifyInstance): Promise => { fastify.get( '/', - secureRoute(fastify)(async (request: FastifyRequest, reply: FastifyReply) => { + secureAdminRoute(fastify)(async (request: FastifyRequest, reply: FastifyReply) => { return validateISV(fastify, request) .then((res) => { return res; @@ -20,7 +20,7 @@ export default async (fastify: KubeFastifyInstance): Promise => { fastify.get( '/results', - secureRoute(fastify)(async (request: FastifyRequest, reply: FastifyReply) => { + secureAdminRoute(fastify)(async (request: FastifyRequest, reply: FastifyReply) => { return getValidateISVResults(fastify, request) .then((res) => { return res; From aafab34024d38c85b659cc871157057621121429 Mon Sep 17 00:00:00 2001 From: Ashley McEntee <123661468+ashley-o0o@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:55:17 -0500 Subject: [PATCH 2/2] Hide enable button if user isn't an admin --- frontend/src/pages/exploreApplication/GetStartedPanel.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/exploreApplication/GetStartedPanel.tsx b/frontend/src/pages/exploreApplication/GetStartedPanel.tsx index 6f9da12fa0..5fe67b0738 100644 --- a/frontend/src/pages/exploreApplication/GetStartedPanel.tsx +++ b/frontend/src/pages/exploreApplication/GetStartedPanel.tsx @@ -22,6 +22,7 @@ import { markdownConverter } from '~/utilities/markdown'; import { useAppContext } from '~/app/AppContext'; import { fireMiscTrackingEvent } from '~/concepts/analyticsTracking/segmentIOUtils'; import { useIntegratedAppStatus } from '~/pages/exploreApplication/useIntegratedAppStatus'; +import { useUser } from '~/redux/selectors'; const DEFAULT_BETA_TEXT = 'This application is available for early access prior to official ' + @@ -38,13 +39,14 @@ const GetStartedPanel: React.FC = ({ selectedApp, onClose, const { dashboardConfig } = useAppContext(); const { enablement } = dashboardConfig.spec.dashboardConfig; const [{ isInstalled, canInstall, error }, loaded] = useIntegratedAppStatus(selectedApp); + const { isAdmin } = useUser(); if (!selectedApp) { return null; } const renderEnableButton = () => { - if (!selectedApp.spec.enable || selectedApp.spec.isEnabled || isInstalled) { + if (!selectedApp.spec.enable || selectedApp.spec.isEnabled || isInstalled || !isAdmin) { return null; } const button = (