events: include full group in event notification
This commit is contained in:
parent
7ff679b1a3
commit
1342266368
|
@ -11,6 +11,7 @@ class NotificationTriggerSerializer(ModelSerializer):
|
|||
class Meta:
|
||||
|
||||
model = NotificationTrigger
|
||||
depth = 2
|
||||
fields = [
|
||||
"pk",
|
||||
"name",
|
||||
|
|
95
swagger.yaml
95
swagger.yaml
|
@ -7663,7 +7663,6 @@ definitions:
|
|||
description: NotificationTrigger Serializer
|
||||
required:
|
||||
- name
|
||||
- transports
|
||||
type: object
|
||||
properties:
|
||||
pk:
|
||||
|
@ -7676,17 +7675,35 @@ definitions:
|
|||
type: string
|
||||
minLength: 1
|
||||
transports:
|
||||
description: Select which transports should be used to notify the user. If
|
||||
none are selected, the notification will only be shown in the authentik
|
||||
UI.
|
||||
description: ''
|
||||
type: array
|
||||
items:
|
||||
description: Select which transports should be used to notify the user.
|
||||
If none are selected, the notification will only be shown in the authentik
|
||||
UI.
|
||||
type: string
|
||||
format: uuid
|
||||
uniqueItems: true
|
||||
description: Action which is executed when a Trigger matches
|
||||
required:
|
||||
- name
|
||||
- mode
|
||||
type: object
|
||||
properties:
|
||||
uuid:
|
||||
title: Uuid
|
||||
type: string
|
||||
format: uuid
|
||||
readOnly: true
|
||||
name:
|
||||
title: Name
|
||||
type: string
|
||||
minLength: 1
|
||||
mode:
|
||||
title: Mode
|
||||
type: string
|
||||
enum:
|
||||
- webhook
|
||||
- webhook_slack
|
||||
- email
|
||||
webhook_url:
|
||||
title: Webhook url
|
||||
type: string
|
||||
readOnly: true
|
||||
severity:
|
||||
title: Severity
|
||||
description: Controls which severity level the created notifications will
|
||||
|
@ -7697,12 +7714,58 @@ definitions:
|
|||
- warning
|
||||
- alert
|
||||
group:
|
||||
title: Group
|
||||
description: Define which group of users this notification should be sent
|
||||
and shown to. If left empty, Notification won't ben sent.
|
||||
type: string
|
||||
format: uuid
|
||||
x-nullable: true
|
||||
description: Custom Group model which supports a basic hierarchy
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
properties:
|
||||
group_uuid:
|
||||
title: Group uuid
|
||||
type: string
|
||||
format: uuid
|
||||
readOnly: true
|
||||
name:
|
||||
title: Name
|
||||
type: string
|
||||
maxLength: 80
|
||||
minLength: 1
|
||||
is_superuser:
|
||||
title: Is superuser
|
||||
description: Users added to this group will be superusers.
|
||||
type: boolean
|
||||
attributes:
|
||||
title: Attributes
|
||||
type: object
|
||||
parent:
|
||||
description: Custom Group model which supports a basic hierarchy
|
||||
required:
|
||||
- name
|
||||
- parent
|
||||
type: object
|
||||
properties:
|
||||
group_uuid:
|
||||
title: Group uuid
|
||||
type: string
|
||||
format: uuid
|
||||
readOnly: true
|
||||
name:
|
||||
title: Name
|
||||
type: string
|
||||
maxLength: 80
|
||||
minLength: 1
|
||||
is_superuser:
|
||||
title: Is superuser
|
||||
description: Users added to this group will be superusers.
|
||||
type: boolean
|
||||
attributes:
|
||||
title: Attributes
|
||||
type: object
|
||||
parent:
|
||||
title: Parent
|
||||
type: string
|
||||
format: uuid
|
||||
readOnly: true
|
||||
readOnly: true
|
||||
Stage:
|
||||
title: Stage obj
|
||||
description: Stage Serializer
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import { DefaultClient, QueryArguments, PBResponse } from "./Client";
|
||||
|
||||
export class Notification {
|
||||
pk: string;
|
||||
name: string;
|
||||
mode: string;
|
||||
mode_verbose: string;
|
||||
webhook_url: string;
|
||||
|
||||
constructor() {
|
||||
throw Error();
|
||||
}
|
||||
|
||||
static get(pk: string): Promise<Transport> {
|
||||
return DefaultClient.fetch<Transport>(["events", "transports", pk]);
|
||||
}
|
||||
|
||||
static list(filter?: QueryArguments): Promise<PBResponse<Transport>> {
|
||||
return DefaultClient.fetch<PBResponse<Transport>>(["events", "transports"], filter);
|
||||
}
|
||||
|
||||
static adminUrl(rest: string): string {
|
||||
return `/administration/events/transports/${rest}`;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
import { DefaultClient, QueryArguments, PBResponse } from "./Client";
|
||||
import { Group } from "./Groups";
|
||||
|
||||
export class Trigger {
|
||||
pk: string;
|
||||
name: string;
|
||||
transports: string[];
|
||||
severity: string;
|
||||
group?: string;
|
||||
group?: Group;
|
||||
|
||||
constructor() {
|
||||
throw Error();
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
export class Group {
|
||||
|
||||
group_uuid: string;
|
||||
name: string;
|
||||
is_superuser: boolean;
|
||||
attributes: object;
|
||||
parent?: Group;
|
||||
|
||||
constructor() {
|
||||
throw Error();
|
||||
}
|
||||
|
||||
}
|
|
@ -50,7 +50,7 @@ export class TriggerListPage extends TablePage<Trigger> {
|
|||
return [
|
||||
html`${item.name}`,
|
||||
html`${item.severity}`,
|
||||
html`${item.group || gettext("None (trigger disabled)")}`,
|
||||
html`${item.group?.name || gettext("None (trigger disabled)")}`,
|
||||
html`
|
||||
<ak-modal-button href="${Trigger.adminUrl(`${item.pk}/update/`)}">
|
||||
<ak-spinner-button slot="trigger" class="pf-m-secondary">
|
||||
|
|
Reference in New Issue