Skip to content

Commit

Permalink
fix: integration page accessible without session
Browse files Browse the repository at this point in the history
  • Loading branch information
Meierschlumpf committed Nov 9, 2024
1 parent 3a78179 commit 033e704
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/nextjs/src/app/[locale]/manage/integrations/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Fragment } from "react";
import type { PropsWithChildren } from "react";
import Link from "next/link";
import { redirect } from "next/navigation";
import {
AccordionControl,
AccordionItem,
Expand Down Expand Up @@ -50,11 +51,16 @@ interface IntegrationsPageProps {
}

export default async function IntegrationsPage({ searchParams }: IntegrationsPageProps) {
const integrations = await api.integration.all();
const session = await auth();

if (!session) {
redirect("/auth/login");
}

const integrations = await api.integration.all();
const t = await getScopedI18n("integration");

const canCreateIntegrations = session?.user.permissions.includes("integration-create") ?? false;
const canCreateIntegrations = session.user.permissions.includes("integration-create");

return (
<ManageContainer>
Expand Down
1 change: 1 addition & 0 deletions apps/nextjs/src/app/[locale]/manage/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
icon: IconPlug,
href: "/manage/integrations",
label: t("items.integrations"),
hidden: !session,
},
{
icon: IconSearch,
Expand Down

0 comments on commit 033e704

Please sign in to comment.