async def get_user(
    db: AsyncSession = Depends(get_db),
    x_api_key: Optional[str] = Header(None),
    auth0_user: Optional[Auth0User] = Depends(auth0.get_user),
) -> schemas.User:
    """Retrieve user from super user from database.

    Args:
    ----
        request (Request): The request object.
        db (AsyncSession): Database session.
        x_api_key (Optional[str]): API key provided in the request header.
        auth0_user (Optional[Auth0User]): User details from Auth0.

    Returns:
    -------
        schemas.User: User details from the database.

    Raises:
    ------
        HTTPException: If the user is not found in the database or if
            no authentication method is provided.

    """
    # For test environments or when auth is disabled, use the first superuser
    user = None
    if not settings.AUTH_ENABLED:
        user = await crud.user.get_by_email(db, email=settings.FIRST_SUPERUSER)
    elif auth0_user:
        user = await crud.user.get_by_email(db, email=auth0_user.email)
    elif x_api_key:
        user = await crud.user.get_by_api_key(db, api_key=x_api_key)

    if user:
        return schemas.User.model_validate(user)

    raise HTTPException(status_code=401, detail="Unauthorized, no user was found")
Retrieve user from super user from database.

    Args:
    ----
        request (Request): The request object.
        db (AsyncSession): Database session.
        x_api_key (Optional[str]): API key provided in the request header.
        auth0_user (Optional[Auth0User]): User details from Auth0.

    Returns:
    -------
        schemas.User: User details from the database.

    Raises:
    ------
        HTTPException: If the user is not found in the database or if
            no authentication method is provided.

    
backend/airweave/api/deps.py