Gruppen im Profil

This commit is contained in:
Bkolb 2026-04-02 20:11:04 +02:00
parent 6c8609b281
commit 9b90be5f5b
2 changed files with 36 additions and 14 deletions

View File

@ -372,24 +372,34 @@ def profil():
cur.execute(""" cur.execute("""
SELECT SELECT
u.id, u.id,
u.email, u.email,
u.name, u.name,
u.mandant_id, u.mandant_id,
u.last_login, u.last_login,
u.status, u.status,
m.name AS mandant_name,
m.name AS mandant_name, m.kuerzel AS mandant_kuerzel,
m.kuerzel AS mandant_kuerzel, m.kontakt_email AS mandant_email,
m.kontakt_email AS mandant_email, m.level AS mandant_level
m.level AS mandant_level
FROM app_user u FROM app_user u
JOIN mandant m ON m.id = u.mandant_id JOIN mandant m ON m.id = u.mandant_id
WHERE u.id = %s WHERE u.id = %s
""", (session["user_id"],)) """, (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() cur.close()
conn.close() conn.close()
@ -398,7 +408,8 @@ def profil():
"profil.html", "profil.html",
page_title="Profil", page_title="Profil",
active_page="profil", active_page="profil",
profile=user_data, profile=profile,
gruppen=gruppen,
**get_current_user() **get_current_user()
) )

View File

@ -11,6 +11,17 @@
<tr><th>Mandant</th><td>{{ profile.mandant_name }} ({{ profile.mandant_kuerzel }})</td></tr> <tr><th>Mandant</th><td>{{ profile.mandant_name }} ({{ profile.mandant_kuerzel }})</td></tr>
<tr><th>Mandant E-Mail</th><td>{{ profile.mandant_email or '-' }}</td></tr> <tr><th>Mandant E-Mail</th><td>{{ profile.mandant_email or '-' }}</td></tr>
<tr><th>Mandant Level</th><td>{{ profile.mandant_level }}</td></tr> <tr><th>Mandant Level</th><td>{{ profile.mandant_level }}</td></tr>
<tr>
<th>Gruppen im Mandanten</th>
<td>
{% if gruppen %}
{{ gruppen | join(', ') }}
{% else %}
-
{% endif %}
</td>
</tr>
</table> </table>
<div class="admin-actions"> <div class="admin-actions">