import { User } from "../contexts/UserContext";

export function hasPermission(
  user: User | null | undefined,
  permission: string | null | undefined,
): boolean {
  if (user == null) return false;
  if (permission == null) return true;
  return user.permissions.includes(permission);
}
