xuang7 opened a new pull request, #7280: URL: https://github.com/apache/texera/pull/7280
### What changes were proposed in this PR? This PR links dataset contributors to user accounts by email, so a contributor can later own their contributions with a real account. Follow-up to #6952 (backend) and #6953 (frontend). Changes: - Saving a contributor with an email resolves it to a user account (case-insensitive). If no account matches, an `INACTIVE` placeholder account with `is_placeholder = true` and no credentials is created, and the contributor row stores the resolved `uid`. Re-saving reuses the same placeholder. - The first registration (local or Google) with a placeholder's email claims the account: credentials are set, `is_placeholder` is cleared, and the `uid` is kept so contributor links stay valid. Claimed accounts stay `INACTIVE` until an admin approves them; accounts that already have credentials are never claimable. - All four access resources (workflow, dataset, project, computing unit) reject granting access to placeholder accounts. - The admin user list reports `isPlaceholder` (the badge shipped in #6953). - Contributor emails are format-checked, and two contributors of one dataset cannot share an email (case-insensitive), backed by a partial unique index. - The duplicate-registration check in `register` is now case-insensitive, matching how emails are used as identity elsewhere in this PR. - Migration: adds `user.is_placeholder` (relaxing `ck_nulltest`), adds `dataset_contributor.uid` (FK, `ON DELETE SET NULL`), creates the two indexes, removes pre-existing duplicate contributor emails (keeping the oldest row), and backfills `uid` for contributors whose email matches a registered user. - Adds a shared `EmailUtil` (format check + normalization) used by both amber and file-service. Design notes: - Contributor email stays optional, so there is no stable per-row key; contributor updates remain whole-list replace (consistent with #6952). - Stored emails keep their original casing; identity matching uses `lower(email)`. Normalizing emails at rest, and consolidating the two older email validators (`GmailResource`, `WorkflowEmailNotifier`) onto `EmailUtil`, are left as follow-ups. ### Any related issues, documentation, discussions? Closes #6976 Related to #6926 ### How was this PR tested? 11 new ScalaTest cases covering linking (existing user, placeholder creation and reuse, no-email, invalid/duplicate email) and claiming (uid preserved, INACTIVE kept, login after claim, credentialed accounts not claimable, taken username rejected, case-variant duplicate registration rejected). The 14 pre-existing AuthResource tests still pass. Fresh-DDL and migrated schemas verified identical via pg_dump diff. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Fable 5) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
