web/admin: fix notification property mapping forms (#11298)
* fix incorrect base class Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix doclink url closes #11276 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix sidebar order in website Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		| @ -8,7 +8,7 @@ import { ifDefined } from "lit/directives/if-defined.js"; | ||||
|  | ||||
| interface PropertyMapping { | ||||
|     name: string; | ||||
|     expression: string; | ||||
|     expression?: string; | ||||
| } | ||||
|  | ||||
| export abstract class BasePropertyMappingForm<T extends PropertyMapping> extends ModelForm< | ||||
|  | ||||
| @ -1,14 +1,14 @@ | ||||
| import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm"; | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import "@goauthentik/elements/CodeMirror"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
|  | ||||
| import { customElement } from "lit/decorators.js"; | ||||
|  | ||||
| import { NotificationWebhookMapping, PropertymappingsApi } from "@goauthentik/api"; | ||||
|  | ||||
| @customElement("ak-property-mapping-notification-form") | ||||
| export class PropertyMappingNotification extends ModelForm<NotificationWebhookMapping, string> { | ||||
| export class PropertyMappingNotification extends BasePropertyMappingForm<NotificationWebhookMapping> { | ||||
|     loadInstance(pk: string): Promise<NotificationWebhookMapping> { | ||||
|         return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsNotificationRetrieve({ | ||||
|             pmUuid: pk, | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm"; | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import { docLink } from "@goauthentik/common/global"; | ||||
| import "@goauthentik/elements/CodeMirror"; | ||||
| import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror"; | ||||
| import "@goauthentik/elements/forms/FormGroup"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
| import "@goauthentik/elements/forms/Radio"; | ||||
| import type { RadioOption } from "@goauthentik/elements/forms/Radio"; | ||||
|  | ||||
| @ -33,21 +33,13 @@ export const staticSettingOptions: RadioOption<string | undefined>[] = [ | ||||
| ]; | ||||
|  | ||||
| @customElement("ak-property-mapping-provider-rac-form") | ||||
| export class PropertyMappingProviderRACForm extends ModelForm<RACPropertyMapping, string> { | ||||
| export class PropertyMappingProviderRACForm extends BasePropertyMappingForm<RACPropertyMapping> { | ||||
|     loadInstance(pk: string): Promise<RACPropertyMapping> { | ||||
|         return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsProviderRacRetrieve({ | ||||
|             pmUuid: pk, | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     getSuccessMessage(): string { | ||||
|         if (this.instance) { | ||||
|             return msg("Successfully updated mapping."); | ||||
|         } else { | ||||
|             return msg("Successfully created mapping."); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async send(data: RACPropertyMapping): Promise<RACPropertyMapping> { | ||||
|         if (this.instance) { | ||||
|             return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsProviderRacUpdate({ | ||||
|  | ||||
| @ -10,7 +10,7 @@ import { LDAPSourcePropertyMapping, PropertymappingsApi } from "@goauthentik/api | ||||
| @customElement("ak-property-mapping-source-ldap-form") | ||||
| export class PropertyMappingSourceLDAPForm extends BasePropertyMappingForm<LDAPSourcePropertyMapping> { | ||||
|     docLink(): string { | ||||
|         return "/docs/sources/property-mappings/expression?utm_source=authentik"; | ||||
|         return "/docs/sources/property-mappings/expressions?utm_source=authentik"; | ||||
|     } | ||||
|  | ||||
|     loadInstance(pk: string): Promise<LDAPSourcePropertyMapping> { | ||||
|  | ||||
| @ -10,7 +10,7 @@ import { OAuthSourcePropertyMapping, PropertymappingsApi } from "@goauthentik/ap | ||||
| @customElement("ak-property-mapping-source-oauth-form") | ||||
| export class PropertyMappingSourceOAuthForm extends BasePropertyMappingForm<OAuthSourcePropertyMapping> { | ||||
|     docLink(): string { | ||||
|         return "/docs/sources/property-mappings/expression?utm_source=authentik"; | ||||
|         return "/docs/sources/property-mappings/expressions?utm_source=authentik"; | ||||
|     } | ||||
|  | ||||
|     loadInstance(pk: string): Promise<OAuthSourcePropertyMapping> { | ||||
|  | ||||
| @ -10,7 +10,7 @@ import { PlexSourcePropertyMapping, PropertymappingsApi } from "@goauthentik/api | ||||
| @customElement("ak-property-mapping-source-plex-form") | ||||
| export class PropertyMappingSourcePlexForm extends BasePropertyMappingForm<PlexSourcePropertyMapping> { | ||||
|     docLink(): string { | ||||
|         return "/docs/sources/property-mappings/expression?utm_source=authentik"; | ||||
|         return "/docs/sources/property-mappings/expressions?utm_source=authentik"; | ||||
|     } | ||||
|  | ||||
|     loadInstance(pk: string): Promise<PlexSourcePropertyMapping> { | ||||
|  | ||||
| @ -10,7 +10,7 @@ import { PropertymappingsApi, SAMLSourcePropertyMapping } from "@goauthentik/api | ||||
| @customElement("ak-property-mapping-source-saml-form") | ||||
| export class PropertyMappingSourceSAMLForm extends BasePropertyMappingForm<SAMLSourcePropertyMapping> { | ||||
|     docLink(): string { | ||||
|         return "/docs/sources/property-mappings/expression?utm_source=authentik"; | ||||
|         return "/docs/sources/property-mappings/expressions?utm_source=authentik"; | ||||
|     } | ||||
|  | ||||
|     loadInstance(pk: string): Promise<SAMLSourcePropertyMapping> { | ||||
|  | ||||
| @ -10,7 +10,7 @@ import { PropertymappingsApi, SCIMSourcePropertyMapping } from "@goauthentik/api | ||||
| @customElement("ak-property-mapping-source-scim-form") | ||||
| export class PropertyMappingSourceSCIMForm extends BasePropertyMappingForm<SCIMSourcePropertyMapping> { | ||||
|     docLink(): string { | ||||
|         return "/docs/sources/property-mappings/expression?utm_source=authentik"; | ||||
|         return "/docs/sources/property-mappings/expressions?utm_source=authentik"; | ||||
|     } | ||||
|  | ||||
|     loadInstance(pk: string): Promise<SCIMSourcePropertyMapping> { | ||||
|  | ||||
| @ -77,13 +77,17 @@ const docsSidebar = { | ||||
|             items: [ | ||||
|                 { | ||||
|                     type: "category", | ||||
|                     label: "Property Mappings", | ||||
|                     label: "OAuth2 Provider", | ||||
|                     link: { | ||||
|                         type: "doc", | ||||
|                         id: "providers/property-mappings/index", | ||||
|                         id: "providers/oauth2/index", | ||||
|                     }, | ||||
|                     items: ["providers/property-mappings/expression"], | ||||
|                     items: [ | ||||
|                         "providers/oauth2/client_credentials", | ||||
|                         "providers/oauth2/device_code", | ||||
|                     ], | ||||
|                 }, | ||||
|                 "providers/saml/index", | ||||
|                 { | ||||
|                     type: "category", | ||||
|                     label: "Google Workspace Provider", | ||||
| @ -117,19 +121,6 @@ const docsSidebar = { | ||||
|                         "providers/entra/add-entra-provider", | ||||
|                     ], | ||||
|                 }, | ||||
|                 { | ||||
|                     type: "category", | ||||
|                     label: "OAuth2 Provider", | ||||
|                     link: { | ||||
|                         type: "doc", | ||||
|                         id: "providers/oauth2/index", | ||||
|                     }, | ||||
|                     items: [ | ||||
|                         "providers/oauth2/client_credentials", | ||||
|                         "providers/oauth2/device_code", | ||||
|                     ], | ||||
|                 }, | ||||
|                 "providers/saml/index", | ||||
|                 "providers/radius/index", | ||||
|                 { | ||||
|                     type: "category", | ||||
| @ -167,6 +158,15 @@ const docsSidebar = { | ||||
|                     }, | ||||
|                     items: ["providers/rac/how-to-rac"], | ||||
|                 }, | ||||
|                 { | ||||
|                     type: "category", | ||||
|                     label: "Property Mappings", | ||||
|                     link: { | ||||
|                         type: "doc", | ||||
|                         id: "providers/property-mappings/index", | ||||
|                     }, | ||||
|                     items: ["providers/property-mappings/expression"], | ||||
|                 }, | ||||
|             ], | ||||
|         }, | ||||
|         { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens L.
					Jens L.