fix(aihr): isolate mobile home from system users

This commit is contained in:
2026-07-14 10:35:01 +08:00
parent 96b7653051
commit cc93bc3b50
4 changed files with 9 additions and 3 deletions
@@ -68,9 +68,12 @@ public class AihrMobileController {
}
LoginUser loginUser = LoginHelper.getLoginUser();
String identity = currentAppUsername();
if (loginUser != null
&& UserType.APP_USER.getUserType().equals(loginUser.getUserType())
&& supervisorRoleRequested(role)) {
if (loginUser == null
|| !UserType.APP_USER.getUserType().equals(loginUser.getUserType())
|| identity.isBlank()) {
return R.ok(mobileSeedService.publicHome(role));
}
if (supervisorRoleRequested(role)) {
mobileSeedService.requireSupervisorIdentity(identity);
}
return R.ok(mobileSeedService.home(role, identity));
@@ -415,6 +415,7 @@ public class AihrPracticeSeedServiceTest {
assertTrue(controllerSource.contains("@SaIgnore\n @GetMapping(\"/home/{role}\")"));
assertTrue(controllerSource.contains("if (!LoginHelper.isLogin())"));
assertTrue(controllerSource.contains("return R.ok(mobileSeedService.publicHome(role))"));
assertTrue(controllerSource.contains("!UserType.APP_USER.getUserType().equals(loginUser.getUserType())"));
assertTrue(controllerSource.contains("return R.ok(mobileSeedService.home(role, identity))"));
assertTrue(controllerSource.contains("mobileSeedService.requireSupervisorIdentity(identity)"));
assertTrue(controllerSource.contains("private static boolean supervisorRoleRequested(String role)"));