From 0a7ffc7980da06168a06609c65e2d5c0b4526f10 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 23 Jan 2025 11:34:25 -0700 Subject: [PATCH] restrict adding people to admins --- .../app/app/_controllers/AppSidebar/AppSidebarPrimary.tsx | 7 ++++--- web/src/app/app/settings/(permissions)/layout.tsx | 1 + .../(admin-restricted-space)/[datasourceId]/page.tsx | 2 +- .../datasources/(admin-restricted-space)/layout.tsx | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/src/app/app/_controllers/AppSidebar/AppSidebarPrimary.tsx b/web/src/app/app/_controllers/AppSidebar/AppSidebarPrimary.tsx index 278188168..efe939976 100644 --- a/web/src/app/app/_controllers/AppSidebar/AppSidebarPrimary.tsx +++ b/web/src/app/app/_controllers/AppSidebar/AppSidebarPrimary.tsx @@ -166,7 +166,8 @@ export const AppSidebarPrimary: React.FC< icon: , onClick: () => { onToggleInviteModal(); - } + }, + show: isAdmin }, { key: 'support', @@ -184,8 +185,8 @@ export const AppSidebarPrimary: React.FC< onToggleSupportModal(); } } - ]; - }, []); + ].filter((item) => item.show !== false); + }, [isAdmin]); return (
diff --git a/web/src/app/app/settings/(permissions)/layout.tsx b/web/src/app/app/settings/(permissions)/layout.tsx index 98f76ee88..cb59f4c20 100644 --- a/web/src/app/app/settings/(permissions)/layout.tsx +++ b/web/src/app/app/settings/(permissions)/layout.tsx @@ -1,6 +1,7 @@ import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; import { useCheckIfUserIsAdmin_server } from '@/server_context/user'; import { redirect } from 'next/navigation'; +import React from 'react'; export default async function Layout({ children }: { children: React.ReactNode }) { const isAdmin = await useCheckIfUserIsAdmin_server(); diff --git a/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/page.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/page.tsx index d55b579b5..6ef833dbd 100644 --- a/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/page.tsx @@ -1,5 +1,5 @@ import { BusterRoutes, createBusterRoute } from '@/routes'; -import { HeaderContainer } from '../_HeaderContainer'; +import { HeaderContainer } from '../../_HeaderContainer'; import { DatasourceForm } from './_DatasourceForm'; export default function Page({ diff --git a/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx index a230dabd0..be78d35e0 100644 --- a/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx +++ b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx @@ -1,6 +1,7 @@ import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; import { useCheckIfUserIsAdmin_server } from '@/server_context/user'; import { redirect } from 'next/navigation'; +import React from 'react'; export default function Layout({ children }: { children: React.ReactNode }) { const isAdmin = useCheckIfUserIsAdmin_server();