import "@goauthentik/admin/applications/ApplicationAuthorizeChart"; import "@goauthentik/admin/applications/ApplicationCheckAccessForm"; import "@goauthentik/admin/applications/ApplicationForm"; import "@goauthentik/admin/policies/BoundPoliciesList"; import { PFSize } from "@goauthentik/app/elements/Spinner"; import "@goauthentik/app/elements/rbac/ObjectPermissionsPage"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import "@goauthentik/components/ak-app-icon"; import "@goauthentik/components/events/ObjectChangelog"; import { AKElement } from "@goauthentik/elements/Base"; import "@goauthentik/elements/EmptyState"; import "@goauthentik/elements/PageHeader"; import "@goauthentik/elements/Tabs"; import "@goauthentik/elements/buttons/SpinnerButton"; import { msg } from "@lit/localize"; import { CSSResult, TemplateResult, html } from "lit"; import { customElement, property, state } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.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 PFList from "@patternfly/patternfly/components/List/list.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 { Application, CoreApi, OutpostsApi, RbacPermissionsAssignedByUsersListModelEnum, } from "@goauthentik/api"; @customElement("ak-application-view") export class ApplicationViewPage extends AKElement { @property() set applicationSlug(value: string) { new CoreApi(DEFAULT_CONFIG) .coreApplicationsRetrieve({ slug: value, }) .then((app) => { this.application = app; if ( app.providerObj && [ "authentik_providers_proxy.proxyprovider", "authentik_providers_ldap.ldapprovider", ].includes(app.providerObj.metaModelName) ) { new OutpostsApi(DEFAULT_CONFIG) .outpostsInstancesList({ providersByPk: [app.provider || 0], pageSize: 1, }) .then((outposts) => { if (outposts.pagination.count < 1) { this.missingOutpost = true; } }); } }); } @property({ attribute: false }) application!: Application; @state() missingOutpost = false; static get styles(): CSSResult[] { return [ PFBase, PFList, PFBanner, PFPage, PFContent, PFButton, PFDescriptionList, PFGrid, PFCard, ]; } render(): TemplateResult { return html` ${this.renderApp()}`; } renderApp(): TemplateResult { if (!this.application) { return html` `; } return html` ${this.missingOutpost ? html` ${msg("Warning: Application is not used by any Outpost.")} ` : html``} ${msg("Related")} ${this.application.providerObj ? html` ${msg("Provider")} ${this.application.providerObj?.name} (${this.application.providerObj?.verboseName}) ` : html``} ${(this.application.backchannelProvidersObj || []).length > 0 ? html` ${msg("Backchannel Providers")} ${this.application.backchannelProvidersObj.map( (provider) => { return html` ${provider.name} (${provider.verboseName}) `; }, )} ` : html``} ${msg("Policy engine mode")} ${this.application.policyEngineMode?.toUpperCase()} ${msg("Edit")} ${msg("Update")} ${msg("Update Application")} ${msg("Edit")} ${msg("Check access")} ${msg("Check")} ${msg("Check Application access")} ${msg("Test")} ${this.application.launchUrl ? html` ${msg("Launch")} ${msg("Launch")} ` : html``} ${msg("Logins over the last week (per 8 hours)")} ${this.application && html` `} ${msg("Changelog")} ${msg("These policies control which users can access this application.")} `; } }