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:
|
class Meta:
|
||||||
|
|
||||||
model = NotificationTrigger
|
model = NotificationTrigger
|
||||||
|
depth = 2
|
||||||
fields = [
|
fields = [
|
||||||
"pk",
|
"pk",
|
||||||
"name",
|
"name",
|
||||||
|
|
95
swagger.yaml
95
swagger.yaml
|
@ -7663,7 +7663,6 @@ definitions:
|
||||||
description: NotificationTrigger Serializer
|
description: NotificationTrigger Serializer
|
||||||
required:
|
required:
|
||||||
- name
|
- name
|
||||||
- transports
|
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
pk:
|
pk:
|
||||||
|
@ -7676,17 +7675,35 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
minLength: 1
|
minLength: 1
|
||||||
transports:
|
transports:
|
||||||
description: Select which transports should be used to notify the user. If
|
description: ''
|
||||||
none are selected, the notification will only be shown in the authentik
|
|
||||||
UI.
|
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
description: Select which transports should be used to notify the user.
|
description: Action which is executed when a Trigger matches
|
||||||
If none are selected, the notification will only be shown in the authentik
|
required:
|
||||||
UI.
|
- name
|
||||||
type: string
|
- mode
|
||||||
format: uuid
|
type: object
|
||||||
uniqueItems: true
|
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:
|
severity:
|
||||||
title: Severity
|
title: Severity
|
||||||
description: Controls which severity level the created notifications will
|
description: Controls which severity level the created notifications will
|
||||||
|
@ -7697,12 +7714,58 @@ definitions:
|
||||||
- warning
|
- warning
|
||||||
- alert
|
- alert
|
||||||
group:
|
group:
|
||||||
title: Group
|
description: Custom Group model which supports a basic hierarchy
|
||||||
description: Define which group of users this notification should be sent
|
required:
|
||||||
and shown to. If left empty, Notification won't ben sent.
|
- name
|
||||||
type: string
|
type: object
|
||||||
format: uuid
|
properties:
|
||||||
x-nullable: true
|
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:
|
Stage:
|
||||||
title: Stage obj
|
title: Stage obj
|
||||||
description: Stage Serializer
|
description: Stage Serializer
|
||||||
|
|
25
web/src/api/EventNotification.ts
Normal file
25
web/src/api/EventNotification.ts
Normal file
|
@ -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 { DefaultClient, QueryArguments, PBResponse } from "./Client";
|
||||||
|
import { Group } from "./Groups";
|
||||||
|
|
||||||
export class Trigger {
|
export class Trigger {
|
||||||
pk: string;
|
pk: string;
|
||||||
name: string;
|
name: string;
|
||||||
transports: string[];
|
transports: string[];
|
||||||
severity: string;
|
severity: string;
|
||||||
group?: string;
|
group?: Group;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
throw Error();
|
throw Error();
|
||||||
|
|
13
web/src/api/Groups.ts
Normal file
13
web/src/api/Groups.ts
Normal file
|
@ -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 [
|
return [
|
||||||
html`${item.name}`,
|
html`${item.name}`,
|
||||||
html`${item.severity}`,
|
html`${item.severity}`,
|
||||||
html`${item.group || gettext("None (trigger disabled)")}`,
|
html`${item.group?.name || gettext("None (trigger disabled)")}`,
|
||||||
html`
|
html`
|
||||||
<ak-modal-button href="${Trigger.adminUrl(`${item.pk}/update/`)}">
|
<ak-modal-button href="${Trigger.adminUrl(`${item.pk}/update/`)}">
|
||||||
<ak-spinner-button slot="trigger" class="pf-m-secondary">
|
<ak-spinner-button slot="trigger" class="pf-m-secondary">
|
||||||
|
|
Reference in a new issue