Skip to content

Commit

Permalink
web/admin: fix notification property mapping forms (goauthentik#11298)
Browse files Browse the repository at this point in the history
* fix incorrect base class

Signed-off-by: Jens Langhammer <[email protected]>

* fix doclink url

closes goauthentik#11276

Signed-off-by: Jens Langhammer <[email protected]>

* fix sidebar order in website

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
  • Loading branch information
BeryJu authored Sep 9, 2024
1 parent 52cd4a9 commit 3308c00
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 34 deletions.
2 changes: 1 addition & 1 deletion web/src/admin/property-mappings/BasePropertyMappingForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
12 changes: 2 additions & 10 deletions web/src/admin/property-mappings/PropertyMappingProviderRACForm.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
32 changes: 16 additions & 16 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
},
],
},
{
Expand Down

0 comments on commit 3308c00

Please sign in to comment.