web/admin: only show non-backchannel providers in application provider select (#9658)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -63,8 +63,12 @@ class ProviderFilter(FilterSet):
|
|||||||
"""Filter for providers"""
|
"""Filter for providers"""
|
||||||
|
|
||||||
application__isnull = BooleanFilter(method="filter_application__isnull")
|
application__isnull = BooleanFilter(method="filter_application__isnull")
|
||||||
backchannel_only = BooleanFilter(
|
backchannel = BooleanFilter(
|
||||||
method="filter_backchannel_only",
|
method="filter_backchannel",
|
||||||
|
label=_(
|
||||||
|
"When not set all providers are returned. When set to true, only backchannel "
|
||||||
|
"providers are returned. When set to false, backchannel providers are excluded"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def filter_application__isnull(self, queryset: QuerySet, name, value):
|
def filter_application__isnull(self, queryset: QuerySet, name, value):
|
||||||
@ -75,8 +79,9 @@ class ProviderFilter(FilterSet):
|
|||||||
| Q(application__isnull=value)
|
| Q(application__isnull=value)
|
||||||
)
|
)
|
||||||
|
|
||||||
def filter_backchannel_only(self, queryset: QuerySet, name, value):
|
def filter_backchannel(self, queryset: QuerySet, name, value):
|
||||||
"""Only return backchannel providers"""
|
"""By default all providers are returned. When set to true, only backchannel providers are
|
||||||
|
returned. When set to false, backchannel providers are excluded"""
|
||||||
return queryset.filter(is_backchannel=value)
|
return queryset.filter(is_backchannel=value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -15739,9 +15739,12 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
- in: query
|
- in: query
|
||||||
name: backchannel_only
|
name: backchannel
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
description: When not set all providers are returned. When set to true, only
|
||||||
|
backchannel providers are returned. When set to false, backchannel providers
|
||||||
|
are excluded
|
||||||
- name: ordering
|
- name: ordering
|
||||||
required: false
|
required: false
|
||||||
in: query
|
in: query
|
||||||
|
@ -18,7 +18,7 @@ export interface SummarizedSyncStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@customElement("ak-admin-status-chart-sync")
|
@customElement("ak-admin-status-chart-sync")
|
||||||
export class LDAPSyncStatusChart extends AKChart<SummarizedSyncStatus[]> {
|
export class SyncStatusChart extends AKChart<SummarizedSyncStatus[]> {
|
||||||
getChartType(): string {
|
getChartType(): string {
|
||||||
return "doughnut";
|
return "doughnut";
|
||||||
}
|
}
|
||||||
@ -102,6 +102,19 @@ export class LDAPSyncStatusChart extends AKChart<SummarizedSyncStatus[]> {
|
|||||||
},
|
},
|
||||||
msg("Google Workspace Provider"),
|
msg("Google Workspace Provider"),
|
||||||
),
|
),
|
||||||
|
await this.fetchStatus(
|
||||||
|
() => {
|
||||||
|
return new ProvidersApi(DEFAULT_CONFIG).providersMicrosoftEntraList();
|
||||||
|
},
|
||||||
|
(element) => {
|
||||||
|
return new ProvidersApi(
|
||||||
|
DEFAULT_CONFIG,
|
||||||
|
).providersMicrosoftEntraSyncStatusRetrieve({
|
||||||
|
id: element.pk,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
msg("Microsoft Entra Provider"),
|
||||||
|
),
|
||||||
await this.fetchStatus(
|
await this.fetchStatus(
|
||||||
() => {
|
() => {
|
||||||
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapList();
|
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapList();
|
||||||
|
@ -21,7 +21,7 @@ export class ProviderSelectModal extends TableModal<Provider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
backchannelOnly = false;
|
backchannel?: boolean;
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
confirm!: (selectedItems: Provider[]) => Promise<unknown>;
|
confirm!: (selectedItems: Provider[]) => Promise<unknown>;
|
||||||
@ -34,7 +34,7 @@ export class ProviderSelectModal extends TableModal<Provider> {
|
|||||||
page: page,
|
page: page,
|
||||||
pageSize: (await uiConfig()).pagination.perPage,
|
pageSize: (await uiConfig()).pagination.perPage,
|
||||||
search: this.search || "",
|
search: this.search || "",
|
||||||
backchannelOnly: this.backchannelOnly,
|
backchannel: this.backchannel,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ export class AkBackchannelProvidersInput extends AKElement {
|
|||||||
return html`
|
return html`
|
||||||
<ak-form-element-horizontal label=${this.label} name=${this.name}>
|
<ak-form-element-horizontal label=${this.label} name=${this.name}>
|
||||||
<div class="pf-c-input-group">
|
<div class="pf-c-input-group">
|
||||||
<ak-provider-select-table ?backchannelOnly=${true} .confirm=${this.confirm}>
|
<ak-provider-select-table ?backchannel=${true} .confirm=${this.confirm}>
|
||||||
<button slot="trigger" class="pf-c-button pf-m-control" type="button">
|
<button slot="trigger" class="pf-c-button pf-m-control" type="button">
|
||||||
${this.tooltip ? this.tooltip : nothing}
|
${this.tooltip ? this.tooltip : nothing}
|
||||||
<i class="fas fa-plus" aria-hidden="true"></i>
|
<i class="fas fa-plus" aria-hidden="true"></i>
|
||||||
|
@ -15,6 +15,7 @@ const doGroupBy = (items: Provider[]) => groupBy(items, (item) => item.verboseNa
|
|||||||
async function fetch(query?: string) {
|
async function fetch(query?: string) {
|
||||||
const args: ProvidersAllListRequest = {
|
const args: ProvidersAllListRequest = {
|
||||||
ordering: "name",
|
ordering: "name",
|
||||||
|
backchannel: false,
|
||||||
};
|
};
|
||||||
if (query !== undefined) {
|
if (query !== undefined) {
|
||||||
args.search = query;
|
args.search = query;
|
||||||
|
Reference in New Issue
Block a user