core: fix judger login if builtin login disabled#1155
core: fix judger login if builtin login disabled#1155undefined-moe merged 2 commits intohydro-dev:masterfrom
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR adds a judge-specific login flow: the Hydro client now includes judge: 'on' in the login POST payload, and UserLoginHandler.post gains an optional judge boolean. The handler enforces that non-judge logins require server.login; judge logins are allowed if server.login is enabled or the target user exists and has PRIV_JUDGE. Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/hydrooj/src/handler/user.ts`:
- Around line 65-69: The privilege check currently runs before verifying
existence, causing BuiltinLoginError to mask missing users; change the order in
the login flow around user.getByEmail/user.getByUname so you first ensure udoc
exists (throw UserNotFoundError(uname) if null) and only then check the judger +
system.get('server.login') gate and call udoc.hasPriv(PRIV.PRIV_JUDGE) to decide
whether to throw BuiltinLoginError; update the logic in the function containing
the judger variable and these calls to make the existence check precede the
privilege check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7dc06655-e6d9-4a43-8924-8fbdf0075470
📒 Files selected for processing (2)
packages/hydrojudge/src/hosts/hydro.tspackages/hydrooj/src/handler/user.ts
Summary by CodeRabbit