Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit 40c4f42

Browse files
committed
:c
1 parent 6e8fc83 commit 40c4f42

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

aimmo/models.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ def can_user_play(self, user: User) -> bool:
106106
"""
107107
is_student_in_class = self.game_class.students.filter(new_user=user).exists()
108108
is_teacher_class_owner = user == self.game_class.teacher.new_user
109+
is_teacher_admin = (
110+
hasattr(user.userprofile, "teacher")
111+
and user.userprofile.teacher.school == self.game_class.teacher.school
112+
and user.userprofile.teacher.is_admin
113+
)
109114
try:
110-
return (
111-
is_student_in_class
112-
or is_teacher_class_owner
113-
or user.userprofile.teacher.school == self.game_class.teacher.school
114-
and user.userprofile.teacher.is_admin
115-
)
115+
return is_student_in_class or is_teacher_class_owner or is_teacher_admin
116116
except AttributeError:
117117
return False
118118

0 commit comments

Comments
 (0)