Files
outline/server/utils/GroupSyncProvider.ts
Tom MoorandClaude Fable 5.1 abc47b442a feat: Sync group descriptions and re-sync groups on SSO validation (#13889)
* feat: Sync group descriptions and re-sync groups on SSO validation

- Sync group descriptions from group sync providers alongside names
- Lock name and description edits for externally synced groups at the
  API layer and in the edit dialog
- Move group sync into a SyncUserGroupsTask, scheduled from login and
  from ValidateSSOAccessTask after a fresh provider validation
- Add authenticationProviders.startGroupSync for providers that require
  an admin consent flow before group sync can be enabled

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix: Make group sync setup generic and deduplicate sync jobs

- Expose groupSyncRequiresSetup from the provider list and use it in the
  settings scene instead of checking for the azure provider name
- Rename the setup redirect query param to groupSync
- Give SyncUserGroupsTask a job id per user authentication so concurrent
  syncs for the same authentication are not queued twice

* Use existing hook

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 19:49:26 -04:00

52 lines
1.7 KiB
TypeScript

import type { AuthenticationProviderSettings } from "@shared/types";
import type { AuthenticationProvider, User } from "@server/models";
/**
* Represents a group reported by an external authentication provider.
*/
export interface ExternalGroupData {
/** Unique identifier for the group in the provider's system. */
id: string;
/** Display name of the group. */
name: string;
/**
* Description of the group, if the provider exposes one. `undefined` means
* the provider does not report descriptions and the internal value is left
* untouched, while `null` or an empty string clears it.
*/
description?: string | null;
}
/**
* Interface that authentication provider plugins implement to support
* group synchronization.
*/
export interface GroupSyncProvider {
/** Whether this provider requires a configurable group claim path. */
useGroupClaim: boolean;
/**
* Starts provider-specific group sync setup when administrator consent is required.
*
* @param authenticationProvider - the provider being configured.
* @param actor - the workspace administrator starting setup.
* @returns the URL where the administrator should complete setup.
*/
startGroupSync?(
authenticationProvider: AuthenticationProvider,
actor: User
): Promise<string>;
/**
* Fetch the groups that a user belongs to from the external provider.
*
* @param accessToken - the user's OAuth access token.
* @param settings - provider-specific settings from AuthenticationProvider.settings.
* @returns array of external groups the user is a member of.
*/
fetchUserGroups(
accessToken: string,
settings: AuthenticationProviderSettings
): Promise<ExternalGroupData[]>;
}