def login_required(obj):
    """
    Requires that the user be logged in order to gain access to the resource
    at the specified the URI.
    """
    decorator = request_passes_test(lambda r, *args, **kwargs: r.user.is_authenticated())
    return wrap_object(obj, decorator)