Skip to content

Commit

Permalink
Added functionality to exclude student from topic draft.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaellinaresxk committed Dec 20, 2023
1 parent 40a7e41 commit 3087741
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion controllers/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,11 @@ router.get('/:topicId', (req, res, next) => {
const isCourseTeacher = (course.teacherIds || []).includes(res.locals.currentUser._id);
const isCourseSubstitutionTeacher = (course.substitutionIds || []).includes(res.locals.currentUser._id);
const isTeacher = isCourseTeacher || isCourseSubstitutionTeacher;

if (!isTeacher && !isCourseSubstitutionTeacher) {
const error = new Error("You don't have permissions!");
error.status = 403;
return next(error);
} else
// return for consistent return
return res.render('topic/topic', {
...lesson,
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3087741

Please sign in to comment.