diff --git a/codeGrader/frontend/admin/handlers/AdminUser.py b/codeGrader/frontend/admin/handlers/AdminUser.py index 0ddd4c5..5e1520e 100644 --- a/codeGrader/frontend/admin/handlers/AdminUser.py +++ b/codeGrader/frontend/admin/handlers/AdminUser.py @@ -56,6 +56,9 @@ def get(self, id_: int): admin_types = self.api.get(f"/adminTypes") admin["types"] = admin_types["admin_type"] + profiles = self.api.get(f"/profiles") + admin["profiles"] = profiles["profile"] + return render_template("adminUser.html", **admin) def post(self, id_: int): @@ -76,7 +79,7 @@ def post(self, id_: int): admin_data["email"] = self.get_value("email") admin_data["tag"] = self.get_value("tag") admin_data["admin_type"] = self.get_value("admin_type") - print(admin_data) + self.api.put(f"/adminUser/{id_}", body=admin_data) diff --git a/codeGrader/frontend/admin/handlers/Task.py b/codeGrader/frontend/admin/handlers/Task.py index f769065..3a5eb28 100644 --- a/codeGrader/frontend/admin/handlers/Task.py +++ b/codeGrader/frontend/admin/handlers/Task.py @@ -66,3 +66,23 @@ def post(self, id_: int): self.api.put(f"/task/{id_}", body=task_data) return redirect(url_for("task", id_=id_)) + + def create(self): + """ + Create a User in the database + @return: + """ + user_data = dict() + + user_data["username"] = self.get_value("username") + user_data["first_name"] = self.get_value("first_name") + user_data["last_name"] = self.get_value("last_name") + user_data["email"] = self.get_value("email") + user_data["tag"] = self.get_value("tag") + user_data["profile"] = self.get_value("profile") + + response_text = self.api.post("/addUser", body=user_data) + + id_ = response_text["response"]["id"] + + return redirect(url_for("user", id_=id_)) \ No newline at end of file diff --git a/codeGrader/frontend/admin/templates/adminUser.html b/codeGrader/frontend/admin/templates/adminUser.html index 3580ae2..42c0bbc 100644 --- a/codeGrader/frontend/admin/templates/adminUser.html +++ b/codeGrader/frontend/admin/templates/adminUser.html @@ -65,6 +65,24 @@