Skip to content

Register Auth Patch, this allows anyone to register with a POST request on a third-party API client (v0.1.11)#15

Merged
hpware merged 8 commits intomasterfrom
canery
Dec 11, 2025
Merged

Register Auth Patch, this allows anyone to register with a POST request on a third-party API client (v0.1.11)#15
hpware merged 8 commits intomasterfrom
canery

Conversation

@hpware
Copy link
Owner

@hpware hpware commented Dec 11, 2025

Summary by CodeRabbit

  • New Features
    • Added registration control that can restrict new user registrations and ensure non-admin role assignment when registration is disabled.

✏️ Tip: You can customize this high-level summary in your review settings.

@dokploy-hpwartwweb2
Copy link

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
app 🔄 Building Preview URL 2025-12-11T16:26:43.103Z

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

A pre-create guard is introduced in the user creation flow that queries a key-value store for a "registrationStatus" flag. If disabled, registration is blocked and new users default to "user" role instead of "admin", while maintaining existing admin logic for the first user unless registration is explicitly disabled.

Changes

Cohort / File(s) Summary
Registration Status Guard
packages/auth/src/index.ts
Adds imports of dorm and main_schema from @devlogs_hosting/db. Introduces a pre-create guard that queries main_schema.kvData for "registrationStatus"; if false, throws an error caught by existing try-catch to default role to "user". Preserves existing admin role logic for first user when registration is enabled.

Sequence Diagram

sequenceDiagram
    participant User
    participant AuthService as Auth Service<br/>(packages/auth)
    participant KvStore as main_schema.kvData
    
    User->>AuthService: Create User Request
    AuthService->>KvStore: Query "registrationStatus"
    KvStore-->>AuthService: Return Status Value
    
    alt Registration Disabled (status = false)
        AuthService->>AuthService: Throw Error
        AuthService-->>User: Reject, Assign Role "user"
    else Registration Enabled
        AuthService->>AuthService: Check Existing Users
        alt First User
            AuthService->>AuthService: Assign Role "admin"
        else Existing User
            AuthService->>AuthService: Assign Role "user"
        end
        AuthService-->>User: User Created
    end
Loading

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review the kvData query structure and error handling behavior
  • Verify the try-catch flow correctly defaults role to "user" without masking unrelated errors
  • Confirm the registration status check integrates cleanly with existing admin/user role assignment logic

Poem

🐰 A gate now guards the sign-up door,
Where kvData whispers "yes" or "no more!"
First users still rise as admin bright,
But registration's switch controls who's right.
The role cascade flows more secure,
As disabled registrations now are sure! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch canery

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1424dcc and 529b2ff.

📒 Files selected for processing (1)
  • packages/auth/src/index.ts (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hpware hpware changed the title Canery v0.1.11 Dec 11, 2025
@hpware hpware changed the title v0.1.11 Register Auth Patch, this allows anyone to register with a POST request on a third-party API client (v0.1.11) Dec 11, 2025
@hpware
Copy link
Owner Author

hpware commented Dec 11, 2025

#16

@hpware hpware merged commit dbd95d7 into master Dec 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant