import "@goauthentik/admin/groups/RelatedGroupList"; import "@goauthentik/admin/users/UserActiveForm"; import "@goauthentik/admin/users/UserChart"; import "@goauthentik/admin/users/UserForm"; import "@goauthentik/admin/users/UserPasswordForm"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { EVENT_REFRESH } from "@goauthentik/common/constants"; import { MessageLevel } from "@goauthentik/common/messages"; import { AKElement, rootInterface } from "@goauthentik/elements/Base"; import "@goauthentik/elements/CodeMirror"; import { PFColor } from "@goauthentik/elements/Label"; import "@goauthentik/elements/PageHeader"; import { PFSize } from "@goauthentik/elements/Spinner"; import "@goauthentik/elements/Tabs"; import "@goauthentik/elements/buttons/ActionButton"; import "@goauthentik/elements/buttons/SpinnerButton"; import "@goauthentik/elements/events/ObjectChangelog"; import "@goauthentik/elements/events/UserEvents"; import "@goauthentik/elements/forms/ModalForm"; import { showMessage } from "@goauthentik/elements/messages/MessageContainer"; import "@goauthentik/elements/oauth/UserRefreshList"; import "@goauthentik/elements/user/SessionList"; import "@goauthentik/elements/user/UserConsentList"; import "@goauthentik/elements/user/UserDevicesList"; import { t } from "@lingui/macro"; import { CSSResult, TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; 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 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 PFDisplay from "@patternfly/patternfly/utilities/Display/display.css"; import PFFlex from "@patternfly/patternfly/utilities/Flex/flex.css"; import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css"; import { CapabilitiesEnum, CoreApi, User } from "@goauthentik/api"; @customElement("ak-user-view") export class UserViewPage extends AKElement { @property({ type: Number }) set userId(id: number) { new CoreApi(DEFAULT_CONFIG) .coreUsersRetrieve({ id: id, }) .then((user) => { this.user = user; }); } @property({ attribute: false }) user?: User; static get styles(): CSSResult[] { return [ PFBase, PFPage, PFFlex, PFButton, PFDisplay, PFGrid, PFContent, PFCard, PFDescriptionList, PFSizing, ]; } constructor() { super(); this.addEventListener(EVENT_REFRESH, () => { if (!this.user?.pk) return; this.userId = this.user?.pk; }); } render(): TemplateResult { return html` ${this.renderBody()}`; } renderBody(): TemplateResult { if (!this.user) { return html``; } return html`
${t`User Info`}
${t`Username`}
${this.user.username}
${t`Name`}
${this.user.name}
${t`Email`}
${this.user.email || "-"}
${t`Last login`}
${this.user.lastLogin?.toLocaleString()}
${t`Active`}
${t`Superuser`}
${rootInterface()?.config?.capabilities.includes( CapabilitiesEnum.Impersonate, ) ? html` ${t`Impersonate`} ` : html``}
${t`Actions over the last week (per 8 hours)`}
${t`Changelog`}
`; } }