aglinxinyuan opened a new pull request, #9498:
URL: https://github.com/apache/texera/pull/9498

   ### What changes were proposed in this PR?
   
   `USER_SYS_INVITE_ONLY` now decides the role a new account starts with, and 
admins can switch it on Admin → Settings without a restart.
   
   | A new account, while invite-only is | Before | After |
   | --- | --- | --- |
   | off | INACTIVE; stays on the sign-up page, told to contact an 
administrator; every dashboard request refused | REGULAR; opens the dashboard |
   | on | INACTIVE; pending-approval screen | unchanged |
   
   - **Sign-up roles.** These sign-ups start REGULAR while invite-only is off, 
and INACTIVE while it is on:
     - local sign-up, with or without email verification;
     - the first Google or Apple sign-in;
     - a sign-up that claims a dataset-contributor placeholder.
   
     An account from a provider that asserts no email (ORCID) stays INACTIVE 
until it supplies one, and then gets the same role. Staying INACTIVE until then 
is also what lets that step adopt a placeholder. Accounts already waiting for 
approval, and roles an admin set, are never changed.
   - **An admin setting.** Invite-only is now the `invite_only` site setting, 
read on every sign-up. Admin → Settings has a Registration card with an Invite 
Only switch. `USER_SYS_INVITE_ONLY`, now declared in `default.conf`, sets its 
value the first time config-service starts, like the page's other settings, and 
Reset restores it. `/config/pre-login` and `/config/user-system` report the 
stored value. Each sign-up reads the setting before it opens its transaction, 
so a burst of sign-ups cannot have each one hold a pooled connection while it 
waits for a second.
   - **On by default.** A REGULAR account can run code on the server, so 
opening sign-up has to be a deployment's explicit choice. A deployment that 
never set the variable keeps its new accounts INACTIVE, as before, and now 
shows them the pending-approval screen. The admin card shows anything but an 
explicit `false` as on, because Save writes whatever the switch shows.
   - **Sign-up page.** When the new account is usable, the page says so and 
opens the dashboard. The "contact the administrator" hint and message appear 
only while invite-only is on, or while the account is still INACTIVE.
   
   ### Any related issues, documentation, discussions?
   
   Closes #9497.
   
   ### How was this PR tested?
   
   Unit tests, all passing:
   
   ```
   sbt "DAO/testOnly org.apache.texera.dao.SiteSettingsSpec" "Config/test" 
"Auth/testOnly org.apache.texera.auth.InviteOnlySpec" "ConfigService/test" 
"WorkflowExecutionService/testOnly org.apache.texera.web.resource.auth.*"
   cd frontend && ng test --watch=false 
--include=src/app/dashboard/component/admin/settings/admin-settings.component.spec.ts
 --include=src/app/hub/component/login/texera-login.component.spec.ts
   ```
   
   That is 14 SiteSettings, 102 Config, 4 InviteOnly, 45 ConfigService and 141 
amber auth cases, plus 62 admin-settings and 64 login cases. The new cases run 
with invite-only both on and off. They cover local sign-up, register/verify, 
Google and Apple, placeholder claims, the add-email step and placeholder 
adoption, and a switch reaching the very next registration. They check that 
pending accounts and admin-set roles are left alone, that the setting falls 
back when its row is missing or unreadable, and that a fresh deployment seeds 
it on. They also cover the admin card's load, save, reset and its guard against 
saving before the load, and the sign-up page's outcomes and hint.
   
   Lint: `scalafmtCheckAll` and `scalafixAll --check` on DAO, Config, Auth, 
ConfigService and WorkflowExecutionService; `prettier-eslint --list-different` 
and `eslint` on the changed frontend files.
   
   Manual check: config-service and the web server ran against a fresh 
database, with `USER_SYS_INVITE_ONLY` unset.
   1. `invite_only` was seeded `true`, and a sign-up came out INACTIVE with the 
Request access dialog.
   2. After turning the switch off on Admin → Settings, with no restart, the 
next sign-up was REGULAR and opened the dashboard.
   3. After turning it back on, the next sign-up was INACTIVE again.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to