fix: 后台登录审计查询按字符串返回用户ID

This commit is contained in:
richjohnrambo
2026-09-16 13:39:50 +08:00
parent 1038d25abd
commit fa95dd72af
2 changed files with 16 additions and 2 deletions
+14
View File
@@ -100,6 +100,20 @@ func TestGroupMessageQuerySupportsOperationalFilters(t *testing.T) {
}
}
func TestLoginAuditQuerySpecsExposeUserIDAsString(t *testing.T) {
for label, spec := range map[string]*internalQuerySpec{
"user-login-logs": internalTenantResourceSpecs["user-login-logs"],
"login-failure-logs": internalTenantResourceSpecs["login-failure-logs"],
} {
if spec == nil {
t.Fatalf("%s query spec missing", label)
}
if !strings.Contains(spec.Select, "CAST(user_id AS CHAR) AS user_id") {
t.Fatalf("%s query must expose 64-bit user IDs as strings: %s", label, spec.Select)
}
}
}
func TestUserQuerySupportsKeywordAndUserIDs(t *testing.T) {
req := httptest.NewRequest("GET", "/?keyword=alice&user_ids=101,202&account_no=1000", nil)
query, countQuery, args, _, _, err := buildInternalAdminListQuery(req, usersInternalQuerySpec(), "")