mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-04 12:46:45 +00:00
feat: add "restricted" column to oidc client table
This commit is contained in:
@@ -58,7 +58,7 @@ type OidcClient struct {
|
|||||||
RequiresReauthentication bool `sortable:"true" filterable:"true"`
|
RequiresReauthentication bool `sortable:"true" filterable:"true"`
|
||||||
Credentials OidcClientCredentials
|
Credentials OidcClientCredentials
|
||||||
LaunchURL *string
|
LaunchURL *string
|
||||||
IsGroupRestricted bool
|
IsGroupRestricted bool `sortable:"true" filterable:"true"`
|
||||||
|
|
||||||
AllowedUserGroups []UserGroup `gorm:"many2many:oidc_clients_allowed_user_groups;"`
|
AllowedUserGroups []UserGroup `gorm:"many2many:oidc_clients_allowed_user_groups;"`
|
||||||
CreatedByID *string
|
CreatedByID *string
|
||||||
|
|||||||
@@ -480,5 +480,8 @@
|
|||||||
"allowed_oidc_clients_description": "Select the OIDC clients that members of this user group are allowed to sign in to.",
|
"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}",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@
|
|||||||
{:else if column.cell}
|
{:else if column.cell}
|
||||||
{@render column.cell({ item })}
|
{@render column.cell({ item })}
|
||||||
{:else if column.column && typeof item[column.column] === 'boolean'}
|
{: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}
|
{:else if column.column}
|
||||||
{item[column.column]}
|
{item[column.column]}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
const isLightMode = $derived(mode.current === 'light');
|
const isLightMode = $derived(mode.current === 'light');
|
||||||
|
|
||||||
const booleanFilterValues = [
|
const booleanFilterValues = [
|
||||||
{ label: m.enabled(), value: true },
|
{ label: m.yes(), value: true },
|
||||||
{ label: m.disabled(), value: false }
|
{ label: m.no(), value: false }
|
||||||
];
|
];
|
||||||
|
|
||||||
const columns: AdvancedTableColumn<OidcClientWithAllowedUserGroupsCount>[] = [
|
const columns: AdvancedTableColumn<OidcClientWithAllowedUserGroupsCount>[] = [
|
||||||
@@ -38,8 +38,13 @@
|
|||||||
label: m.oidc_allowed_group_count(),
|
label: m.oidc_allowed_group_count(),
|
||||||
column: 'allowedUserGroupsCount',
|
column: 'allowedUserGroupsCount',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
value: (item) =>
|
value: (item) => (item.isGroupRestricted ? item.allowedUserGroupsCount : '-')
|
||||||
item.allowedUserGroupsCount > 0 ? item.allowedUserGroupsCount : m.unrestricted()
|
},
|
||||||
|
{
|
||||||
|
label: m.restricted(),
|
||||||
|
column: 'isGroupRestricted',
|
||||||
|
sortable: true,
|
||||||
|
filterableValues: booleanFilterValues
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: m.pkce(),
|
label: m.pkce(),
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
allowedOidcClientIds: data.userGroup.allowedOidcClients.map((c) => c.id)
|
allowedOidcClientIds: data.userGroup.allowedOidcClients.map((c) => c.id)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let oidcClientSelectionRef: OidcClientSelection;
|
||||||
|
|
||||||
const userGroupService = new UserGroupService();
|
const userGroupService = new UserGroupService();
|
||||||
const customClaimService = new CustomClaimService();
|
const customClaimService = new CustomClaimService();
|
||||||
const backNavigation = backNavigate('/settings/admin/user-groups');
|
const backNavigation = backNavigate('/settings/admin/user-groups');
|
||||||
@@ -64,6 +66,7 @@
|
|||||||
.updateAllowedOidcClients(userGroup.id, allowedClients)
|
.updateAllowedOidcClients(userGroup.id, allowedClients)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast.success(m.allowed_oidc_clients_updated_successfully());
|
toast.success(m.allowed_oidc_clients_updated_successfully());
|
||||||
|
oidcClientSelectionRef.refresh();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
axiosErrorToast(e);
|
axiosErrorToast(e);
|
||||||
@@ -129,7 +132,10 @@
|
|||||||
title={m.allowed_oidc_clients()}
|
title={m.allowed_oidc_clients()}
|
||||||
description={m.allowed_oidc_clients_description()}
|
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">
|
<div class="mt-5 flex justify-end gap-3">
|
||||||
<Button onclick={() => updateAllowedOidcClients(userGroup.allowedOidcClientIds)}
|
<Button onclick={() => updateAllowedOidcClients(userGroup.allowedOidcClientIds)}
|
||||||
>{m.save()}</Button
|
>{m.save()}</Button
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import OidcService from '$lib/services/oidc-service';
|
import OidcService from '$lib/services/oidc-service';
|
||||||
import type { AdvancedTableColumn } from '$lib/types/advanced-table.type';
|
import type { AdvancedTableColumn } from '$lib/types/advanced-table.type';
|
||||||
import type { ListRequestOptions } from '$lib/types/list-request.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 { cachedOidcClientLogo } from '$lib/utils/cached-image-util';
|
||||||
import { mode } from 'mode-watcher';
|
import { mode } from 'mode-watcher';
|
||||||
|
|
||||||
@@ -17,12 +17,30 @@
|
|||||||
|
|
||||||
const oidcClientService = new OidcService();
|
const oidcClientService = new OidcService();
|
||||||
|
|
||||||
|
let tableRef: AdvancedTable<OidcClientWithAllowedUserGroupsCount>;
|
||||||
|
|
||||||
|
export function refresh() {
|
||||||
|
return tableRef?.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
const isLightMode = $derived(mode.current === 'light');
|
const isLightMode = $derived(mode.current === 'light');
|
||||||
|
|
||||||
const columns: AdvancedTableColumn<OidcClient>[] = [
|
const columns: AdvancedTableColumn<OidcClientWithAllowedUserGroupsCount>[] = [
|
||||||
{ label: 'ID', column: 'id', hidden: true },
|
{ label: 'ID', column: 'id', hidden: true },
|
||||||
{ label: m.logo(), key: 'logo', cell: LogoCell },
|
{ label: m.logo(), key: 'logo', cell: LogoCell },
|
||||||
{ label: m.name(), column: 'name', sortable: true },
|
{ 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(),
|
label: m.client_launch_url(),
|
||||||
column: 'launchURL',
|
column: 'launchURL',
|
||||||
@@ -60,6 +78,7 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
<AdvancedTable
|
<AdvancedTable
|
||||||
|
bind:this={tableRef}
|
||||||
id="oidc-client-selection"
|
id="oidc-client-selection"
|
||||||
{fetchCallback}
|
{fetchCallback}
|
||||||
defaultSort={{ column: 'name', direction: 'asc' }}
|
defaultSort={{ column: 'name', direction: 'asc' }}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
column: 'disabled',
|
column: 'disabled',
|
||||||
cell: StatusCell,
|
cell: StatusCell,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
value: (item) => (item.disabled ? m.disabled() : m.enabled()),
|
||||||
filterableValues: [
|
filterableValues: [
|
||||||
{
|
{
|
||||||
label: m.enabled(),
|
label: m.enabled(),
|
||||||
|
|||||||
@@ -119,6 +119,7 @@
|
|||||||
column: 'disabled',
|
column: 'disabled',
|
||||||
cell: StatusCell,
|
cell: StatusCell,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
value: (item) => (item.disabled ? m.disabled() : m.enabled()),
|
||||||
filterableValues: [
|
filterableValues: [
|
||||||
{
|
{
|
||||||
label: m.enabled(),
|
label: m.enabled(),
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<LogsIcon class="text-primary/80 size-5" />
|
<LogsIcon class="text-primary/80 size-5" />
|
||||||
{m.audit_log()}
|
{m.audit_log()}
|
||||||
</Card.Title>
|
</Card.Title>
|
||||||
<Card.Description>{m.see_your_account_activities_from_the_last_3_months()}</Card.Description>
|
<Card.Description>{m.see_your_recent_account_activities()}</Card.Description>
|
||||||
</Card.Header>
|
</Card.Header>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<AuditLogList />
|
<AuditLogList />
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<Card.Header>
|
<Card.Header>
|
||||||
<Card.Title>{m.global_audit_log()}</Card.Title>
|
<Card.Title>{m.global_audit_log()}</Card.Title>
|
||||||
<Card.Description class="mt-1"
|
<Card.Description class="mt-1"
|
||||||
>{m.see_all_account_activities_from_the_last_3_months()}</Card.Description
|
>{m.see_all_recent_account_activities()}</Card.Description
|
||||||
>
|
>
|
||||||
</Card.Header>
|
</Card.Header>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
|
|||||||
Reference in New Issue
Block a user