Skip to content

Commit

Permalink
feat: Field Protection for Screener entity
Browse files Browse the repository at this point in the history
Given that we now actively release edges to the Screener entity, maybe a good idea to protect it's fields
  • Loading branch information
Jonas Wilms committed Nov 6, 2023
1 parent b058bc0 commit ee2aa08
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion graphql/authorizations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { ModelsEnhanceMap, Pupil, ResolversEnhanceMap, Student, Subcourse, Course, Lecture, Course_tag as CourseTag, Concrete_notification } from './generated';
import {
ModelsEnhanceMap,
Pupil,
ResolversEnhanceMap,
Student,
Subcourse,
Course,
Lecture,
Course_tag as CourseTag,
Concrete_notification,
Screener,
} from './generated';
import { Authorized, createMethodDecorator } from 'type-graphql';
import { UNAUTHENTICATED_USER } from './authentication';

Expand Down Expand Up @@ -488,6 +499,34 @@ export const authorizationModelEnhanceMap: ModelsEnhanceMap = {
cooperationID: nobody,
}),
},

Screener: {
fields: withPublicFields<Screener, 'id'>({
verification: nobody,
password: nobody,
verified: nobody,
verifiedAt: nobody,
instructor_screening: nobody,
isRedacted: nobody,
oldNumberID: nobody,
project_coaching_screening: nobody,
screenings: nobody,
updatedAt: nobody,
_count: nobody,

lastLogin: onlyOwner,
lastTimeCheckedNotifications: onlyOwner,
notificationPreferences: onlyOwner,

is_trusted: onlyAdminOrScreener,
active: onlyAdminOrScreener,
createdAt: onlyAdminOrScreener,
firstname: onlyAdminOrScreener,
lastname: onlyAdminOrScreener,
email: onlyAdminOrScreener,
}),
},

Subcourse: {
fields: withPublicFields<
Subcourse,
Expand Down

0 comments on commit ee2aa08

Please sign in to comment.