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

Remove some unneccesary checks for teacher status in courses

parent d9b6daad
No related branches found
No related tags found
2 merge requests!352Draft: Resolve "Add dialog with each lesson's students",!350Resolve "Add simple course book list"
Pipeline #179322 failed
...@@ -310,11 +310,10 @@ def is_course_teacher(user: User, obj: Course): ...@@ -310,11 +310,10 @@ def is_course_teacher(user: User, obj: Course):
def is_lesson_event_teacher(user: User, obj: LessonEvent): def is_lesson_event_teacher(user: User, obj: LessonEvent):
"""Predicate for teachers of a lesson event. """Predicate for teachers of a lesson event.
Checks whether the person linked to the user is a teacher in the lesson event, Checks whether the person linked to the user is a teacher in the lesson event.
or a teacher of the course, if the lesson event has one.
""" """
if obj: if obj:
return obj.course and is_course_teacher(user, obj.course) or user.person in obj.all_teachers return user.person in obj.all_teachers
return False return False
...@@ -419,8 +418,6 @@ def can_edit_documentation(user: User, obj: Documentation): ...@@ -419,8 +418,6 @@ def can_edit_documentation(user: User, obj: Documentation):
return is_lesson_event_teacher(user, obj.lesson_event) | is_lesson_event_group_owner( return is_lesson_event_teacher(user, obj.lesson_event) | is_lesson_event_group_owner(
user, obj.lesson_event user, obj.lesson_event
) )
if obj.course:
return is_course_teacher(user, obj.course)
return False return False
......
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