* main: (213 commits) website/docs: configuration: fix typo in kubectl command (#10492) website/integrations: fix typo in minio instructions (#10500) web: bump @typescript-eslint/eslint-plugin from 7.5.0 to 7.16.0 in /tests/wdio (#10496) website: bump prettier from 3.3.2 to 3.3.3 in /website (#10493) core: bump ruff from 0.5.1 to 0.5.2 (#10494) web: bump @typescript-eslint/parser from 7.5.0 to 7.16.0 in /tests/wdio (#10495) web: bump eslint-plugin-sonarjs from 0.25.1 to 1.0.3 in /tests/wdio (#10498) web: bump prettier from 3.3.2 to 3.3.3 in /tests/wdio (#10497) web: bump pseudolocale from 2.0.0 to 2.1.0 in /web (#10499) core: bump goauthentik.io/api/v3 from 3.2024061.1 to 3.2024061.2 (#10491) web: bump API Client version (#10488) flows: remove stage challenge type (#10476) core: bump github.com/redis/go-redis/v9 from 9.5.3 to 9.5.4 (#10469) core: bump goauthentik.io/api/v3 from 3.2024060.6 to 3.2024061.1 (#10470) web: bump the babel group across 1 directory with 2 updates (#10471) web: bump the storybook group across 1 directory with 7 updates (#10472) core: bump coverage from 7.5.4 to 7.6.0 (#10473) website/docs: air gapped: clarify .env usage at the top for Kubernetes installations (#10447) website/docs: air gapped: update "see configuration" wording (#10448) website/docs: Add Kubernetes Bootstrap Instructions (#9541) ...
113 lines
3.9 KiB
TypeScript
113 lines
3.9 KiB
TypeScript
import "@goauthentik/admin/groups/GroupForm";
|
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
|
import "@goauthentik/components/ak-status-label";
|
|
import "@goauthentik/elements/buttons/SpinnerButton";
|
|
import "@goauthentik/elements/forms/DeleteBulkForm";
|
|
import "@goauthentik/elements/forms/ModalForm";
|
|
import { PaginatedResponse } from "@goauthentik/elements/table/Table";
|
|
import { TableColumn } from "@goauthentik/elements/table/Table";
|
|
import { TablePage } from "@goauthentik/elements/table/TablePage";
|
|
import "@patternfly/elements/pf-tooltip/pf-tooltip.js";
|
|
|
|
import { msg } from "@lit/localize";
|
|
import { TemplateResult, html } from "lit";
|
|
import { customElement, property } from "lit/decorators.js";
|
|
|
|
import { CoreApi, Group } from "@goauthentik/api";
|
|
|
|
@customElement("ak-group-list")
|
|
export class GroupListPage extends TablePage<Group> {
|
|
checkbox = true;
|
|
clearOnRefresh = true;
|
|
searchEnabled(): boolean {
|
|
return true;
|
|
}
|
|
pageTitle(): string {
|
|
return msg("Groups");
|
|
}
|
|
pageDescription(): string {
|
|
return msg("Group users together and give them permissions based on the membership.");
|
|
}
|
|
pageIcon(): string {
|
|
return "pf-icon pf-icon-users";
|
|
}
|
|
|
|
@property()
|
|
order = "name";
|
|
|
|
async apiEndpoint(): Promise<PaginatedResponse<Group>> {
|
|
return new CoreApi(DEFAULT_CONFIG).coreGroupsList({
|
|
...(await this.defaultEndpointConfig()),
|
|
includeUsers: false,
|
|
});
|
|
}
|
|
|
|
columns(): TableColumn[] {
|
|
return [
|
|
new TableColumn(msg("Name"), "name"),
|
|
new TableColumn(msg("Parent"), "parent"),
|
|
new TableColumn(msg("Members")),
|
|
new TableColumn(msg("Superuser privileges?")),
|
|
new TableColumn(msg("Actions")),
|
|
];
|
|
}
|
|
|
|
renderToolbarSelected(): TemplateResult {
|
|
const disabled = this.selectedElements.length < 1;
|
|
return html`<ak-forms-delete-bulk
|
|
objectLabel=${msg("Group(s)")}
|
|
.objects=${this.selectedElements}
|
|
.usedBy=${(item: Group) => {
|
|
return new CoreApi(DEFAULT_CONFIG).coreGroupsUsedByList({
|
|
groupUuid: item.pk,
|
|
});
|
|
}}
|
|
.delete=${(item: Group) => {
|
|
return new CoreApi(DEFAULT_CONFIG).coreGroupsDestroy({
|
|
groupUuid: item.pk,
|
|
});
|
|
}}
|
|
>
|
|
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
|
|
${msg("Delete")}
|
|
</button>
|
|
</ak-forms-delete-bulk>`;
|
|
}
|
|
|
|
row(item: Group): TemplateResult[] {
|
|
return [
|
|
html`<a href="#/identity/groups/${item.pk}">${item.name}</a>`,
|
|
html`${item.parentName || msg("-")}`,
|
|
html`${Array.from(item.users || []).length}`,
|
|
html`<ak-label type="info" ?good=${item.isSuperuser}></ak-label>`,
|
|
html`<ak-forms-modal>
|
|
<span slot="submit"> ${msg("Update")} </span>
|
|
<span slot="header"> ${msg("Update Group")} </span>
|
|
<ak-group-form slot="form" .instancePk=${item.pk}> </ak-group-form>
|
|
<button slot="trigger" class="pf-c-button pf-m-plain">
|
|
<pf-tooltip position="top" content=${msg("Edit")}>
|
|
<i class="fas fa-edit"></i>
|
|
</pf-tooltip>
|
|
</button>
|
|
</ak-forms-modal>`,
|
|
];
|
|
}
|
|
|
|
renderObjectCreate(): TemplateResult {
|
|
return html`
|
|
<ak-forms-modal>
|
|
<span slot="submit"> ${msg("Create")} </span>
|
|
<span slot="header"> ${msg("Create Group")} </span>
|
|
<ak-group-form slot="form"> </ak-group-form>
|
|
<button slot="trigger" class="pf-c-button pf-m-primary">${msg("Create")}</button>
|
|
</ak-forms-modal>
|
|
`;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"ak-group-list": GroupListPage;
|
|
}
|
|
}
|