aglinxinyuan commented on code in PR #9498:
URL: https://github.com/apache/texera/pull/9498#discussion_r4596471401
##########
common/config/src/test/scala/org/apache/texera/common/config/DefaultsConfigSpec.scala:
##########
@@ -38,6 +38,19 @@ class DefaultsConfigSpec extends AnyFlatSpec with Matchers {
)
}
+ // A REGULAR account can run code on the server, so open sign-up has to be a
deployment's own
+ // choice rather than what it gets by leaving USER_SYS_INVITE_ONLY unset.
+ "DefaultsConfig.inviteOnly" should "default to invite-only" in {
+ ifUnset("USER_SYS_INVITE_ONLY")(DefaultsConfig.inviteOnly shouldBe true)
+ }
+
+ // HOCON also accepts yes/no and on/off, but every reader of the stored row
expects true or false:
+ // the backend reads anything else as on, and so does the admin card. Holds
whatever spelling
+ // USER_SYS_INVITE_ONLY uses; run with USER_SYS_INVITE_ONLY=off to exercise
it.
+ it should "seed the parsed value, not the variable's own spelling" in {
Review Comment:
Done: `allDefaults` is now `seedValues(conf)`, and your
`off`/`no`/`on`/`yes` table replaces this case (d72972d60f, 756f272d83). With
the variable unset it fails with `Some("off")` once the `.updated(...)` is
dropped, and passes as is. The `gui.tabs.*_enabled` spellings stay out of this
PR.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
common/dao/src/main/scala/org/apache/texera/dao/SiteSettings.scala:
##########
@@ -77,14 +95,5 @@ object SiteSettings {
raw.flatMap(s => Try(parse(s.trim)).toOption).getOrElse(default)
private def readAndParse[T](key: String, default: => T)(parse: String => T):
T =
- Try {
- val raw = SqlServer
- .getInstance()
- .createDSLContext()
- .select(SITE_SETTINGS.VALUE)
- .from(SITE_SETTINGS)
- .where(SITE_SETTINGS.KEY.eq(key))
- .fetchOneInto(classOf[String])
- parseOrDefault(Option(raw), default)(parse)
- }.getOrElse(default)
+ lookup(key).toOption.map(parseOrDefault(_,
default)(parse)).getOrElse(default)
Review Comment:
Done: `readAndParse` is now `parseOrDefault(lookup(key).toOption.flatten,
default)(parse)`, and the object doc says the getters fall back to the default
while `lookup` returns failures. A new `getInt` case pins the fallback on a
failed read (756f272d83).
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
config-service/src/main/scala/org/apache/texera/service/resource/ConfigResource.scala:
##########
@@ -72,7 +72,9 @@ class ConfigResource {
),
"attributionEnabled" -> GuiConfig.guiAttributionEnabled,
"deploymentVersionCheckEnabled" ->
GuiConfig.guiDeploymentVersionCheckEnabled,
- "inviteOnly" -> UserSystemConfig.inviteOnly,
+ // Read per request: admins switch it on the settings page, and the
login flow uses it to
+ // decide whether an INACTIVE sign-in sees the pending-approval screen.
Review Comment:
Done, with your wording (756f272d83).
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
config-service/src/main/scala/org/apache/texera/service/resource/ConfigResource.scala:
##########
@@ -122,8 +124,8 @@ class ConfigResource {
@Path("/user-system")
def getUserSystemConfig: Map[String, Any] =
Map(
- // flags from the user-system.conf
- "inviteOnly" -> UserSystemConfig.inviteOnly
+ // the admin-editable invite_only site setting
+ "inviteOnly" -> InviteOnly.enabled
Review Comment:
Done here rather than as a follow-up, since this PR is what left it unused:
`/config/user-system`, the frontend `UserSystemConfig` type and the third
`loadPostLogin` request are gone, and `PreLoginConfig` now lists `inviteOnly`.
The `GuiConfigService` spec checks that sign-in asks only for `/config/gui` and
`/config/amber` (756f272d83).
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
frontend/src/app/common/service/user/auth.service.ts:
##########
@@ -227,7 +227,10 @@ export class AuthService {
return undefined;
}
- if (this.config.env.inviteOnly && role === Role.INACTIVE) {
+ // INACTIVE means waiting for an admin, whatever the invite-only switch
says now: an account that
+ // signed up while it was on stays INACTIVE after it is turned off, and
every request it makes is
+ // refused, so it gets the pending screen rather than an empty dashboard.
+ if (role === Role.INACTIVE) {
Review Comment:
Leaving it as is: on an invite-only deployment a deactivated account already
got this flow before this PR, so this makes it the same everywhere, and the
pending screen suits a deactivated account better than a dashboard that refuses
every request.
_🤖 Addressed by [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]