Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eb88e7b038 | |||
| 08894730a3 |
@@ -63,11 +63,6 @@ export interface LoginJWT {
|
||||
user: CasContent;
|
||||
}
|
||||
|
||||
export function isEmployee(session: CasContent): boolean {
|
||||
return session.eduPersonPrimaryAffiliation === "employee" ||
|
||||
session.eduPersonPrimaryAffiliation === "faculty";
|
||||
}
|
||||
|
||||
export type EmptyObject = Record<string | number | symbol, never>;
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { enseignements } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { and, eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const _NOT_FOUND = () =>
|
||||
@@ -24,7 +24,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(JSON.stringify([]), {
|
||||
headers: { "content-type": "application/json" },
|
||||
});
|
||||
@@ -40,7 +40,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { enseignements } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { and, eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const NOT_FOUND = () =>
|
||||
@@ -18,7 +18,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { modules } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
export const handler: Handlers<null, AuthenticatedState> = {
|
||||
@@ -21,7 +21,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(null, { status: 403 });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { ueModules } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { and, eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const NOT_FOUND = () =>
|
||||
@@ -24,7 +24,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { mobilites } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const VALID_STATUSES = [
|
||||
@@ -46,14 +46,15 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
const employeeCheck = isEmployee(context.state.session);
|
||||
const isEmployee =
|
||||
context.state.session.eduPersonPrimaryAffiliation === "employee";
|
||||
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { numEtud, duree, ecole, pays, status, idStage } = body;
|
||||
|
||||
// Students can only create mobilites for themselves
|
||||
if (!employeeCheck && numEtud !== undefined) {
|
||||
if (!isEmployee && numEtud !== undefined) {
|
||||
// Students cannot set idStage or status
|
||||
if (idStage || (status && status !== "contracts_received")) {
|
||||
return new Response(null, { status: 403 });
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { mobilites } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const VALID_STATUSES = [
|
||||
@@ -49,7 +49,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { mobilites } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const CONTRACTS_DIR = "uploads/contracts";
|
||||
@@ -118,7 +118,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(null, { status: 403 });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { ajustements } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
export const handler: Handlers<null, AuthenticatedState> = {
|
||||
@@ -47,7 +47,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(null, { status: 403 });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { ajustements } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { and, eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const NOT_FOUND = () =>
|
||||
@@ -18,7 +18,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@ import {
|
||||
makePartials,
|
||||
} from "$root/defaults/makePartials.tsx";
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
import { isEmployee, State } from "$root/defaults/interfaces.ts";
|
||||
import { State } from "$root/defaults/interfaces.ts";
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
export async function Index(
|
||||
_request: Request,
|
||||
context: FreshContext<State>,
|
||||
) {
|
||||
const employeeCheck = isEmployee(
|
||||
(context.state as unknown as { session: Record<string, string> }).session,
|
||||
);
|
||||
const isEmployee =
|
||||
(context.state as unknown as { session: Record<string, string> }).session
|
||||
.eduPersonPrimaryAffiliation === "employee";
|
||||
|
||||
return (
|
||||
<div class="page-content">
|
||||
@@ -25,7 +25,7 @@ export async function Index(
|
||||
</strong>
|
||||
.
|
||||
</p>
|
||||
{employeeCheck
|
||||
{isEmployee
|
||||
? (
|
||||
<p>
|
||||
Consultez les{" "}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { stages } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
export const handler: Handlers<null, AuthenticatedState> = {
|
||||
@@ -38,7 +38,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(null, { status: 403 });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { mobilites, stages } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const NOT_FOUND = () =>
|
||||
@@ -41,7 +41,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { promotions } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
|
||||
export const handler: Handlers<null, AuthenticatedState> = {
|
||||
// #13 GET /promotions
|
||||
@@ -9,7 +9,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(JSON.stringify([]), {
|
||||
headers: { "content-type": "application/json" },
|
||||
});
|
||||
@@ -26,7 +26,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(null, { status: 403 });
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
ueModules,
|
||||
ues,
|
||||
} from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const NOT_FOUND = () =>
|
||||
@@ -27,7 +27,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { students } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
export const handler: Handlers<null, AuthenticatedState> = {
|
||||
@@ -10,7 +10,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(JSON.stringify([]), {
|
||||
headers: { "content-type": "application/json" },
|
||||
});
|
||||
@@ -33,7 +33,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(null, { status: 403 });
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
stages,
|
||||
students,
|
||||
} from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
import { eq } from "npm:drizzle-orm@0.45.2";
|
||||
|
||||
const NOT_FOUND = () =>
|
||||
@@ -24,7 +24,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { db } from "$root/databases/db.ts";
|
||||
import { students } from "$root/databases/schema.ts";
|
||||
import { AuthenticatedState, isEmployee } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState } from "$root/defaults/interfaces.ts";
|
||||
|
||||
// #9 POST /students/import-csv
|
||||
export const handler: Handlers<null, AuthenticatedState> = {
|
||||
@@ -9,7 +9,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
return new Response(null, { status: 403 });
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@ import {
|
||||
makePartials,
|
||||
} from "$root/defaults/makePartials.tsx";
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
import { isEmployee, State } from "$root/defaults/interfaces.ts";
|
||||
import { State } from "$root/defaults/interfaces.ts";
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
export async function Index(
|
||||
_request: Request,
|
||||
context: FreshContext<State>,
|
||||
) {
|
||||
const employeeStatus = isEmployee(
|
||||
(context.state as unknown as { session: Record<string, string> }).session,
|
||||
);
|
||||
const isEmployee =
|
||||
(context.state as unknown as { session: Record<string, string> }).session
|
||||
.eduPersonPrimaryAffiliation === "employee";
|
||||
|
||||
return (
|
||||
<div class="page-content">
|
||||
@@ -25,7 +25,7 @@ export async function Index(
|
||||
</strong>
|
||||
.
|
||||
</p>
|
||||
{employeeStatus && (
|
||||
{isEmployee && (
|
||||
<p>
|
||||
Consultez la{" "}
|
||||
<a href="/students/consult" f-partial="/students/partials/consult">
|
||||
|
||||
Reference in New Issue
Block a user