Skip to content

Commit

Permalink
Remove hidden schoolclasses from teacher's view.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiarn committed Oct 24, 2024
1 parent d3c5fc9 commit 1b1e2ea
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def handle_api_list_groups(self, http_context):
user_profile = AuthenticationService.get(self.context).get_provider().get_profile(username)

schoolclasses = self.context.ldapreader.schoolget('/schoolclasses')
to_remove = []

for schoolclass in schoolclasses:
member = schoolclass['cn'] in user_profile['schoolclasses'] or user_profile['isAdmin']
Expand All @@ -105,6 +106,11 @@ def handle_api_list_groups(self, http_context):
schoolclass['admin'] = username in schoolclass['sophomorixAdmins'] or user_profile['isAdmin']
schoolclass['members'] = schoolclass['sophomorixMembers']
schoolclass['type'] = 'schoolclass'
else:
to_remove.append(schoolclass)

for schoolclass in to_remove:
schoolclasses.remove(schoolclass)

return schoolclasses

Expand Down

0 comments on commit 1b1e2ea

Please sign in to comment.