mirror of
https://github.com/tale/headplane.git
synced 2026-08-20 18:02:17 +00:00
Add user utility functions and tests for OIDC user filtering
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import type { User } from "~/types/User";
|
||||
|
||||
// Filter users with valid IDs (OIDC users may not have a name)
|
||||
export function filterUsersWithValidIds(users: User[]): User[] {
|
||||
return users.filter((user) => user.id?.length > 0);
|
||||
}
|
||||
|
||||
// Get display name with fallback: name -> displayName -> email -> id
|
||||
export function getUserDisplayName(user: User): string {
|
||||
return user.name || user.displayName || user.email || user.id;
|
||||
}
|
||||
Reference in New Issue
Block a user