audit: remove duplicate date column, add search
This commit is contained in:
parent
c4a30c50ac
commit
1088b947a8
|
@ -4,8 +4,8 @@ This installation method is for test-setups and small-scale productive setups.
|
|||
|
||||
## Prerequisites
|
||||
|
||||
- docker
|
||||
- docker-compose
|
||||
- docker
|
||||
- docker-compose
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ This update brings these headline features:
|
|||
- Add Kubernetes Integration for Outposts, which deploys and maintains Outposts with High Availability in a Kubernetes Cluster
|
||||
- Add System Task Overview to see all background tasks, their status, the log output, and retry them
|
||||
- Alerts now disappear automatically
|
||||
- Audit Logs are now searchable
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# Generated by Django 3.1.2 on 2020-10-17 20:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("passbook_audit", "0005_auto_20201005_2139"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="event",
|
||||
name="date",
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="event",
|
||||
name="action",
|
||||
field=models.TextField(
|
||||
choices=[
|
||||
("login", "Login"),
|
||||
("login_failed", "Login Failed"),
|
||||
("logout", "Logout"),
|
||||
("user_write", "User Write"),
|
||||
("suspicious_request", "Suspicious Request"),
|
||||
("password_set", "Password Set"),
|
||||
("token_view", "Token View"),
|
||||
("invitation_created", "Invite Created"),
|
||||
("invitation_used", "Invite Used"),
|
||||
("authorize_application", "Authorize Application"),
|
||||
("source_linked", "Source Linked"),
|
||||
("impersonation_started", "Impersonation Started"),
|
||||
("impersonation_ended", "Impersonation Ended"),
|
||||
("model_created", "Model Created"),
|
||||
("model_updated", "Model Updated"),
|
||||
("model_deleted", "Model Deleted"),
|
||||
("custom_", "Custom Prefix"),
|
||||
]
|
||||
),
|
||||
),
|
||||
]
|
|
@ -100,6 +100,8 @@ class EventAction(models.TextChoices):
|
|||
SUSPICIOUS_REQUEST = "suspicious_request"
|
||||
PASSWORD_SET = "password_set" # noqa # nosec
|
||||
|
||||
TOKEN_VIEW = "token_view"
|
||||
|
||||
INVITE_CREATED = "invitation_created"
|
||||
INVITE_USED = "invitation_used"
|
||||
|
||||
|
@ -122,7 +124,6 @@ class Event(models.Model):
|
|||
event_uuid = models.UUIDField(primary_key=True, editable=False, default=uuid4)
|
||||
user = models.JSONField(default=dict)
|
||||
action = models.TextField(choices=EventAction.choices)
|
||||
date = models.DateTimeField(auto_now_add=True)
|
||||
app = models.TextField()
|
||||
context = models.JSONField(default=dict, blank=True)
|
||||
client_ip = models.GenericIPAddressField(null=True)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<div class="pf-c-card">
|
||||
<div class="pf-c-toolbar">
|
||||
<div class="pf-c-toolbar__content">
|
||||
{% include 'partials/toolbar_search.html' %}
|
||||
{% include 'partials/pagination.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,12 +3,16 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|||
from django.views.generic import ListView
|
||||
from guardian.mixins import PermissionListMixin
|
||||
|
||||
from passbook.admin.views.utils import UserPaginateListMixin
|
||||
from passbook.admin.views.utils import SearchListMixin, UserPaginateListMixin
|
||||
from passbook.audit.models import Event
|
||||
|
||||
|
||||
class EventListView(
|
||||
PermissionListMixin, LoginRequiredMixin, UserPaginateListMixin, ListView
|
||||
PermissionListMixin,
|
||||
LoginRequiredMixin,
|
||||
SearchListMixin,
|
||||
UserPaginateListMixin,
|
||||
ListView,
|
||||
):
|
||||
"""Show list of all invitations"""
|
||||
|
||||
|
@ -16,3 +20,11 @@ class EventListView(
|
|||
template_name = "audit/list.html"
|
||||
permission_required = "passbook_audit.view_event"
|
||||
ordering = "-created"
|
||||
|
||||
search_fields = [
|
||||
"user",
|
||||
"action",
|
||||
"app",
|
||||
"context",
|
||||
"client_ip",
|
||||
]
|
||||
|
|
Reference in New Issue