diff --git a/authentik/outposts/api/outposts.py b/authentik/outposts/api/outposts.py index 93c184d80..4974f2f1f 100644 --- a/authentik/outposts/api/outposts.py +++ b/authentik/outposts/api/outposts.py @@ -116,6 +116,7 @@ class OutpostFilter(FilterSet): "providers": ["isnull"], "name": ["iexact", "icontains"], "service_connection__name": ["iexact", "icontains"], + "managed": ["iexact", "icontains"] } diff --git a/schema.yml b/schema.yml index 7f39ee8e4..3c52cd76d 100644 --- a/schema.yml +++ b/schema.yml @@ -5723,6 +5723,14 @@ paths: operationId: outposts_instances_list description: Outpost Viewset parameters: + - in: query + name: managed__icontains + schema: + type: string + - in: query + name: managed__iexact + schema: + type: string - in: query name: name__icontains schema: @@ -5931,6 +5939,14 @@ paths: operationId: outposts_instances_health_list description: Get outposts current health parameters: + - in: query + name: managed__icontains + schema: + type: string + - in: query + name: managed__iexact + schema: + type: string - in: query name: name__icontains schema: diff --git a/web/src/locales/en.po b/web/src/locales/en.po index 1dd03838b..811943c2e 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -3199,6 +3199,10 @@ msgstr "OAuth Authorization Codes" msgid "OAuth Refresh Codes" msgstr "OAuth Refresh Codes" +#: src/pages/admin-overview/cards/SystemStatusCard.ts +msgid "OK" +msgstr "OK" + #: src/pages/events/EventInfo.ts #: src/pages/events/EventInfo.ts msgid "Object" diff --git a/web/src/locales/fr_FR.po b/web/src/locales/fr_FR.po index a60a1daea..4fad1a33d 100644 --- a/web/src/locales/fr_FR.po +++ b/web/src/locales/fr_FR.po @@ -3175,6 +3175,10 @@ msgstr "Code d'autorisation OAuth" msgid "OAuth Refresh Codes" msgstr "Code de rafraîchissement OAuth" +#: src/pages/admin-overview/cards/SystemStatusCard.ts +msgid "OK" +msgstr "" + #: src/pages/events/EventInfo.ts #: src/pages/events/EventInfo.ts msgid "Object" diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index cc142fc00..494d95bfc 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -3189,6 +3189,10 @@ msgstr "" msgid "OAuth Refresh Codes" msgstr "" +#: src/pages/admin-overview/cards/SystemStatusCard.ts +msgid "OK" +msgstr "" + #: src/pages/events/EventInfo.ts #: src/pages/events/EventInfo.ts msgid "Object" diff --git a/web/src/pages/admin-overview/cards/SystemStatusCard.ts b/web/src/pages/admin-overview/cards/SystemStatusCard.ts index 9df5cdb89..5413e1f1f 100644 --- a/web/src/pages/admin-overview/cards/SystemStatusCard.ts +++ b/web/src/pages/admin-overview/cards/SystemStatusCard.ts @@ -3,7 +3,7 @@ import { t } from "@lingui/macro"; import { TemplateResult, html } from "lit"; import { customElement } from "lit/decorators.js"; -import { AdminApi, System } from "@goauthentik/api"; +import { AdminApi, OutpostsApi, System } from "@goauthentik/api"; import { DEFAULT_CONFIG } from "../../../api/Config"; import { AdminStatus, AdminStatusCard } from "./AdminStatusCard"; @@ -12,11 +12,34 @@ import { AdminStatus, AdminStatusCard } from "./AdminStatusCard"; export class SystemStatusCard extends AdminStatusCard { now?: Date; - header = "OK"; + header = t`OK`; - getPrimaryValue(): Promise { + async getPrimaryValue(): Promise { this.now = new Date(); - return new AdminApi(DEFAULT_CONFIG).adminSystemRetrieve(); + let status = await new AdminApi(DEFAULT_CONFIG).adminSystemRetrieve(); + if (status.embeddedOutpostHost === "") { + // First install, ensure the embedded outpost host is set + await this.setOutpostHost(); + status = await new AdminApi(DEFAULT_CONFIG).adminSystemRetrieve(); + } + return status; + } + + // Called on fresh installations and whenever the embedded outpost is deleted + // automatically send the login URL when the user first visits the admin dashboard. + async setOutpostHost(): Promise { + const outposts = await new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesList({ + managedIexact: "goauthentik.io/outposts/embedded", + }); + if (outposts.results.length < 1) { + return; + } + const outpost = outposts.results[0]; + outpost.config["authentik_host"] = window.location.origin; + await new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUpdate({ + uuid: outpost.pk, + outpostRequest: outpost, + }); } getStatus(value: System): Promise {