diff --git a/schema.yml b/schema.yml index b9c9e8cf1..cc728706b 100644 --- a/schema.yml +++ b/schema.yml @@ -33222,10 +33222,6 @@ components: type: string icon: type: string - nullable: true - description: |- - Get the URL to the Icon. If the name is /static or - starts with http it is returned as-is readOnly: true server_uri: type: string @@ -34415,10 +34411,6 @@ components: type: string icon: type: string - nullable: true - description: |- - Get the URL to the Icon. If the name is /static or - starts with http it is returned as-is readOnly: true provider_type: $ref: '#/components/schemas/ProviderTypeEnum' @@ -38802,10 +38794,6 @@ components: type: string icon: type: string - nullable: true - description: |- - Get the URL to the Icon. If the name is /static or - starts with http it is returned as-is readOnly: true client_id: type: string @@ -40752,10 +40740,6 @@ components: type: string icon: type: string - nullable: true - description: |- - Get the URL to the Icon. If the name is /static or - starts with http it is returned as-is readOnly: true pre_authentication_flow: type: string @@ -41505,10 +41489,6 @@ components: type: string icon: type: string - nullable: true - description: |- - Get the URL to the Icon. If the name is /static or - starts with http it is returned as-is readOnly: true required: - component diff --git a/web/src/admin/AdminInterface/AdminSidebar.ts b/web/src/admin/AdminInterface/AdminSidebar.ts index 2b27be91d..57381a1de 100644 --- a/web/src/admin/AdminInterface/AdminSidebar.ts +++ b/web/src/admin/AdminInterface/AdminSidebar.ts @@ -142,7 +142,8 @@ export class AkAdminSidebar extends AKElement { [null, msg("System"), null, [ ["/core/brands", msg("Brands")], ["/crypto/certificates", msg("Certificates")], - ["/outpost/integrations", msg("Outpost Integrations")]]] + ["/outpost/integrations", msg("Outpost Integrations")], + ["/admin/settings", msg("Settings")]]], ]; // Typescript requires the type here to correctly type the recursive path diff --git a/web/src/admin/Routes.ts b/web/src/admin/Routes.ts index 78e7803d1..d7f9792c9 100644 --- a/web/src/admin/Routes.ts +++ b/web/src/admin/Routes.ts @@ -136,6 +136,10 @@ export const ROUTES: Route[] = [ await import("@goauthentik/admin/crypto/CertificateKeyPairListPage"); return html``; }), + new Route(new RegExp("^/admin/settings$"), async() => { + await import("@goauthentik/admin/admin-settings/AdminSettingsViewPage"); + return html``; + }), new Route(new RegExp("^/blueprints/instances$"), async () => { await import("@goauthentik/admin/blueprints/BlueprintListPage"); return html``; diff --git a/web/src/admin/admin-settings/AdminSettingsForm.ts b/web/src/admin/admin-settings/AdminSettingsForm.ts new file mode 100644 index 000000000..b63964f8e --- /dev/null +++ b/web/src/admin/admin-settings/AdminSettingsForm.ts @@ -0,0 +1,49 @@ +import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; +import { dateTimeLocal, first } from "@goauthentik/common/utils"; +import "@goauthentik/elements/forms/FormGroup"; +import "@goauthentik/elements/forms/HorizontalFormElement"; +import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; +import "@goauthentik/elements/forms/Radio"; +import "@goauthentik/elements/forms/SearchSelect"; + +import { msg } from "@lit/localize"; +import { TemplateResult, html } from "lit"; +import { customElement, state } from "lit/decorators.js"; + +import { AdminApi, Settings } from "@goauthentik/api"; + +@customElement("ak-admin-settings-form") +export class AdminSettingsForm extends ModelForm { + + async loadInstance(pk: string): Promise { + return await new AdminApi(DEFAULT_CONFIG).adminSettingsRetrieve(); + } + + getSuccessMessage(): string { + return msg("Successfully updated settings."); + } + + async send(data: Settings): Promise { + return new AdminApi(DEFAULT_CONFIG).adminSettingsUpdate({ + settingsRequest: data + }); + } + + renderForm(): TemplateResult { + return html` + +

+ ${msg("Configure how authentik should show avatars for users.")} +

+
`; + } +} diff --git a/web/src/admin/admin-settings/AdminSettingsViewPage.ts b/web/src/admin/admin-settings/AdminSettingsViewPage.ts new file mode 100644 index 000000000..2b39d7eeb --- /dev/null +++ b/web/src/admin/admin-settings/AdminSettingsViewPage.ts @@ -0,0 +1,184 @@ +import "@goauthentik/admin/admin-settings/AdminSettingsForm"; +import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; +import { EVENT_REFRESH } from "@goauthentik/common/constants"; +import { convertToTitle } from "@goauthentik/common/utils"; +import "@goauthentik/components/events/ObjectChangelog"; +import { AKElement } from "@goauthentik/elements/Base"; +import "@goauthentik/elements/CodeMirror"; +import "@goauthentik/elements/EmptyState"; +import "@goauthentik/elements/Markdown"; +import "@goauthentik/elements/PageHeader"; +import "@goauthentik/elements/Tabs"; +import "@goauthentik/elements/buttons/ModalButton"; +import "@goauthentik/elements/buttons/SpinnerButton"; +import "@goauthentik/elements/forms/ModalForm"; + +import { msg } from "@lit/localize"; +import { CSSResult, TemplateResult, html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; + +import PFBanner from "@patternfly/patternfly/components/Banner/banner.css"; +import PFButton from "@patternfly/patternfly/components/Button/button.css"; +import PFCard from "@patternfly/patternfly/components/Card/card.css"; +import PFContent from "@patternfly/patternfly/components/Content/content.css"; +import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css"; +import PFForm from "@patternfly/patternfly/components/Form/form.css"; +import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; +import PFPage from "@patternfly/patternfly/components/Page/page.css"; +import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css"; +import PFBase from "@patternfly/patternfly/patternfly-base.css"; + +import { AdminApi, Settings } from "@goauthentik/api"; + +@customElement("ak-admin-settings-view") +export class AdminSettingsViewPage extends AKElement { + @property({ attribute: false }) + settings?: Settings; + + firstUpdated(): void { + new AdminApi(DEFAULT_CONFIG).adminSettingsRetrieve().then((settings) => { + this.settings = settings; + }); + } + + static get styles(): CSSResult[] { + return [ + PFBase, + PFButton, + PFPage, + PFGrid, + PFContent, + PFCard, + PFDescriptionList, + PFForm, + PFFormControl, + PFBanner, + ]; + } + + render(): TemplateResult { + if (!this.settings) { + return html``; + } + // TODO: someone else than Marc, make this look ok, perhaps by directly embedding the form + // with Save/Cancel buttons + // TODO: add descriptive text about what each of these do, as is currently presented in + // https://goauthentik.io/docs/installation/configuration + return html` + ${msg("System settings")} + +
+
+
+
+
+
+ ${msg("Avatars")} +
+
+
+ ${this.settings.avatars} +
+
+
+
+
+ ${msg("Default user change name")} +
+
+
+ ${this.settings.defaultUserChangeName + ? msg("Allowed") + : msg("Disallowed")} +
+
+
+
+
+ ${msg("Default user change email")} +
+
+
+ ${this.settings.defaultUserChangeEmail + ? msg("Allowed") + : msg("Disallowed")} +
+
+
+
+
+ ${msg("Default user change username")} +
+
+
+ ${this.settings.defaultUserChangeUsername + ? msg("Allowed") + : msg("Disallowed")} +
+
+
+
+
+ ${msg("GDPR compliance")} +
+
+
+ ${this.settings.defaultUserChangeUsername + ? msg("Enabled") + : msg("Disabled")} +
+
+
+
+
+ ${msg("Impersonation")} +
+
+
+ ${this.settings.defaultUserChangeUsername + ? msg("Enabled") + : msg("Disabled")} +
+
+
+
+
+ ${msg("Footer links")} +
+
+
+ ${this.settings.footerLinks} +
+
+
+
+
+ +
+
`; + } +}