Skip to content

Commit

Permalink
adding bug fix for the an admin that does not have a profile
Browse files Browse the repository at this point in the history
  • Loading branch information
ooemperor committed Feb 18, 2024
1 parent 8f69a21 commit f6d8b98
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions codeGrader/frontend/admin/handlers/AdminUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ def get(self, id_: int) -> Union[str, Response]:
editable = self.admin.check_permission('w')
admin["editable"] = editable

if self.admin.check_permission('r', admin["profile"]["id"]): # when admin is allowed to view this admin
prof_id = 0
if admin["profile"] is not None:
prof_id = admin["profile"]["id"]

if self.admin.check_permission('r', prof_id): # when admin is allowed to view this admin
return render_template("adminUser.html", **admin)

else: # admin is not allowed to view this user
Expand All @@ -98,7 +102,12 @@ def post(self, id_: int) -> Response:
assert self.request.form is not None

admin_before = self.api.get(f"/admin/{id_}") # get the admin data
if self.admin.check_permission('w', admin_before["profile"]["id"]):

prof_id = 0
if admin_before["profile"] is not None:
prof_id = admin_before["profile"]["id"]

if self.admin.check_permission('w', prof_id):
admin_data = dict()

# getting the data from the form provided in the request
Expand Down

0 comments on commit f6d8b98

Please sign in to comment.