Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Om læreren ikke finnes, ikke returner YFF-data
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsAnd committed Jan 27, 2021
1 parent d3854b9 commit 50b0cdb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions YFF/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ const handleYFF = async (context, req) => {
const isMe = student === user
if (!isMe) {
const students = await getMyStudents(user)
if (students === false) {
logger('info', ['handle-yff', 'method', method, 'student', student, 'user', user, 'teacher not found'])
return getResponse([])
}

// If an ID was specified, verify that the teacher has access to this student before proceeding
if (student && students.filter(s => s.userName === student).length === 0) {
throw new HTTPError(403, 'You don\'t have access to this student!', { student })
Expand Down

0 comments on commit 50b0cdb

Please # to comment.