Merge branch 'main' into v2-main

This commit is contained in:
Elias Schneider
2025-12-24 14:29:42 +01:00
8 changed files with 45 additions and 10 deletions

View File

@@ -58,7 +58,7 @@ type OidcClient struct {
RequiresReauthentication bool `sortable:"true" filterable:"true"`
Credentials OidcClientCredentials
LaunchURL *string
IsGroupRestricted bool
IsGroupRestricted bool `sortable:"true" filterable:"true"`
AllowedUserGroups []UserGroup `gorm:"many2many:oidc_clients_allowed_user_groups;"`
CreatedByID *string

View File

@@ -480,5 +480,8 @@
"allowed_oidc_clients_description": "Select the OIDC clients that members of this user group are allowed to sign in to.",
"unrestrict_oidc_client": "Unrestrict {clientName}",
"confirm_unrestrict_oidc_client_description": "Are you sure you want to unrestrict the OIDC client <b>{clientName}</b>? This will remove all group assignments for this client and any user will be able to sign in.",
"allowed_oidc_clients_updated_successfully": "Allowed OIDC clients updated successfully"
"allowed_oidc_clients_updated_successfully": "Allowed OIDC clients updated successfully",
"yes": "Yes",
"no": "No",
"restricted": "Restricted"
}

View File

@@ -281,7 +281,7 @@
{:else if column.cell}
{@render column.cell({ item })}
{:else if column.column && typeof item[column.column] === 'boolean'}
{item[column.column] ? m.enabled() : m.disabled()}
{item[column.column] ? m.yes() : m.no()}
{:else if column.column}
{item[column.column]}
{/if}

View File

@@ -26,8 +26,8 @@
const isLightMode = $derived(mode.current === 'light');
const booleanFilterValues = [
{ label: m.enabled(), value: true },
{ label: m.disabled(), value: false }
{ label: m.yes(), value: true },
{ label: m.no(), value: false }
];
const columns: AdvancedTableColumn<OidcClientWithAllowedUserGroupsCount>[] = [
@@ -38,8 +38,13 @@
label: m.oidc_allowed_group_count(),
column: 'allowedUserGroupsCount',
sortable: true,
value: (item) =>
item.allowedUserGroupsCount > 0 ? item.allowedUserGroupsCount : m.unrestricted()
value: (item) => (item.isGroupRestricted ? item.allowedUserGroupsCount : '-')
},
{
label: m.restricted(),
column: 'isGroupRestricted',
sortable: true,
filterableValues: booleanFilterValues
},
{
label: m.pkce(),

View File

@@ -24,6 +24,8 @@
allowedOidcClientIds: data.userGroup.allowedOidcClients.map((c) => c.id)
});
let oidcClientSelectionRef: OidcClientSelection;
const userGroupService = new UserGroupService();
const customClaimService = new CustomClaimService();
const backNavigation = backNavigate('/settings/admin/user-groups');
@@ -64,6 +66,7 @@
.updateAllowedOidcClients(userGroup.id, allowedClients)
.then(() => {
toast.success(m.allowed_oidc_clients_updated_successfully());
oidcClientSelectionRef.refresh();
})
.catch((e) => {
axiosErrorToast(e);
@@ -129,7 +132,10 @@
title={m.allowed_oidc_clients()}
description={m.allowed_oidc_clients_description()}
>
<OidcClientSelection bind:selectedGroupIds={userGroup.allowedOidcClientIds} />
<OidcClientSelection
bind:this={oidcClientSelectionRef}
bind:selectedGroupIds={userGroup.allowedOidcClientIds}
/>
<div class="mt-5 flex justify-end gap-3">
<Button onclick={() => updateAllowedOidcClients(userGroup.allowedOidcClientIds)}
>{m.save()}</Button

View File

@@ -5,7 +5,7 @@
import OidcService from '$lib/services/oidc-service';
import type { AdvancedTableColumn } from '$lib/types/advanced-table.type';
import type { ListRequestOptions } from '$lib/types/list-request.type';
import type { OidcClient } from '$lib/types/oidc.type';
import type { OidcClient, OidcClientWithAllowedUserGroupsCount } from '$lib/types/oidc.type';
import { cachedOidcClientLogo } from '$lib/utils/cached-image-util';
import { mode } from 'mode-watcher';
@@ -17,12 +17,30 @@
const oidcClientService = new OidcService();
let tableRef: AdvancedTable<OidcClientWithAllowedUserGroupsCount>;
export function refresh() {
return tableRef?.refresh();
}
const isLightMode = $derived(mode.current === 'light');
const columns: AdvancedTableColumn<OidcClient>[] = [
const columns: AdvancedTableColumn<OidcClientWithAllowedUserGroupsCount>[] = [
{ label: 'ID', column: 'id', hidden: true },
{ label: m.logo(), key: 'logo', cell: LogoCell },
{ label: m.name(), column: 'name', sortable: true },
{
label: m.oidc_allowed_group_count(),
column: 'allowedUserGroupsCount',
sortable: true,
value: (item) => (item.isGroupRestricted ? item.allowedUserGroupsCount : '-')
},
{
label: m.restricted(),
column: 'isGroupRestricted',
sortable: true
},
{
label: m.client_launch_url(),
column: 'launchURL',
@@ -60,6 +78,7 @@
{/snippet}
<AdvancedTable
bind:this={tableRef}
id="oidc-client-selection"
{fetchCallback}
defaultSort={{ column: 'name', direction: 'asc' }}

View File

@@ -42,6 +42,7 @@
column: 'disabled',
cell: StatusCell,
sortable: true,
value: (item) => (item.disabled ? m.disabled() : m.enabled()),
filterableValues: [
{
label: m.enabled(),

View File

@@ -119,6 +119,7 @@
column: 'disabled',
cell: StatusCell,
sortable: true,
value: (item) => (item.disabled ? m.disabled() : m.enabled()),
filterableValues: [
{
label: m.enabled(),