def confirmUserOwnedParent(requested_obj, user_id):
    """
    Confirms recursiveley that a file is (or is a descendant of) a user owned folder
    and that the user has access to it.
    """
    if (requested_obj.owner.id == user_id):
        return True

    parent = requested_obj.parent_folder
    while (parent):
        if (parent.owner.id == user_id):
            return True
        parent = parent.parent_folder
    return False