Adding audit log
This commit is contained in:
1 parent
fe6f9cca05
commit
45bc5bf8f6
18 files changed
+543
-119
No files matched your search
@@ -23,6 +23,9 @@
|
||||
{% if user.is_superuser or "part_types:read" in user.permissions %}
|
||||
<a href="/admin/part-types">Part Types</a>
|
||||
{% endif %}
|
||||
{% if user.is_superuser or "audit_log:read" in user.permissions %}
|
||||
<a href="/admin/audit-log">Audit Log</a>
|
||||
{% endif %}
|
||||
<a href="/docs" target="_blank">API docs</a>
|
||||
</nav>
|
||||
<form method="post" action="/logout" class="logout">
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Audit Log · {{ app_name }}{% endblock %}
|
||||
{% block body %}
|
||||
{% include "_nav.html" %}
|
||||
<main class="container">
|
||||
<h1>Audit Log</h1>
|
||||
|
||||
<div class="card">
|
||||
{% if entries %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>User</th>
|
||||
<th>Action</th>
|
||||
<th>Resource</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entry in entries %}
|
||||
<tr>
|
||||
<td class="muted" style="white-space:nowrap">{{ entry.created_at.strftime("%Y-%m-%d %H:%M:%S") }}</td>
|
||||
<td>{{ entry.user_email }}</td>
|
||||
<td><span class="badge badge-{{ entry.action }}">{{ entry.action }}</span></td>
|
||||
<td>{{ entry.resource_type }}{% if entry.resource_id %} #{{ entry.resource_id }}{% endif %}</td>
|
||||
<td>{{ entry.description }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="muted">No audit log entries yet.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user