You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by gi...@apache.org on 2026/08/05 07:41:59 UTC

(texera) 01/01: chore(auth): use INACTIVE instead of RESTRICTED for local signup (#7309)

This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-7309-0f2cd49c39781d683f35e02547da45fbe5adc3c3
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 24a3194a9e0c9833b3633f3f6a690c325f6764be
Author: Martin Vu <12...@users.noreply.github.com>
AuthorDate: Wed Aug 5 00:41:38 2026 -0700

    chore(auth): use INACTIVE instead of RESTRICTED for local signup (#7309)
    
    ## What changes were proposed in this PR?
    
    This PR changes the default role assigned during local registration from
    RESTRICTED to INACTIVE. This aligns local registration with the other
    account creation paths and ensures newly registered users enter the
    pending approval state consistently.
    
    ## Any related issues, documentation, discussions?
    
    Closes #7185
    
    ## How was this PR tested?
    
    * Updated the existing unit test to expect the INACTIVE role for newly
    registered users.
    * Verified locally that a newly registered user is stored with the
    INACTIVE role in the database.
    
    <img width="425" height="23" alt="Screenshot 2026-08-04 at 12 09 41 AM"
    src="https://github.com/user-attachments/assets/20e6f013-7ca6-4089-b48c-d398bb4e5253"
    />
    
    * Verified that the issued JWT contains the INACTIVE role after login.
    
    ## Was this PR authored or co-authored using generative AI tooling?
    No
---
 .../main/scala/org/apache/texera/web/resource/auth/AuthResource.scala | 2 +-
 .../scala/org/apache/texera/web/resource/auth/AuthResourceSpec.scala  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/amber/src/main/scala/org/apache/texera/web/resource/auth/AuthResource.scala b/amber/src/main/scala/org/apache/texera/web/resource/auth/AuthResource.scala
index 4171ebbe23..db443aae8e 100644
--- a/amber/src/main/scala/org/apache/texera/web/resource/auth/AuthResource.scala
+++ b/amber/src/main/scala/org/apache/texera/web/resource/auth/AuthResource.scala
@@ -168,7 +168,7 @@ class AuthResource {
         val user = new User
         user.setName(username)
         user.setEmail(useremail)
-        user.setRole(UserRoleEnum.RESTRICTED)
+        user.setRole(UserRoleEnum.INACTIVE)
         // hash the plain text password
         user.setPassword(new StrongPasswordEncryptor().encryptPassword(userpassword))
         userDao.insert(user)
diff --git a/amber/src/test/scala/org/apache/texera/web/resource/auth/AuthResourceSpec.scala b/amber/src/test/scala/org/apache/texera/web/resource/auth/AuthResourceSpec.scala
index 51c167fe79..d91a1dc1af 100644
--- a/amber/src/test/scala/org/apache/texera/web/resource/auth/AuthResourceSpec.scala
+++ b/amber/src/test/scala/org/apache/texera/web/resource/auth/AuthResourceSpec.scala
@@ -131,14 +131,14 @@ class AuthResourceSpec
 
   // ─── register ─────────────────────────────────────────────────────────────
 
-  "register" should "persist a RESTRICTED user with a hashed password and issue a token" in {
+  "register" should "persist an INACTIVE user with a hashed password and issue a token" in {
     val response = resource.register(UserRegistrationRequest(uname("reg"), uemail("reg"), "pw"))
 
     subjectOf(response.accessToken) shouldBe uname("reg")
     val persisted = userDao.fetchByName(uname("reg"))
     persisted.size() shouldBe 1
     val stored = persisted.get(0)
-    stored.getRole shouldBe UserRoleEnum.RESTRICTED
+    stored.getRole shouldBe UserRoleEnum.INACTIVE
     stored.getEmail shouldBe uemail("reg")
     stored.getIsPlaceholder shouldBe false
     // stored hashed, not in plain text, but verifies against the plain password