mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
1137047606
* feat: add PBAC permission checks to insights - Add layout-level protection for insights pages with session.user.org.id check - Add API-level protection for insights tRPC endpoints using insightsPbacProcedure - Enhance routing form insights with PBAC team filtering - Use insights.read permission with OWNER/ADMIN fallback roles - Replace all userBelongsToTeamProcedure with insightsPbacProcedure in insights router - Fix lint issues: remove unused variables and functions, fix non-null assertion Implements Permission-Based Access Control (PBAC) for insights functionality following the same patterns as event type PBAC implementation from PR #22618. Co-Authored-By: [email protected] <[email protected]> * fix: clean up unused imports in routing-forms - Remove unused isFormCreateEditAllowed import - Remove unused TRPCError import - Change MembershipRole to type import for better tree-shaking Co-Authored-By: [email protected] <[email protected]> * address feedback * clean up permission check * revert unnecessary changes * fix procedure * allow MEMBER for insights * support teams not under orgs * fix type error * revert unnecessary changes --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
32 lines
724 B
TypeScript
32 lines
724 B
TypeScript
import { _generateMetadata } from "app/_utils";
|
|
|
|
import prisma from "@calcom/prisma";
|
|
|
|
import InsightsPage from "~/insights/insights-view";
|
|
|
|
import { checkInsightsPagePermission } from "./checkInsightsPagePermission";
|
|
|
|
export const generateMetadata = async () =>
|
|
await _generateMetadata(
|
|
(t) => t("insights"),
|
|
(t) => t("insights_subtitle"),
|
|
undefined,
|
|
undefined,
|
|
"/insights"
|
|
);
|
|
|
|
const ServerPage = async () => {
|
|
const session = await checkInsightsPagePermission();
|
|
|
|
const { timeZone } = await prisma.user.findUniqueOrThrow({
|
|
where: { id: session?.user.id ?? -1 },
|
|
select: {
|
|
timeZone: true,
|
|
},
|
|
});
|
|
|
|
return <InsightsPage timeZone={timeZone} />;
|
|
};
|
|
|
|
export default ServerPage;
|