Skip to content
Snippets Groups Projects
Commit 63c96016 authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Also check whether a person is a teacher in a LessonSubstitution in is_lesson_teacher

parent 62c3ea5d
No related branches found
No related tags found
1 merge request!49Resolve "Add rules and permissions"
Pipeline #3121 passed
......@@ -14,10 +14,10 @@ def is_lesson_teacher(user: User, obj: LessonPeriod) -> bool:
"""Predicate for teachers of a lesson.
Checks whether the person linked to the user is a teacher
in the lesson linked to the given LessonPeriod.
in the lesson or the substitution linked to the given LessonPeriod.
"""
if hasattr(obj, "lesson"):
return user.person in obj.lesson.teachers.all()
return user.person in obj.lesson.teachers.all() or user.person in obj.substitutions.teachers.all()
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment