149 lines
5.3 KiB
Python
149 lines
5.3 KiB
Python
# Generated by Django 3.1.4 on 2021-01-11 16:36
|
|
|
|
import uuid
|
|
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
("authentik_policies", "0004_policy_execution_logging"),
|
|
("authentik_core", "0016_auto_20201202_2234"),
|
|
("authentik_events", "0009_auto_20201227_1210"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="NotificationTransport",
|
|
fields=[
|
|
(
|
|
"uuid",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
primary_key=True,
|
|
serialize=False,
|
|
),
|
|
),
|
|
("name", models.TextField(unique=True)),
|
|
(
|
|
"mode",
|
|
models.TextField(
|
|
choices=[
|
|
("webhook", "Generic Webhook"),
|
|
("webhook_slack", "Slack Webhook (Slack/Discord)"),
|
|
("email", "Email"),
|
|
]
|
|
),
|
|
),
|
|
("webhook_url", models.TextField(blank=True)),
|
|
],
|
|
options={
|
|
"verbose_name": "Notification Transport",
|
|
"verbose_name_plural": "Notification Transports",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="NotificationRule",
|
|
fields=[
|
|
(
|
|
"policybindingmodel_ptr",
|
|
models.OneToOneField(
|
|
auto_created=True,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
parent_link=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
to="authentik_policies.policybindingmodel",
|
|
),
|
|
),
|
|
("name", models.TextField(unique=True)),
|
|
(
|
|
"severity",
|
|
models.TextField(
|
|
choices=[
|
|
("notice", "Notice"),
|
|
("warning", "Warning"),
|
|
("alert", "Alert"),
|
|
],
|
|
default="notice",
|
|
help_text="Controls which severity level the created notifications will have.",
|
|
),
|
|
),
|
|
(
|
|
"group",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Define which group of users this notification should be sent and shown to. If left empty, Notification won't ben sent.",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
to="authentik_core.group",
|
|
),
|
|
),
|
|
(
|
|
"transports",
|
|
models.ManyToManyField(
|
|
help_text="Select which transports should be used to notify the user. If none are selected, the notification will only be shown in the authentik UI.",
|
|
to="authentik_events.NotificationTransport",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Notification Rule",
|
|
"verbose_name_plural": "Notification Rules",
|
|
},
|
|
bases=("authentik_policies.policybindingmodel",),
|
|
),
|
|
migrations.CreateModel(
|
|
name="Notification",
|
|
fields=[
|
|
(
|
|
"uuid",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
primary_key=True,
|
|
serialize=False,
|
|
),
|
|
),
|
|
(
|
|
"severity",
|
|
models.TextField(
|
|
choices=[
|
|
("notice", "Notice"),
|
|
("warning", "Warning"),
|
|
("alert", "Alert"),
|
|
]
|
|
),
|
|
),
|
|
("body", models.TextField()),
|
|
("created", models.DateTimeField(auto_now_add=True)),
|
|
("seen", models.BooleanField(default=False)),
|
|
(
|
|
"event",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
to="authentik_events.event",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Notification",
|
|
"verbose_name_plural": "Notifications",
|
|
},
|
|
),
|
|
]
|