diff --git a/web/src/elements/user/UserConsentList.ts b/web/src/elements/user/UserConsentList.ts new file mode 100644 index 000000000..921bb43ef --- /dev/null +++ b/web/src/elements/user/UserConsentList.ts @@ -0,0 +1,55 @@ +import { gettext } from "django"; +import { customElement, html, property, TemplateResult } from "lit-element"; +import { AKResponse } from "../../api/Client"; +import { Table, TableColumn } from "../table/Table"; + +import "../forms/DeleteForm"; +import { PAGE_SIZE } from "../../constants"; +import { CoreApi, UserConsent } from "authentik-api"; +import { DEFAULT_CONFIG } from "../../api/Config"; + +@customElement("ak-user-consent-list") +export class UserConsentList extends Table { + @property() + userId?: string; + + apiEndpoint(page: number): Promise> { + return new CoreApi(DEFAULT_CONFIG).coreUserConsentList({ + user: this.userId, + ordering: "expires", + page: page, + pageSize: PAGE_SIZE, + }); + } + + order = "-expires"; + + columns(): TableColumn[] { + return [ + new TableColumn("Application", "application"), + new TableColumn("Expires", "expires"), + new TableColumn(""), + ]; + } + + row(item: UserConsent): TemplateResult[] { + return [ + html`${item.application.name}`, + html`${item.expires?.toLocaleString()}`, + html` + { + return new CoreApi(DEFAULT_CONFIG).coreUserConsentDelete({ + id: item.pk || 0, + }); + }}> + + `, + ]; + } + +} diff --git a/web/src/interfaces/AdminInterface.ts b/web/src/interfaces/AdminInterface.ts index 68322fba2..9a9821fdc 100644 --- a/web/src/interfaces/AdminInterface.ts +++ b/web/src/interfaces/AdminInterface.ts @@ -51,7 +51,7 @@ export const SIDEBAR_ITEMS: SidebarItem[] = [ return me().then(u => u.isSuperuser||false); }), new SidebarItem("Identity & Cryptography").children( - new SidebarItem("User", "/identity/users"), + new SidebarItem("User", "/identity/users").activeWhen(`^/identity/users/(?${ID_REGEX})$`), new SidebarItem("Groups", "/identity/groups"), new SidebarItem("Certificates", "/crypto/certificates"), new SidebarItem("Tokens", "/core/tokens"), diff --git a/web/src/pages/applications/ApplicationViewPage.ts b/web/src/pages/applications/ApplicationViewPage.ts index a3992f292..c4a663dcf 100644 --- a/web/src/pages/applications/ApplicationViewPage.ts +++ b/web/src/pages/applications/ApplicationViewPage.ts @@ -78,9 +78,9 @@ export class ApplicationViewPage extends LitElement {