diff --git a/app/flask-postgres/app/app.py b/app/flask-postgres/app/app.py index e5e2da1..b21c96d 100644 --- a/app/flask-postgres/app/app.py +++ b/app/flask-postgres/app/app.py @@ -372,24 +372,34 @@ def profil(): cur.execute(""" SELECT - u.id, - u.email, - u.name, - u.mandant_id, - u.last_login, - u.status, - - m.name AS mandant_name, - m.kuerzel AS mandant_kuerzel, - m.kontakt_email AS mandant_email, - m.level AS mandant_level - + u.id, + u.email, + u.name, + u.mandant_id, + u.last_login, + u.status, + m.name AS mandant_name, + m.kuerzel AS mandant_kuerzel, + m.kontakt_email AS mandant_email, + m.level AS mandant_level FROM app_user u JOIN mandant m ON m.id = u.mandant_id WHERE u.id = %s """, (session["user_id"],)) - user_data = fetchone_dict(cur) + profile = fetchone_dict(cur) + + cur.execute(""" + SELECT g.group_name + FROM user_group ug + JOIN app_group g ON g.id = ug.group_id + WHERE ug.user_id = %s + AND ug.mandant_id = %s + ORDER BY g.group_name + """, (session["user_id"], session["mandant_id"])) + + gruppen_rows = fetchall_dict(cur) + gruppen = [row["group_name"] for row in gruppen_rows] cur.close() conn.close() @@ -398,7 +408,8 @@ def profil(): "profil.html", page_title="Profil", active_page="profil", - profile=user_data, + profile=profile, + gruppen=gruppen, **get_current_user() ) diff --git a/app/flask-postgres/app/templates/profil.html b/app/flask-postgres/app/templates/profil.html index bb22126..3eafcc1 100644 --- a/app/flask-postgres/app/templates/profil.html +++ b/app/flask-postgres/app/templates/profil.html @@ -11,6 +11,17 @@