-
Notifications
You must be signed in to change notification settings - Fork 1
Implement CASL Authorization management with recruitment-session-specific roles #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export function AdminOverview() { | ||
| return ( | ||
| <div className="flex h-full items-center justify-center p-6"> | ||
| <h1 className="text-2xl font-semibold text-muted-foreground"> | ||
| Page accessible from Admins | ||
| </h1> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export function ClerkOverview() { | ||
| return ( | ||
| <div className="flex h-full items-center justify-center p-6"> | ||
| <h1 className="text-2xl font-semibold text-muted-foreground"> | ||
| Page accessible from Clerks | ||
| </h1> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export function GuestOverview() { | ||
| return ( | ||
| <div className="flex h-full items-center justify-center p-6"> | ||
| <h1 className="text-2xl font-semibold text-muted-foreground"> | ||
| Page accessible from Guests | ||
| </h1> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export function MemberOverview() { | ||
| return ( | ||
| <div className="flex h-full items-center justify-center p-6"> | ||
| <h1 className="text-2xl font-semibold text-muted-foreground"> | ||
| Page accessible from Members | ||
| </h1> | ||
| </div> | ||
| ); | ||
| } |
|
pasc4le marked this conversation as resolved.
|
|
cristiansap marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,9 @@ import { AggregatedAvailabilityTable } from './AggregatedAvailabilityTable'; | |
| import { findWithAggregatedAvailability } from '@/lib/services/timeslots'; | ||
| import { findOne } from '@/lib/services/recruitmentSessions'; | ||
| import { notFound } from 'next/navigation'; | ||
| import { auth } from '@/lib/server/auth'; | ||
| import { headers } from 'next/headers'; | ||
| import { requirePageAccess } from '@/lib/helpers/pageAuthorization'; | ||
|
|
||
| export type TimeslotWithAvailability = { | ||
| id: string; | ||
|
|
@@ -22,7 +25,15 @@ export type TimeslotWithAvailability = { | |
| export default async function AvailabilityOverviewPage({ | ||
| params, | ||
| }: PageProps<'/dashboard/[rid]/availability'>) { | ||
| const session = await auth.api.getSession({ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it would be better to move the page checks to the middleware? Or dashboard layout?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd not move
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, but |
||
| headers: await headers(), | ||
| }); | ||
| if (!session) return null; | ||
|
|
||
| const { rid } = await params; | ||
|
|
||
| await requirePageAccess(session.user.id, rid, 'AvailabilityOverviewPage'); | ||
|
|
||
| const recruitmentSession = await findOne(rid); | ||
| if (!recruitmentSession) notFound(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.