fix(aihr): isolate mobile home from system users
This commit is contained in:
+6
-3
@@ -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));
|
||||
|
||||
+1
@@ -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)"));
|
||||
|
||||
Reference in New Issue
Block a user