fix(gateway): let the public QR registration reach its backend calls

A visitor has no user token, so the gateway refused every call the public
page makes. Open only the exact method and path pairs it needs, and replace
the full user lookup with a yes/no activeAdminOf endpoint so no user record
is exposed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-01 12:37:51 +08:00
1 parent 1a7c542f5e
commit eff4899c0d
8 files changed
+329 -10

No files matched your search

@@ -225,6 +225,14 @@ public class UserController {
return user.isPresent() ? user.get() : null;
}
/** True only for an enabled admin of that company; open to the public registration page, so it exposes nothing else of the user. */
@GetMapping("/{id}/activeAdminOf/{companyId}")
public boolean activeAdminOf(@PathVariable("id") Long id, @PathVariable("companyId") Long companyId) {
return userService.findById(id)
.filter(u -> u.getType() == UserType.A && u.isEnabled() && companyId.equals(u.getCompanyId()))
.isPresent();
}
@RequestMapping("/findByEmail/{email}")
public User findByEmail(@PathVariable("email") String email) {
User user = userService.findByEmail(email);