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

Fix documentation perm check for amended lessons

parent bd736269
No related branches found
No related tags found
1 merge request!454Resolve "Room substitutions are not shown correctly"
......@@ -193,6 +193,7 @@ def is_lesson_event_group_owner(user: User, obj: LessonEvent):
Checks whether the person linked to the user is a owner of any group
(or their respective parent groups) linked to the lesson event,
or a owner of any group linked to the course, if the lesson event has one.
Also checks for groups linked to the lesson being amended, if one exists.
"""
if obj:
for g in obj.groups.all():
......@@ -201,6 +202,13 @@ def is_lesson_event_group_owner(user: User, obj: LessonEvent):
for pg in g.parent_groups.all():
if user.person in pg.owners.all():
return True
if obj.amends:
for g in obj.amends.groups.all():
if user.person in g.owners.all():
return True
for pg in g.parent_groups.all():
if user.person in pg.owners.all():
return True
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