Identity core
Provider-neutral identity storage and user management for Haneinfo plugins.
Reader picker identity search
IdentityStoreService implements optional IdentityStorePort.searchActiveByName. Active/name/excluded-user/keyset predicates and the 20-row cap run in PostgreSQL; only id and nullable name are selected. A caller transaction may be supplied. The method grants no instance access and exposes no new public user-search endpoint: collaboration performs the authorization. Upgrade identity-core together with collaboration for mention discovery.
Batched active display names
Identity-store optionally implements findActiveNamesByIds(ids, transaction?), returning only { id, name } for active matching users in one projected query, deduplicating ids and skipping empty input. Unknown, deleted and inactive users are omitted. Consumers use null for omitted names and for older providers without this optional method; they must authorize their objects before lookup and must not fall back to per-row findById calls. This adds no general-user HTTP endpoint or schema field.
Authenticated name lookup
GET /identity/users/lookup?q= uses InteractiveAuthGuard without AdminGuard. It trims q and requires 2–200 characters, otherwise INVALID_INPUT/400. It returns an array of at most twenty active users, each exactly { id, name }, with nullable name, ordered by name then id. Percent, underscore and backslash are literal search characters. There is no email/role disclosure, cursor or bulk export, and no new MCP tool. The existing identity-store keyset search keeps its id ordering; only this controller requests the concrete implementation's optional name sorting.
Email matching preflight
Before enabling this version, run psql -X -v ON_ERROR_STOP=1 -f node_modules/@haneinfo/identity-core/scripts/check-email-duplicates.sql against the target database with a read-only account. Configure the connection with standard PostgreSQL client settings. The SELECT prints existing case-insensitive duplicate emails to standard output; it does not write files, merge accounts, or modify data. Resolve duplicates manually before enabling authentication. Protect the output as personal data and do not redirect it to logs or files.
New users are stored with lowercase email. Lookup ignores case and rejects ambiguous matches, including during import. Existing rows are not rewritten. The existing case-sensitive unique constraint cannot prevent an external writer from concurrently inserting mixed-case duplicates; all writers must follow this policy and operators should repeat the preflight as needed.
Default roles and CSV roles column
Behavior change: Creating a user without explicit roleIds (manual UsersService.create, OIDC JIT via IdentityStoreService.create, and CSV import with an empty roles cell) no longer assigns USER (SYSTEM_USER_ROLE) by default. Apps that want default roles must declare defaultRoleNames in @haneinfo/rbac (configRef: "rbac"); to keep the previous behavior, set defaultRoleNames: ["USER"].
CSV import (UsersImportService) supports an optional roles column (aliases: role, roles, 角色), with multiple role machine names separated by ;. When creating a new user:
- Non-empty values are validated via
RbacPolicyPort.resolveImportRoleIds(failing closed withROLES_UNSUPPORTEDif missing, orROLE_NOT_ASSIGNABLEif any role isADMINor unknown). - Empty cells fall back to the App's declared
defaultRoleIds(). - For existing users (
bindorskip), roles are never modified and non-empty cells are flagged withROLES_IGNORED_FOR_EXISTING_USER.