import "@goauthentik/admin/applications/entitlements/ApplicationEntitlementForm"; import "@goauthentik/admin/policies/BoundPoliciesList"; import { PolicyBindingCheckTarget } from "@goauthentik/admin/policies/utils"; import "@goauthentik/admin/rbac/ObjectPermissionModal"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { PFSize } from "@goauthentik/common/enums"; import "@goauthentik/components/ak-status-label"; import "@goauthentik/elements/Tabs"; import "@goauthentik/elements/forms/DeleteBulkForm"; import "@goauthentik/elements/forms/ModalForm"; import "@goauthentik/elements/forms/ProxyForm"; import { PaginatedResponse } from "@goauthentik/elements/table/Table"; import { Table, TableColumn } from "@goauthentik/elements/table/Table"; import { msg } from "@lit/localize"; import { TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { ApplicationEntitlement, CoreApi, RbacPermissionsAssignedByUsersListModelEnum, } from "@goauthentik/api"; @customElement("ak-application-entitlements-list") export class ApplicationEntitlementsPage extends Table { @property() app?: string; checkbox = true; clearOnRefresh = true; expandable = true; order = "order"; async apiEndpoint(): Promise> { return new CoreApi(DEFAULT_CONFIG).coreApplicationEntitlementsList({ ...(await this.defaultEndpointConfig()), app: this.app || "", }); } columns(): TableColumn[] { return [new TableColumn(msg("Name"), "name"), new TableColumn(msg("Actions"))]; } renderToolbarSelected(): TemplateResult { const disabled = this.selectedElements.length < 1; return html` { return new CoreApi(DEFAULT_CONFIG).coreApplicationEntitlementsUsedByList({ pbmUuid: item.pbmUuid || "", }); }} .delete=${(item: ApplicationEntitlement) => { return new CoreApi(DEFAULT_CONFIG).coreApplicationEntitlementsDestroy({ pbmUuid: item.pbmUuid || "", }); }} > `; } row(item: ApplicationEntitlement): TemplateResult[] { return [ html`${item.name}`, html` ${msg("Update")} ${msg("Update Entitlement")} `, ]; } renderExpanded(item: ApplicationEntitlement): TemplateResult { return html`

${msg( "These bindings control which users have access to this entitlement.", )}

`; } renderEmpty(): TemplateResult { return super.renderEmpty( html`
${msg( "This application does currently not have any application entitlement defined.", )}
`, ); } renderToolbar(): TemplateResult { return html` ${msg("Create")} ${msg("Create Entitlement")} `; } } declare global { interface HTMLElementTagNameMap { "ak-application-roles-list": ApplicationEntitlementsPage; } }