feat: company-scoped users and login security, super-admin-only roles, interests and settings

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-11-30 20:29:34 +08:00
1 parent 00ce47bc49
commit de2ae63cea
20 files changed
+795 -82

No files matched your search

@@ -43,7 +43,7 @@ class AdminLoginSecurityControllerTest {
@Test
void audit_passesFiltersAndPaging() throws Exception {
when(security.audit("sales1", "LOCKED", "2026-11-01", "2026-11-30", 1, 5))
when(security.audit("sales1", "LOCKED", "2026-11-01", "2026-11-30", 1, 5, null))
.thenReturn(Map.of("content", List.of(Map.of("id", 7)), "totalElements", 6));
mvc.perform(get("/api/admin/login-security/audit").param("username", "sales1").param("event", "LOCKED")
.param("from", "2026-11-01").param("to", "2026-11-30").param("page", "1").param("size", "5"))
@@ -53,21 +53,21 @@ class AdminLoginSecurityControllerTest {
@Test
void audit_defaultsToFirstPageOfTwenty() throws Exception {
when(security.audit(null, null, null, null, 0, 20)).thenReturn(Map.of("content", List.of()));
when(security.audit(null, null, null, null, 0, 20, null)).thenReturn(Map.of("content", List.of()));
mvc.perform(get("/api/admin/login-security/audit")).andExpect(status().isOk());
verify(security).audit(null, null, null, null, 0, 20);
verify(security).audit(null, null, null, null, 0, 20, null);
}
@Test
void locked_returnsList() throws Exception {
when(security.locked()).thenReturn(List.of(Map.of("username", "sales1", "failures", 5)));
when(security.locked(null)).thenReturn(List.of(Map.of("username", "sales1", "failures", 5)));
mvc.perform(get("/api/admin/login-security/locked")).andExpect(status().isOk()).andExpect(jsonPath("$[0].username").value("sales1"));
}
@Test
void unlock_returns204() throws Exception {
mvc.perform(post("/api/admin/login-security/locked/sales1/unlock")).andExpect(status().isNoContent());
verify(security).unlock("sales1");
verify(security).unlock("sales1", null);
}
@Test
@@ -46,7 +46,7 @@ class AdminUserControllerTest {
@Test
void list_passesParamsAndReturnsPageShape() throws Exception {
when(users.list("ali", "true", 1, 5, "name", "desc"))
when(users.list("ali", "true", 1, 5, "name", "desc", null))
.thenReturn(Map.of("content", List.of(Map.of("id", 1)), "totalElements", 6L));
mvc.perform(get("/api/admin/users").param("q", "ali").param("enabled", "true").param("page", "1")
.param("size", "5").param("sortBy", "name").param("sortDir", "desc"))
@@ -57,9 +57,9 @@ class AdminUserControllerTest {
@Test
void list_legacySearchKeyActsAsQ() throws Exception {
when(users.list("bob", null, 0, 20, null, null)).thenReturn(Map.of("content", List.of()));
when(users.list("bob", null, 0, 20, null, null, null)).thenReturn(Map.of("content", List.of()));
mvc.perform(get("/api/admin/users").param("searchKey", "bob")).andExpect(status().isOk());
verify(users).list("bob", null, 0, 20, null, null);
verify(users).list("bob", null, 0, 20, null, null, null);
}
@Test