def add_claims_to_jwt_token(user):
    """
    Return the claims that should be added to the JWT token.

    This function is called whenever create_access_token is called.
    """
    return {
        "roles": list(map(lambda r: r.name, user.roles)),
        "permissions": list(map(lambda p: p.name, user.permissions)),
    }