fix: faculty users are now recognized as employees
This commit is contained in:
@@ -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 } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState, isEmployee } 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 (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
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 } from "$root/defaults/interfaces.ts";
|
||||
import { AuthenticatedState, isEmployee } 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 (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
_request: Request,
|
||||
context: FreshContext<AuthenticatedState>,
|
||||
): Promise<Response> {
|
||||
if (context.state.session.eduPersonPrimaryAffiliation !== "employee") {
|
||||
if (!isEmployee(context.state.session)) {
|
||||
return FORBIDDEN();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user