import { getOrgFromDomain } from "@/data/org"; import { OrganizationAccessSettings } from "@/app/components/organizationAccessSettings"; import { isServiceError } from "@/lib/utils"; import { ServiceErrorException } from "@/lib/serviceError"; import { getMe } from "@/actions"; import { OrgRole } from "@sourcebot/db"; import { redirect } from "next/navigation"; interface AccessPageProps { params: { domain: string; } } export default async function AccessPage({ params: { domain } }: AccessPageProps) { const org = await getOrgFromDomain(domain); if (!org) { throw new Error("Organization not found"); } const me = await getMe(); if (isServiceError(me)) { throw new ServiceErrorException(me); } const userRoleInOrg = me.memberships.find((membership) => membership.id === org.id)?.role; if (!userRoleInOrg) { throw new Error("User role not found"); } if (userRoleInOrg !== OrgRole.OWNER) { redirect(`/${domain}/settings`); } return (

Access Control

Configure how users can access your Sourcebot deployment.{" "} Learn more

) }