Skip to content
Snippets Groups Projects
Commit 08082f41 authored by michael.minelli's avatar michael.minelli Committed by michael.minelli
Browse files

SecurityMiddleware => Add assignment secret check

parent 44b50ba7
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,8 @@ class SecurityMiddleware {
return req.boundParams.assignment?.published ?? false;
case SecurityCheckType.EXERCISE_SECRET.valueOf():
return (req.headers.exercisesecret as string | undefined) === req.boundParams.exercise!.secret;
case SecurityCheckType.ASSIGNMENT_SECRET:
return (req.headers.assignmentsecret as string | undefined) === req.boundParams.assignment!.secret;
default:
return false;
}
......
......@@ -5,6 +5,7 @@ enum SecurityCheckType {
ASSIGNMENT_STAFF = 'assignmentStaff',
ASSIGNMENT_IS_PUBLISHED = 'assignmentIsPublished',
EXERCISE_SECRET = 'exerciseSecret',
ASSIGNMENT_SECRET = 'assignmentSecret',
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment