mirror of
https://github.com/nikdoof/pocket-id.git
synced 2025-12-22 13:59:24 +00:00
feat: add LDAP sync (#106)
Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
requestOptions = $bindable(),
|
||||
selectedIds = $bindable(),
|
||||
withoutSearch = false,
|
||||
selectionDisabled = false,
|
||||
defaultSort,
|
||||
onRefresh,
|
||||
columns,
|
||||
@@ -26,6 +27,7 @@
|
||||
requestOptions?: SearchPaginationSortRequest;
|
||||
selectedIds?: string[];
|
||||
withoutSearch?: boolean;
|
||||
selectionDisabled?: boolean;
|
||||
defaultSort?: { column: string; direction: 'asc' | 'desc' };
|
||||
onRefresh: (requestOptions: SearchPaginationSortRequest) => Promise<Paginated<T>>;
|
||||
columns: { label: string; hidden?: boolean; sortColumn?: string }[];
|
||||
@@ -122,7 +124,11 @@
|
||||
<Table.Row>
|
||||
{#if selectedIds}
|
||||
<Table.Head class="w-12">
|
||||
<Checkbox checked={allChecked} onCheckedChange={(c) => onAllCheck(c as boolean)} />
|
||||
<Checkbox
|
||||
disabled={selectionDisabled}
|
||||
checked={allChecked}
|
||||
onCheckedChange={(c) => onAllCheck(c as boolean)}
|
||||
/>
|
||||
</Table.Head>
|
||||
{/if}
|
||||
{#each columns as column}
|
||||
@@ -160,6 +166,7 @@
|
||||
{#if selectedIds}
|
||||
<Table.Cell class="w-12">
|
||||
<Checkbox
|
||||
disabled={selectionDisabled}
|
||||
checked={selectedIds.includes(item.id)}
|
||||
onCheckedChange={(c) => onCheck(c as boolean, item.id)}
|
||||
/>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<div class="items-top mt-5 flex space-x-2">
|
||||
<div class="items-top flex space-x-2">
|
||||
<Checkbox
|
||||
{id}
|
||||
{disabled}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
input = $bindable(),
|
||||
label,
|
||||
description,
|
||||
placeholder,
|
||||
disabled = false,
|
||||
type = 'text',
|
||||
children,
|
||||
@@ -18,6 +19,7 @@
|
||||
input?: FormInput<string | boolean | number>;
|
||||
label?: string;
|
||||
description?: string;
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
type?: 'text' | 'password' | 'email' | 'number' | 'checkbox';
|
||||
onInput?: (e: FormInputEvent) => void;
|
||||
@@ -38,7 +40,7 @@
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{:else if input}
|
||||
<Input {id} {type} bind:value={input.value} {disabled} on:input={(e) => onInput?.(e)} />
|
||||
<Input {id} {placeholder} {type} bind:value={input.value} {disabled} on:input={(e) => onInput?.(e)} />
|
||||
{/if}
|
||||
{#if input?.error}
|
||||
<p class="mt-1 text-sm text-red-500">{input.error}</p>
|
||||
|
||||
@@ -57,6 +57,10 @@ export default class AppConfigService extends APIService {
|
||||
await this.api.post('/application-configuration/test-email');
|
||||
}
|
||||
|
||||
async syncLdap() {
|
||||
await this.api.post('/application-configuration/sync-ldap');
|
||||
}
|
||||
|
||||
async getVersionInformation() {
|
||||
const response = (
|
||||
await axios.get('https://api.github.com/repos/stonith404/pocket-id/releases/latest')
|
||||
|
||||
@@ -4,8 +4,10 @@ export type AppConfig = {
|
||||
};
|
||||
|
||||
export type AllAppConfig = AppConfig & {
|
||||
// General
|
||||
sessionDuration: number;
|
||||
emailsVerified: boolean;
|
||||
// Email
|
||||
emailEnabled: boolean;
|
||||
smtpHost: string;
|
||||
smtpPort: number;
|
||||
@@ -14,6 +16,21 @@ export type AllAppConfig = AppConfig & {
|
||||
smtpPassword: string;
|
||||
smtpTls: boolean;
|
||||
smtpSkipCertVerify: boolean;
|
||||
// LDAP
|
||||
ldapEnabled: boolean;
|
||||
ldapUrl: string;
|
||||
ldapBindDn: string;
|
||||
ldapBindPassword: string;
|
||||
ldapBase: string;
|
||||
ldapSkipCertVerify: boolean;
|
||||
ldapAttributeUserUniqueIdentifier: string;
|
||||
ldapAttributeUserUsername: string;
|
||||
ldapAttributeUserEmail: string;
|
||||
ldapAttributeUserFirstName: string;
|
||||
ldapAttributeUserLastName: string;
|
||||
ldapAttributeGroupUniqueIdentifier: string;
|
||||
ldapAttributeGroupName: string;
|
||||
ldapAttributeAdminGroup: string;
|
||||
};
|
||||
|
||||
export type AppConfigRawResponse = {
|
||||
|
||||
@@ -7,6 +7,7 @@ export type UserGroup = {
|
||||
name: string;
|
||||
createdAt: string;
|
||||
customClaims: CustomClaim[];
|
||||
ldapId?: string;
|
||||
};
|
||||
|
||||
export type UserGroupWithUsers = UserGroup & {
|
||||
@@ -17,4 +18,4 @@ export type UserGroupWithUserCount = UserGroup & {
|
||||
userCount: number;
|
||||
};
|
||||
|
||||
export type UserGroupCreate = Pick<UserGroup, 'friendlyName' | 'name'>;
|
||||
export type UserGroupCreate = Pick<UserGroup, 'friendlyName' | 'name' | 'ldapId'>;
|
||||
|
||||
@@ -8,6 +8,7 @@ export type User = {
|
||||
lastName: string;
|
||||
isAdmin: boolean;
|
||||
customClaims: CustomClaim[];
|
||||
ldapId?: string;
|
||||
};
|
||||
|
||||
export type UserCreate = Omit<User, 'id' | 'customClaims'>;
|
||||
export type UserCreate = Omit<User, 'id' | 'customClaims' | 'ldapId'>;
|
||||
|
||||
Reference in New Issue
Block a user