(userIds: string[])
| 36 | * failure — callers must fail closed. |
| 37 | */ |
| 38 | export async function getActivelyBannedUserIds(userIds: string[]): Promise<string[]> { |
| 39 | const ids = [...new Set(userIds.filter(Boolean))] |
| 40 | if (ids.length === 0) return [] |
| 41 | |
| 42 | const [accessControl, rows] = await Promise.all([ |
| 43 | getAccessControlConfig(), |
| 44 | db |
| 45 | .select({ id: user.id, email: user.email, banned: user.banned, banExpires: user.banExpires }) |
| 46 | .from(user) |
| 47 | .where(inArray(user.id, ids)), |
| 48 | ]) |
| 49 | |
| 50 | return rows |
| 51 | .filter((row) => isBanActive(row) || isEmailBlockedByAccessControl(row.email, accessControl)) |
| 52 | .map((row) => row.id) |
| 53 | } |
no test coverage detected