restrict adding people to admins

This commit is contained in:
Nate Kelley 2025-01-23 11:34:25 -07:00
parent cb96002f04
commit 0a7ffc7980
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
4 changed files with 7 additions and 4 deletions

View File

@ -166,7 +166,8 @@ export const AppSidebarPrimary: React.FC<
icon: <AppMaterialIcons icon="add" />, icon: <AppMaterialIcons icon="add" />,
onClick: () => { onClick: () => {
onToggleInviteModal(); onToggleInviteModal();
} },
show: isAdmin
}, },
{ {
key: 'support', key: 'support',
@ -184,8 +185,8 @@ export const AppSidebarPrimary: React.FC<
onToggleSupportModal(); onToggleSupportModal();
} }
} }
]; ].filter((item) => item.show !== false);
}, []); }, [isAdmin]);
return ( return (
<div className="flex w-full flex-col space-y-2.5"> <div className="flex w-full flex-col space-y-2.5">

View File

@ -1,6 +1,7 @@
import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes';
import { useCheckIfUserIsAdmin_server } from '@/server_context/user'; import { useCheckIfUserIsAdmin_server } from '@/server_context/user';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
import React from 'react';
export default async function Layout({ children }: { children: React.ReactNode }) { export default async function Layout({ children }: { children: React.ReactNode }) {
const isAdmin = await useCheckIfUserIsAdmin_server(); const isAdmin = await useCheckIfUserIsAdmin_server();

View File

@ -1,5 +1,5 @@
import { BusterRoutes, createBusterRoute } from '@/routes'; import { BusterRoutes, createBusterRoute } from '@/routes';
import { HeaderContainer } from '../_HeaderContainer'; import { HeaderContainer } from '../../_HeaderContainer';
import { DatasourceForm } from './_DatasourceForm'; import { DatasourceForm } from './_DatasourceForm';
export default function Page({ export default function Page({

View File

@ -1,6 +1,7 @@
import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes';
import { useCheckIfUserIsAdmin_server } from '@/server_context/user'; import { useCheckIfUserIsAdmin_server } from '@/server_context/user';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
import React from 'react';
export default function Layout({ children }: { children: React.ReactNode }) { export default function Layout({ children }: { children: React.ReactNode }) {
const isAdmin = useCheckIfUserIsAdmin_server(); const isAdmin = useCheckIfUserIsAdmin_server();