snapshot: preserve current tubco portal baseline
This commit is contained in:
@@ -139,4 +139,49 @@
|
||||
</div>
|
||||
<p class="hint">{% trans "Hinweis: Der aktuell angemeldete Super Admin kann sich hier nicht selbst deaktivieren oder auf eine niedrigere Rolle setzen." %}</p>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="toolbar">
|
||||
<div>
|
||||
<h2>{% trans "Letzte Benutzeraktionen" %}</h2>
|
||||
<p class="sub">{% trans "Die letzten Änderungen an Benutzerkonten und Rollen." %}</p>
|
||||
</div>
|
||||
<a class="btn btn-secondary" href="/admin-tools/audit-log/">{% trans "Zum Audit Log" %}</a>
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Zeit" %}</th>
|
||||
<th>{% trans "Aktion" %}</th>
|
||||
<th>{% trans "Betroffen" %}</th>
|
||||
<th>{% trans "Durch" %}</th>
|
||||
<th>{% trans "Details" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in recent_user_events %}
|
||||
<tr>
|
||||
<td>{{ row.created_at|date:"d.m.Y H:i" }}</td>
|
||||
<td>{{ row.action_label }}</td>
|
||||
<td>{{ row.target_label|default:"-" }}</td>
|
||||
<td>{{ row.actor_display|default:"-" }}</td>
|
||||
<td>
|
||||
{% if row.details.username %}<div class="mini"><strong>{% trans "Benutzername" %}:</strong> {{ row.details.username }}</div>{% endif %}
|
||||
{% if row.role_label %}<div class="mini"><strong>{% trans "Rolle" %}:</strong> {{ row.role_label }}</div>{% endif %}
|
||||
{% if row.details.email %}<div class="mini"><strong>{% trans "E-Mail" %}:</strong> {{ row.details.email }}</div>{% endif %}
|
||||
{% if row.details.invitation_sent %}<div class="mini">{% trans "Einladung versendet" %}</div>{% endif %}
|
||||
{% if row.details.password_changed %}<div class="mini">{% trans "Passwort geändert" %}</div>{% endif %}
|
||||
{% if not row.details %}-{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="5">{% trans "Noch keine Benutzeraktionen vorhanden." %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
@@ -363,6 +363,15 @@ def _user_management_rows():
|
||||
|
||||
|
||||
def _render_user_management(request, create_form=None, status_code: int = 200):
|
||||
recent_user_events = list(
|
||||
AdminAuditLog.objects.select_related('actor')
|
||||
.filter(action__in=['user_created', 'user_updated', 'user_password_reset_sent', 'user_deleted'])
|
||||
.order_by('-created_at', '-id')[:12]
|
||||
)
|
||||
for row in recent_user_events:
|
||||
row.action_label = _audit_action_label(row.action)
|
||||
role_key = (row.details or {}).get('role')
|
||||
row.role_label = str(ROLE_LABELS[role_key]) if role_key in ROLE_LABELS else role_key
|
||||
return render(
|
||||
request,
|
||||
'workflows/user_management.html',
|
||||
@@ -370,6 +379,7 @@ def _render_user_management(request, create_form=None, status_code: int = 200):
|
||||
'create_form': create_form or UserManagementCreateForm(),
|
||||
'rows': _user_management_rows(),
|
||||
'role_choices': [(key, str(ROLE_LABELS[key])) for key in ROLE_GROUP_NAMES],
|
||||
'recent_user_events': recent_user_events,
|
||||
},
|
||||
status=status_code,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user